2013-11-13 17:14:38 +00:00
|
|
|
(function() {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var website = openerp.website;
|
|
|
|
website.add_template_file('/website_blog/static/src/xml/website_blog.xml');
|
2013-11-14 09:33:05 +00:00
|
|
|
|
2014-01-16 18:05:35 +00:00
|
|
|
website.is_editable = true;
|
2013-11-14 09:33:05 +00:00
|
|
|
website.EditorBar.include({
|
2014-01-16 18:05:35 +00:00
|
|
|
start: function() {
|
|
|
|
var res = this._super();
|
|
|
|
if ($("#wrap.js_blog").size()) {
|
|
|
|
this.$("button[data-action=edit]").removeClass("hidden");
|
|
|
|
}
|
|
|
|
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
|
|
|
return res;
|
|
|
|
},
|
2013-11-14 09:33:05 +00:00
|
|
|
events: _.extend({}, website.EditorBar.prototype.events, {
|
|
|
|
'click a[data-action=new_blog_post]': function (ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
website.prompt({
|
2013-11-14 21:28:56 +00:00
|
|
|
window_title: "New Blog Post",
|
|
|
|
select: "Select Blog",
|
2013-11-14 09:33:05 +00:00
|
|
|
init: function (field) {
|
|
|
|
return website.session.model('blog.category')
|
|
|
|
.call('name_search', [], { context: website.get_context() });
|
|
|
|
},
|
|
|
|
}).then(function (cat_id) {
|
2013-11-29 16:14:34 +00:00
|
|
|
document.location = '/blogpost/new?category_id=' + cat_id;
|
2013-11-14 09:33:05 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
});
|
2013-11-13 17:14:38 +00:00
|
|
|
})();
|