[FIX] website media editor: next previous
authorchm@openerp.com <>
Tue, 8 Apr 2014 08:42:37 +0000 (10:42 +0200)
committerchm@openerp.com <>
Tue, 8 Apr 2014 08:42:37 +0000 (10:42 +0200)
bzr revid: chm@openerp.com-20140408084237-y8yh8cb1gsv94gbo

addons/website/static/src/js/website.editor.js
addons/website/static/src/xml/website.editor.xml
addons/website/views/snippets.xml

index 7c2ed28..c09f9a6 100644 (file)
             //'change input.url': 'preview_image',
             //'change select.image-style': 'preview_image',
             'click .existing-attachments img': 'select_existing',
-            'click .pager > li': function (e) {
-                e.preventDefault();
-                var $target = $(e.currentTarget);
-                if ($target.hasClass('disabled')) {
-                    return;
-                }
-                this.page += $target.hasClass('previous') ? -1 : 1;
-                this.display_attachments();
-            },
             'click .existing-attachment-remove': 'try_remove',
         }),
 
             this._super(parent, editor, media);
         },
         start: function () {
+            var self = this;
             var res = this._super();
 
             var o = { url: null };
             Object.preventExtensions(o);
             this.trigger('start', o);
 
+            this.parent.$(".pager > li").click(function (e) {
+                e.preventDefault();
+                var $target = $(e.currentTarget);
+                if ($target.hasClass('disabled')) {
+                    return;
+                }
+                self.page += $target.hasClass('previous') ? -1 : 1;
+                self.display_attachments();
+            });
+
             this.set_image(o.url);
 
             return res;
             this.$('.existing-attachments').replaceWith(
                 openerp.qweb.render(
                     'website.editor.dialog.image.existing.content', {rows: rows}));
-            this.$('.pager')
+            this.parent.$('.pager')
                 .find('li.previous').toggleClass('disabled', (from === 0)).end()
                 .find('li.next').toggleClass('disabled', (from + per_screen >= records.length));
         },
index f060269..99ffe3f 100644 (file)
     </t>
     <t t-name="website.editor.dialog.image.existing.content">
         <div class="existing-attachments">
-            <ul class="pager">
-                <li class="previous disabled"><a href="#">← Previous</a></li>
-                <li class="next disabled"><a href="#">Next →</a></li>
-            </ul>
             <div class="row mt16" t-foreach="rows" t-as="row">
                 <div class="col-sm-2 existing-attachment-cell"
                      t-foreach="row" t-as="attachment">
index c999d80..b6debf6 100644 (file)
 
     <div data-snippet-option-id='media'
         data-selector="img:not(.cke_iframe), .media_iframe_video, span.fa, i.fa, .glyphicon">
-        <li><a href="#" class="edition">Change Media</a></li>
+        <li><a href="#" class="edition">Change...</a></li>
     </div>
 
     <div data-snippet-option-id='transform'
                 <li data-value="fa-spin"><a>Spin</a></li>
             </ul>
         </li>
-        <li><a href="#" class="clear-style">Clear Style</a></li>
+        <li><a href="#" class="clear-style">Reset Style</a></li>
     </div>
 
 </template>