summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/menu/edit.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-11-19 17:13:32 +0000
committerqsm-odoo <qsm@odoo.com>2018-11-20 10:05:54 +0000
commit180de24df0d1c10d36b4f05e4b563f225b0a5ae3 (patch)
tree4a0b511c6573cf17d4d1afc7b44f3c389cda109b /addons/website/static/src/js/menu/edit.js
parenta0bda6bcf244dd413f5bf1ab0010a209fe1322bb (diff)
[FIX] website: allow publishers to save their website edition
On save, the editor will ask to parent widgets if something needs to be done first. The website navbar will receive that demand and asks to its action-capable components to do something. For example, the content menu handles page-related options saving. However, some users with limited access rights do not have the content menu... but the website navbar expects that the save action is performed. So, this empty action is defined here so that all users have an 'on_save' related action. This was only happening since 12.0 as 'on_save' actions were introduced there to save page-related options. closes odoo/odoo#28810
Diffstat (limited to 'addons/website/static/src/js/menu/edit.js')
-rw-r--r--addons/website/static/src/js/menu/edit.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/website/static/src/js/menu/edit.js b/addons/website/static/src/js/menu/edit.js
index 9fd0edd169c..fc5532a3a29 100644
--- a/addons/website/static/src/js/menu/edit.js
+++ b/addons/website/static/src/js/menu/edit.js
@@ -15,6 +15,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
xmlDependencies: ['/website/static/src/xml/website.editor.xml'],
actions: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.prototype.actions, {
edit: '_startEditMode',
+ on_save: '_onSave',
}),
custom_events: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.custom_events || {}, {
snippet_dropped: '_onSnippetDropped',
@@ -89,6 +90,19 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
return def;
});
},
+ /**
+ * On save, the editor will ask to parent widgets if something needs to be
+ * done first. The website navbar will receive that demand and asks to its
+ * action-capable components to do something. For example, the content menu
+ * handles page-related options saving. However, some users with limited
+ * access rights do not have the content menu... but the website navbar
+ * expects that the save action is performed. So, this empty action is
+ * defined here so that all users have an 'on_save' related action.
+ *
+ * @private
+ * @todo improve the system to somehow declare required/optional actions
+ */
+ _onSave: function () {},
//--------------------------------------------------------------------------
// Handlers