From 3c98c78fc75da13398826ed2ecb5b126c4f57fd1 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 5 Aug 2016 17:41:23 +0200 Subject: [IMP] website: allow to navigate through menus in edit mode Now, when clicking on a menu item while being in edit mode, a modal opens asking if we want to go to that page, edit that page, edit the menu or do nothing (it only allowed to edit the menu item before). --- addons/website/static/src/js/website.contentMenu.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'addons/website/static/src/js/website.contentMenu.js') diff --git a/addons/website/static/src/js/website.contentMenu.js b/addons/website/static/src/js/website.contentMenu.js index e01ec55eb24..82bbefcf8c2 100644 --- a/addons/website/static/src/js/website.contentMenu.js +++ b/addons/website/static/src/js/website.contentMenu.js @@ -26,7 +26,7 @@ var TopBarContent = Widget.extend({ return this._super(); }, - edit_menu: function () { + edit_menu: function (action_before_reload) { var context = base.get_context(); var def = $.Deferred(); if ($("[data-content_menu_id]").length) { @@ -39,8 +39,8 @@ var TopBarContent = Widget.extend({ def.resolve(null); } - def.then(function (root_id) { - ajax.jsonRpc('/web/dataset/call_kw', 'call', { + return def.then(function (root_id) { + return ajax.jsonRpc('/web/dataset/call_kw', 'call', { model: 'website.menu', method: 'get_tree', args: [context.website_id, root_id], @@ -48,7 +48,13 @@ var TopBarContent = Widget.extend({ context: context }, }).then(function (menu) { - return new EditMenuDialog(this, {}, menu).open(); + var dialog = new EditMenuDialog(this, {}, menu).open(); + dialog.on("saved", null, function () { + $.when(action_before_reload && action_before_reload()).then(function () { + editor.reload(); + }); + }); + return dialog; }); }); }, @@ -301,9 +307,8 @@ var EditMenuDialog = widget.Dialog.extend({ kwargs: { context: context }, - }).then(function (menu) { - _super(); - editor.reload(); + }).then(function () { + return _super(); }); }, }); -- cgit v1.2.3