summaryrefslogtreecommitdiff
path: root/addons/website_mail/static/src
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2014-05-28 17:45:31 +0200
committerOlivier Dony <odo@openerp.com>2014-05-28 17:45:31 +0200
commite276ac33f614a97655e1b950abd71edae22e217a (patch)
treea9516f2a2aef806bd99452b3ce10c4afe9c69f1d /addons/website_mail/static/src
parentb4283f027175cf80f83d57a1585cc1a8a3ea3b34 (diff)
parentbf135ad05798abaff0acc87fc19092cde5fd5c36 (diff)
[MERGE] Forward-port saas-4 up to bf135ad
Diffstat (limited to 'addons/website_mail/static/src')
-rw-r--r--addons/website_mail/static/src/js/website_mail.editor.js40
-rw-r--r--addons/website_mail/static/src/js/website_mail.js77
2 files changed, 0 insertions, 117 deletions
diff --git a/addons/website_mail/static/src/js/website_mail.editor.js b/addons/website_mail/static/src/js/website_mail.editor.js
deleted file mode 100644
index 7a26920682b..00000000000
--- a/addons/website_mail/static/src/js/website_mail.editor.js
+++ /dev/null
@@ -1,40 +0,0 @@
-(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",
- window_title: _t("Add a Subscribe Button"),
- 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();
- },
- clean_for_save: function () {
- this.$target.addClass("hidden");
- },
- });
-})();
-
-
diff --git a/addons/website_mail/static/src/js/website_mail.js b/addons/website_mail/static/src/js/website_mail.js
deleted file mode 100644
index d069f88ea45..00000000000
--- a/addons/website_mail/static/src/js/website_mail.js
+++ /dev/null
@@ -1,77 +0,0 @@
-(function () {
- 'use strict';
-
- var website = openerp.website;
-
- website.snippet.animationRegistry.follow = website.snippet.Animation.extend({
- selector: ".js_follow",
- start: function (editable_mode) {
- var self = this;
- this.is_user = false;
-
- openerp.jsonRpc('/website_mail/is_follower', 'call', {
- model: this.$target.data('object'),
- id: this.$target.data('id'),
- fields: ['name', 'alias_id'],
- }).always(function (data) {
- self.is_user = data.is_user;
- self.$target.find('.js_mg_email').attr('href', 'mailto:' + data.alias_id[1]);
- self.$target.find('.js_mg_link').attr('href', '/groups/' + data.id);
- self.toggle_subscription(data.is_follower);
- self.$target.find('input.js_follow_email')
- .val(data.email ? data.email : "")
- .attr("disabled", data.is_follower || (data.email.length && self.is_user) ? "disabled" : false);
- self.$target.removeClass("hidden");
- });
-
- // not if editable mode to allow designer to edit alert field
- if (!editable_mode) {
- $('.js_follow > .alert').addClass("hidden");
- $('.js_follow > .input-group-btn.hidden').removeClass("hidden");
- this.$target.find('.js_follow_btn, .js_unfollow_btn').on('click', function (event) {
- event.preventDefault();
- self.on_click();
- });
- }
- return;
- },
- on_click: function () {
- var self = this;
- var $email = this.$target.find(".js_follow_email");
-
- if ($email.length && !$email.val().match(/.+@.+/)) {
- this.$target.addClass('has-error');
- return false;
- }
- this.$target.removeClass('has-error');
-
- openerp.jsonRpc('/website_mail/follow', 'call', {
- 'id': +this.$target.data('id'),
- 'object': this.$target.data('object'),
- 'message_is_follower': this.$target.attr("data-follow") || "off",
- 'email': $email.length ? $email.val() : false,
- }).then(function (follow) {
- self.toggle_subscription(follow);
- });
- },
- toggle_subscription: function(follow) {
- if (follow) {
- this.$target.find(".js_mg_follow_form").addClass("hidden");
- this.$target.find(".js_mg_details").removeClass("hidden");
- }
- else {
- this.$target.find(".js_mg_follow_form").removeClass("hidden");
- this.$target.find(".js_mg_details").addClass("hidden");
- }
- this.$target.find('input.js_follow_email').attr("disabled", follow || this.is_user ? "disabled" : false);
- this.$target.attr("data-follow", follow ? 'on' : 'off');
- },
- });
-
- $(document).ready(function () {
- $('.js_follow_btn').on('click', function (ev) {
- var email = $(ev.currentTarget).parents('.js_mg_follow_form').first().find('.js_follow_email').val();
- $(document).find('.js_follow_email').val(email);
- });
- });
-})();