[FIX] tags edition breakage in website_event_track

* 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
This commit is contained in:
Xavier Morel 2014-02-25 14:12:28 +01:00
parent 4572ea9ef3
commit 750b9f405c
2 changed files with 8 additions and 5 deletions

View File

@ -66,8 +66,10 @@
// only enable editors manually // only enable editors manually
CKEDITOR.disableAutoInline = true; CKEDITOR.disableAutoInline = true;
// EDIT ALL THE THINGS // EDIT ALL THE THINGS
CKEDITOR.dtd.$editable = $.extend( CKEDITOR.dtd.$editable = _.omit(
{}, CKEDITOR.dtd.$block, CKEDITOR.dtd.$inline); $.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 // Disable removal of empty elements on CKEDITOR activation. Empty
// elements are used for e.g. support of FontAwesome icons // elements are used for e.g. support of FontAwesome icons
CKEDITOR.dtd.$removeEmpty = {}; CKEDITOR.dtd.$removeEmpty = {};
@ -377,8 +379,7 @@
}); });
}, },
upcast: function (el) { upcast: function (el) {
return el.attributes['class'] return el.hasClass('fa');
&& (/\bfa\b/.test(el.attributes['class']));
} }
}); });
} }
@ -650,6 +651,7 @@
if (previous && previous === this) { return; } if (previous && previous === this) { return; }
var selected = new CKEDITOR.dom.element(this); var selected = new CKEDITOR.dom.element(this);
// FIXME: fa nodes may not be editable widgets (?)
if (!is_editable_node(selected) && !selected.hasClass('fa')) { if (!is_editable_node(selected) && !selected.hasClass('fa')) {
return; return;
} }

View File

@ -197,7 +197,8 @@
<h2 t-field="track.name" class="text-center"/> <h2 t-field="track.name" class="text-center"/>
<h3 t-field="event.name" class="text-center text-muted"/> <h3 t-field="event.name" class="text-center text-muted"/>
<ul t-if="track.tag_ids" class="text-center text-muted list-inline"> <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) }"> <a t-attf-href="/event/#{ slug(event) }/track/tag/#{ slug(tag_id) }">
<span t-field="tag_id.name"/> <span t-field="tag_id.name"/>
</a> </a>