diff options
| author | chm@openerp.com <> | 2014-04-23 17:48:52 +0200 |
|---|---|---|
| committer | chm@openerp.com <> | 2014-04-23 17:48:52 +0200 |
| commit | ee7ff4bd07d8d84ed2ebb0e2e3f5eb437f158e5b (patch) | |
| tree | 25577845139d390f9bf27e0237d18842aeace02b /addons/website | |
| parent | b1bc68d8eb374f30173e03e8048d1c3588a00d4b (diff) | |
| parent | 1657ffb8e7d95ef5f94e59121737abb068371b66 (diff) | |
[MERGE] from trunk
bzr revid: chm@openerp.com-20140423154852-gzegxqrzb2sj01zl
Diffstat (limited to 'addons/website')
| -rw-r--r-- | addons/website/models/ir_qweb.py | 4 | ||||
| -rw-r--r-- | addons/website/models/ir_ui_view.py | 2 | ||||
| -rw-r--r-- | addons/website/models/website.py | 11 | ||||
| -rw-r--r-- | addons/website/static/src/css/editor.css | 9 | ||||
| -rw-r--r-- | addons/website/static/src/css/editor.sass | 7 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 1 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.snippets.editor.js | 43 |
7 files changed, 45 insertions, 32 deletions
diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index 8916968f7ca..ad2b63a6dd9 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -383,6 +383,10 @@ class Contact(orm.AbstractModel): _name = 'website.qweb.field.contact' _inherit = ['ir.qweb.field.contact', 'website.qweb.field.many2one'] +class QwebView(orm.AbstractModel): + _name = 'website.qweb.field.qweb' + _inherit = ['ir.qweb.field.qweb'] + def html_to_text(element): """ Converts HTML content with HTML-specified line breaks (br, p, div, ...) diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index c9fadade6ed..f67f6ada4b9 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -128,8 +128,6 @@ class view(osv.osv): if isinstance(id_or_xml_id, list): id_or_xml_id = id_or_xml_id[0] - if isinstance(id_or_xml_id, (int, long)): - id_or_xml_id = self.get_view_xmlid(cr, uid, id_or_xml_id) if not context: context = {} diff --git a/addons/website/models/website.py b/addons/website/models/website.py index a0a6d1fb28b..51dda75f516 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -221,10 +221,13 @@ class website(osv.osv): ) def get_template(self, cr, uid, ids, template, context=None): - if '.' not in template: - template = 'website.%s' % template - module, xmlid = template.split('.', 1) - model, view_id = request.registry["ir.model.data"].get_object_reference(cr, uid, module, xmlid) + if isinstance(template, (int, long)): + view_id = template + else: + if '.' not in template: + template = 'website.%s' % template + module, xmlid = template.split('.', 1) + model, view_id = request.registry["ir.model.data"].get_object_reference(cr, uid, module, xmlid) return self.pool["ir.ui.view"].browse(cr, uid, view_id, context=context) def _render(self, cr, uid, ids, template, values=None, context=None): diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index 9b708057852..7d8b1e609e8 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -106,6 +106,15 @@ content: "Press The Top-Left Edit Button" !important; } +[data-oe-type=html].oe_no_empty:empty:before { + content: "" !important; +} + +[data-oe-type=html].oe_no_empty:empty { + background-image: none !important; + height: 16px !important; +} + /* ---- EDITOR BAR ---- {{{ */ table.editorbar-panel { cursor: pointer; diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index b9db2bc5bbb..d39b6abd453 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -86,6 +86,13 @@ .oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before content: 'Press The Top-Left Edit Button' !important +[data-oe-type=html].oe_no_empty:empty:before + content: '' !important + +[data-oe-type=html].oe_no_empty:empty + background-image: none !important + height: 16px !important + // }}} /* ---- EDITOR BAR ---- {{{ */ diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index c2e2ed46783..be69c66b615 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -427,6 +427,7 @@ editor.edit(); } }); + website.editor_bar = editor; }; /* ----- TOP EDITOR BAR FOR ADMIN ---- */ diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index 7865c1f3933..8f49409924d 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -130,6 +130,7 @@ */ + var dummy = function () {}; var website = openerp.website; website.add_template_file('/website/static/src/xml/website.snippets.xml'); @@ -361,15 +362,20 @@ }, clean_for_save: function () { var self = this; - this.dom_filter(website.snippet.globalSelector).each(function () { - var $snippet = $(this); - self.make_active($snippet); - self.make_active(false); - var editor = $snippet.data("snippet-editor"); - if (editor) { - editor.clean_for_save(); + $("*[contentEditable], *[attributeEditable]") + .removeAttr('contentEditable') + .removeAttr('attributeEditable'); + + var options = website.snippet.options; + var template = website.snippet.templateOptions; + for (var k in options) { + if (template[k] && options[k].prototype.clean_for_save !== dummy) { + var $snippet = this.dom_filter(template[k].selector); + $snippet.each(function () { + new options[k](self, null, $(this), k).clean_for_save(); + }); } - }); + } }, make_active: function ($snippet) { if ($snippet && this.$active_snipped_id && this.$active_snipped_id.get(0) === $snippet.get(0)) { @@ -853,8 +859,7 @@ } }, - clean_for_save: function () { - } + clean_for_save: dummy }); website.snippet.options.background = website.snippet.Option.extend({ @@ -942,8 +947,7 @@ this.id = this.unique_id(); this.$target.attr("id", this.id); this.$target.find("[data-slide]").attr("data-cke-saved-href", "#" + this.id); - this.$target.find("[data-slide-to]").attr("data-target", "#" + this.id); - + this.$target.find("[data-target]").attr("data-target", "#" + this.id); this.rebind_event(); }, on_clone: function ($clone) { @@ -963,7 +967,7 @@ }, clean_for_save: function () { this._super(); - this.$target.find(".item").removeClass("next prev left right"); + $(".carousel").find(".item").removeClass("next prev left right active"); if(!this.$target.find(".item.active").length) { this.$target.find(".item:first").addClass("active"); } @@ -1757,19 +1761,6 @@ } this.$overlay.removeClass('oe_active'); }, - - /* clean_for_save - * function called just before save vue - */ - clean_for_save: function () { - for (var i in this.styles){ - this.styles[i].clean_for_save(); - } - this.$target.removeAttr('contentEditable') - .find('*').removeAttr('contentEditable'); - this.$target.removeAttr('attributeEditable') - .find('*').removeAttr('attributeEditable'); - }, }); })(); |
