2014-03-06 13:02:40 +00:00
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var website = openerp.website;
|
|
|
|
var _t = openerp._t;
|
|
|
|
|
|
|
|
website.snippet.options.subscribe = website.snippet.Option.extend({
|
|
|
|
on_prompt: function () {
|
|
|
|
var self = this;
|
|
|
|
return website.prompt({
|
|
|
|
id: "editor_new_subscribe_button",
|
2014-03-13 19:48:01 +00:00
|
|
|
window_title: _t("Add a Subscribe Button"),
|
2014-03-06 13:02:40 +00:00
|
|
|
select: _t("Mailing List"),
|
|
|
|
init: function (field) {
|
|
|
|
return website.session.model('mail.group')
|
|
|
|
.call('name_search', ['', [['public','=','public']]], { context: website.get_context() });
|
|
|
|
},
|
|
|
|
}).then(function (mail_group_id) {
|
|
|
|
self.$target.attr("data-id", mail_group_id);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
drop_and_build_snippet: function() {
|
|
|
|
var self = this;
|
|
|
|
this._super();
|
|
|
|
this.on_prompt().fail(function () {
|
|
|
|
self.editor.on_remove();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
start : function () {
|
|
|
|
var self = this;
|
|
|
|
this.$el.find(".js_mailing_list").on("click", _.bind(this.on_prompt, this));
|
|
|
|
this._super();
|
|
|
|
},
|
2014-03-06 13:47:46 +00:00
|
|
|
clean_for_save: function () {
|
|
|
|
this.$target.addClass("hidden");
|
|
|
|
},
|
2014-03-06 13:02:40 +00:00
|
|
|
});
|
|
|
|
})();
|
|
|
|
|
|
|
|
|