[IMP] Content menu: Add a new blog post asks for category
bzr revid: fme@openerp.com-20131114093305-dz08vnc5cdkvfddo
This commit is contained in:
parent
95f63af992
commit
c26013ab22
|
@ -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';
|
||||
});
|
||||
}
|
||||
}),
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue