diff options
| author | qsm-odoo <qsm@odoo.com> | 2016-08-05 17:41:23 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2016-08-19 17:44:27 +0200 |
| commit | 3c98c78fc75da13398826ed2ecb5b126c4f57fd1 (patch) | |
| tree | 4e643df2b67066abd933d901ab90f1bc198d7d4b /addons/website/static/src/js/website.contentMenu.js | |
| parent | 0ab08050b9a2333a1f0793a524b56173cb3c3e3f (diff) | |
[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).
Diffstat (limited to 'addons/website/static/src/js/website.contentMenu.js')
| -rw-r--r-- | addons/website/static/src/js/website.contentMenu.js | 19 |
1 files changed, 12 insertions, 7 deletions
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(); }); }, }); |
