[ADD] Structure topmenu button

bzr revid: fme@openerp.com-20131105091117-hgzbnrxju3ftzmyx
This commit is contained in:
Fabien Meghazi
2013-11-05 10:11:17 +01:00
parent 843e16e57e
commit 3f7252e444
4 changed files with 21 additions and 21 deletions
+19 -16
View File
@@ -5,6 +5,25 @@
website.menu = {};
website.add_template_file('/website/static/src/xml/website.menu.xml');
website.EditorBar.include({
events: _.extend({}, website.EditorBar.prototype.events, {
'click a[data-action="edit-structure"]': 'editStructure',
}),
editStructure: function () {
var context = website.get_context();
openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'website.menu',
method: 'get_tree',
args: [[context.website_id]],
kwargs: {
context: context
},
}).then(function (menu) {
return new website.menu.EditMenuDialog(menu).appendTo(document.body);
});
},
});
website.menu.EditMenuDialog = website.editor.Dialog.extend({
template: 'website.menu.dialog.edit',
events: _.extend({}, website.editor.Dialog.prototype.events, {
@@ -171,20 +190,4 @@
},
});
website.dom_ready.then(function () {
$('.js_edit_menu').on('click', function () {
var context = website.get_context();
openerp.jsonRpc('/web/dataset/call_kw', 'call', {
model: 'website.menu',
method: 'get_tree',
args: [[context.website_id]],
kwargs: {
context: context
},
}).then(function (menu) {
return new website.menu.EditMenuDialog(menu).appendTo(document.body);
});
});
});
})();
@@ -28,7 +28,7 @@
</t>
<t t-name="website.menu.dialog.edit">
<t t-call="website.editor.dialog">
<t t-set="title">Edit Menu</t>
<t t-set="title">Edit Structure</t>
<ul class="oe_menu_editor">
<t t-foreach="widget.menu.children" t-as="submenu">
<t t-call="website.menu.dialog.submenu"/>
@@ -21,6 +21,7 @@
<ul class="nav navbar-nav navbar-right">
<li><a data-action="show-mobile-preview" href="#"><span title="Mobile preview" class="icon-mobile-phone"/></a></li>
<li class="divider-vertical"></li>
<li><a data-action="edit-structure" href="#"><span title="Edit website structure">Structure</span></a></li>
<li><a data-action="promote-current-page" href="#"><span title="Promote page on the web">Promote</span></a></li>
<li class="dropdown">
<a id="customize-menu-button" class="dropdown-toggle" data-toggle="dropdown" href="#">Customize <span class="caret"></span></a>
@@ -144,10 +144,6 @@
</ul>
</li>
</ul>
<button t-if="editable" type="button" title="Edit menu" data-placement="left"
class="js_edit_menu js_tooltip oe_admin_action btn btn-warning mt8 pull-right">
<i class="icon-edit"/>
</button>
</div>
</div>
</div>