[IMP] Content menu: Add a new blog post asks for category

bzr revid: fme@openerp.com-20131114093305-dz08vnc5cdkvfddo
This commit is contained in:
Fabien Meghazi 2013-11-14 10:33:05 +01:00
parent 95f63af992
commit c26013ab22
2 changed files with 19 additions and 1 deletions

View File

@ -3,4 +3,22 @@
var website = openerp.website;
website.add_template_file('/website_blog/static/src/xml/website_blog.xml');
website.EditorBar.include({
events: _.extend({}, website.EditorBar.prototype.events, {
'click a[data-action=new_blog_post]': function (ev) {
ev.preventDefault();
website.prompt({
window_title: "Create a new blog post",
select: "Select Blog Category",
init: function (field) {
return website.session.model('blog.category')
.call('name_search', [], { context: website.get_context() });
},
}).then(function (cat_id) {
document.location = '/blog/' + cat_id + '/new';
});
}
}),
});
})();

View File

@ -1,7 +1,7 @@
<templates id="template" xml:space="preserve">
<t t-extend="website.editorbar">
<t t-jquery="ul.oe_content_menu" t-operation="append">
<li><a href="#" class="js_content_new_blog">New Blog Post</a></li>
<li><a href="#" data-action="new_blog_post">New Blog Post</a></li>
</t>
</t>
</templates>