[FIX] tags edition breakage in website_event_track
authorXavier Morel <xmo@openerp.com>
Tue, 25 Feb 2014 13:12:28 +0000 (14:12 +0100)
committerXavier Morel <xmo@openerp.com>
Tue, 25 Feb 2014 13:12:28 +0000 (14:12 +0100)
* remove some nodes from the $editables set, ``li`` really does not like being
  widgetified. Remove a few others just in case

* split fa outside of li to make it safely (ish) editable

* simplify upcast function for icons cke widget

bzr revid: xmo@openerp.com-20140225131228-2m75itgi4zbj5xfh

addons/website/static/src/js/website.editor.js
addons/website_event_track/views/website_event.xml

index dc82c0c..f782f2f 100644 (file)
     // only enable editors manually
     CKEDITOR.disableAutoInline = true;
     // EDIT ALL THE THINGS
-    CKEDITOR.dtd.$editable = $.extend(
-        {}, CKEDITOR.dtd.$block, CKEDITOR.dtd.$inline);
+    CKEDITOR.dtd.$editable = _.omit(
+        $.extend({}, CKEDITOR.dtd.$block, CKEDITOR.dtd.$inline),
+        // well maybe not *all* the things
+        'ul', 'ol', 'li', 'table', 'tr', 'th', 'td');
     // Disable removal of empty elements on CKEDITOR activation. Empty
     // elements are used for e.g. support of FontAwesome icons
     CKEDITOR.dtd.$removeEmpty = {};
                         });
                     },
                     upcast: function (el) {
-                        return el.attributes['class']
-                            && (/\bfa\b/.test(el.attributes['class']));
+                        return el.hasClass('fa');
                     }
                 });
             }
                 if (previous && previous === this) { return; }
 
                 var selected = new CKEDITOR.dom.element(this);
+                // FIXME: fa nodes may not be editable widgets (?)
                 if (!is_editable_node(selected) && !selected.hasClass('fa')) {
                     return;
                 }
index 14ed725..7232160 100644 (file)
             <h2 t-field="track.name" class="text-center"/>
             <h3 t-field="event.name" class="text-center text-muted"/>
             <ul t-if="track.tag_ids" class="text-center text-muted list-inline">
-                <li t-foreach="track.tag_ids" t-as="tag_id" class="fa fa-tags">
+                <li t-foreach="track.tag_ids" t-as="tag_id">
+                    <span class="fa fa-tags"></span>
                     <a t-attf-href="/event/#{ slug(event) }/track/tag/#{ slug(tag_id) }">
                         <span t-field="tag_id.name"/>
                     </a>