summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-05-12 16:39:45 +0200
committerThibault Delavallée <tde@openerp.com>2014-05-12 16:39:45 +0200
commit46235aa78c04240f7abcf0e62ff92aad997700a2 (patch)
tree25d0fe6a3eac3d822f56b63878ff9552406fafd9 /addons/mass_mailing/static/src/js/website_mass_mailing.editor.js
parentcce820565d9b85786d528b17670031bb112f1e64 (diff)
parent9d9cfd585f56bf64126e7316ea60ea5131a02059 (diff)
[MERGE] Sync with turnk
Diffstat (limited to 'addons/mass_mailing/static/src/js/website_mass_mailing.editor.js')
-rw-r--r--addons/mass_mailing/static/src/js/website_mass_mailing.editor.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js b/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js
new file mode 100644
index 00000000000..4caba1d29b5
--- /dev/null
+++ b/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js
@@ -0,0 +1,40 @@
+(function () {
+ 'use strict';
+
+ var website = openerp.website;
+ var _t = openerp._t;
+
+ website.snippet.options.mailing_list_subscribe = website.snippet.Option.extend({
+ on_prompt: function () {
+ var self = this;
+ return website.prompt({
+ id: "editor_new_mailing_list_subscribe_button",
+ window_title: _t("Add a Newsletter Subscribe Button"),
+ select: _t("Newsletter"),
+ init: function (field) {
+ return website.session.model('mail.mass_mailing.list')
+ .call('name_search', ['', []], { context: website.get_context() });
+ },
+ }).then(function (mailing_list_id) {
+ self.$target.attr("data-list-id", mailing_list_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();
+ },
+ clean_for_save: function () {
+ this.$target.addClass("hidden");
+ },
+ });
+})();
+
+