summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.editor.js
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2013-10-28 12:23:50 +0100
committerFabien Meghazi <fme@openerp.com>2013-10-28 12:23:50 +0100
commit26e62b0e0eb9210bb3b152279766d80aa67ae403 (patch)
tree0fc61cddaa2e2a5901c79bdd7b245a18f1e433a2 /addons/website/static/src/js/website.editor.js
parent321bf56b995b0a21654933569d53bcfcb359f637 (diff)
[IMP] Menu tree from client side
bzr revid: fme@openerp.com-20131028112350-9or1z3e3ndgk4mfg
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
-rw-r--r--addons/website/static/src/js/website.editor.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index aa1ab86b330..25453bde0d6 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -849,21 +849,24 @@
var context = website.get_context();
return openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'website.menu',
- method: 'get_list',
+ method: 'get_tree',
args: [[context.website_id]],
kwargs: {
context: context
},
});
},
- fill_menus: function (results) {
+ fill_menus: function (tree) {
var self = this;
var menus = this.$('select.add-to-menu')[0];
- _(results).each(function (result) {
- var name = (new Array(result.level).join('|-')) + ' ' + result.name;
- menus.options[menus.options.length] =
- new Option(name, result.id || 0);
- });
+ var process_tree = function(node) {
+ var name = (new Array(node.level + 1).join('|-')) + ' ' + node.name;
+ menus.options[menus.options.length] = new Option(name, node.id);
+ node.children.forEach(function (child) {
+ process_tree(child);
+ });
+ };
+ process_tree(tree);
},
});
/**