From 77c41cc5cb64a951789d251b445f05e42cf1b997 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 25 Sep 2014 15:32:25 +0200 Subject: [PATCH] [FIX] website: 'Display Editor Bar on Website' group stopped working at commit a2ef044c477 The Edit button never appeared anymore for these users. The idea was that they should see an edit button with limited editing capabilities depending on their other access rights. For example, someone with only Sales Manager access and 'Display Editor Bar on Website' would be able to edit online quotes from the website_quote module, but not change the actual website pages or menus, for instance. --- addons/website/models/ir_ui_view.py | 5 ++++- addons/website/static/src/js/website.editor.js | 10 +--------- addons/website/static/src/js/website.js | 5 +++-- addons/website/views/website_backend_navbar.xml | 4 ++-- openerp/addons/base/ir/ir_qweb.py | 6 +++++- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index da9de182eb8..ebb1753a189 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -159,7 +159,10 @@ class view(osv.osv): qcontext.update(values) # in edit mode ir.ui.view will tag nodes - context = dict(context, inherit_branding=qcontext.get('editable', False)) + if qcontext.get('editable'): + context = dict(context, inherit_branding=True) + elif request.registry['res.users'].has_group(cr, uid, 'base.group_website_publisher'): + context = dict(context, inherit_branding_auto=True) view_obj = request.website.get_template(id_or_xml_id) if 'main_object' not in qcontext: diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index ee6368ea5aa..82888c5d8a3 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -308,7 +308,6 @@ this.$('#website-top-edit').hide(); this.$('#website-top-view').show(); - this.$buttons.edit.show(); var $edit_button = this.$buttons.edit .prop('disabled', website.no_editor); @@ -822,14 +821,7 @@ return $(root).find('[data-oe-model]') .not('[data-oe-type = "selection"]') .not('link, script') - .not('.oe_snippet_editor') - .filter(function () { - var $this = $(this); - // keep view sections and fields which are *not* in - // view sections for top-level editables - return $this.data('oe-model') === 'ir.ui.view' - || !$this.closest('[data-oe-model = "ir.ui.view"]').length; - }); + .not('.oe_snippet_editor'); }, _current_editor: function () { diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 76756c08e47..be99c8e7221 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -282,8 +282,9 @@ return templates_def; }).then(function () { // display button if they are at least one editable zone in the page (check the branding) - var editable = $('html').data('website-id') && !!$('[data-oe-model]').size(); - $("#oe_editzone").toggle(editable); + if (!!$('[data-oe-model]').size()) { + $("#oe_editzone").show(); + } if ($('html').data('website-id')) { website.id = $('html').data('website-id'); diff --git a/addons/website/views/website_backend_navbar.xml b/addons/website/views/website_backend_navbar.xml index d30e5415be1..820248d2b58 100644 --- a/addons/website/views/website_backend_navbar.xml +++ b/addons/website/views/website_backend_navbar.xml @@ -25,8 +25,8 @@ -