summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2014-12-18 17:20:46 +0100
committerAntony Lesuisse <al@openerp.com>2014-12-18 22:50:12 +0100
commit4734cbab4d72afcc5b92b2e1714bc372800aae41 (patch)
tree55bed4486c9f0d8bfbd2067799eca597cc84f025 /addons/website/static/src
parent790312dbf92e302f40782a60c5dc208cd6877079 (diff)
[IMP] website.snippet: snippets can be splitted into separate template and be called into the lits of the snippet
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.snippets.editor.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index 90fbf3a4ce3..adfbcbd1b46 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -182,6 +182,12 @@
.then(function (html) {
var $html = $(html);
+ // t-snippet
+ $html.find('> .tab-content > div > [data-oe-type="snippet"]').each(function () {
+ var $div = $('<div/>').insertAfter(this).append(this).attr('name', $(this).data('oe-name'));
+ });
+ // end
+
var selector = [];
var $styles = $html.find("[data-js], [data-selector]");
$styles.each(function () {
@@ -214,10 +220,28 @@
'</div>');
$div.find('span').text($(this).attr("name"));
$(this).prepend($div);
+
+ // from t-snippet
+ var thumbnail = $("[data-oe-thumbnail]", this).data("oe-thumbnail");
+ if (thumbnail) {
+ $div.find('.oe_snippet_thumbnail_img').css('background-image', 'url(' + thumbnail + ')');
+ }
+ // end
}
$("> *:not(.oe_snippet_thumbnail)", this).addClass('oe_snippet_body');
});
+ // clean t-oe
+ $html.find('[data-oe-model]').each(function () {
+ for (var k=0; k<this.attributes.length; k++) {
+ if (this.attributes[k].name.indexOf('data-oe-') === 0) {
+ $(this).removeAttr(this.attributes[k].name);
+ k--;
+ }
+ }
+ });
+ // end
+
self.$el.append($html);
self.make_snippet_draggable(self.$snippets);