diff --git a/mass_mailing_custom_unsubscribe/data/mail_unsubscription_reason.xml b/mass_mailing_custom_unsubscribe/data/mail_unsubscription_reason.xml index 24a6eda..aa78554 100644 --- a/mass_mailing_custom_unsubscribe/data/mail_unsubscription_reason.xml +++ b/mass_mailing_custom_unsubscribe/data/mail_unsubscription_reason.xml @@ -1,39 +1,38 @@ - + - - + I'm not interested 10 - + - + I did not request this 20 - + - + I get too many emails 30 - + - + Other reason 100 - + diff --git a/mass_mailing_custom_unsubscribe/demo/assets.xml b/mass_mailing_custom_unsubscribe/demo/assets.xml index ca828bc..86743fd 100644 --- a/mass_mailing_custom_unsubscribe/demo/assets.xml +++ b/mass_mailing_custom_unsubscribe/demo/assets.xml @@ -1,25 +1,26 @@ - + - - + - - + + - + - - + + diff --git a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js index 0d12240..949bec4 100644 --- a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js +++ b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js @@ -1,102 +1,100 @@ /* Copyright 2016 Jairo Llopis * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define("mass_mailing_custom_unsubscribe.contact_tour", - function (require) { - "use strict"; - var base = require("web_editor.base"); - var tour = require("web_tour.tour"); +odoo.define("mass_mailing_custom_unsubscribe.contact_tour", function(require) { + "use strict"; + var base = require("web_editor.base"); + var tour = require("web_tour.tour"); - // Allow to know if an element is required - $.extend($.expr[':'], { - propRequired: function (element) { - return $(element).prop("required"); - }, - }); + // Allow to know if an element is required + $.extend($.expr[":"], { + propRequired: function(element) { + return $(element).prop("required"); + }, + }); - tour.register( - "mass_mailing_custom_unsubscribe_tour_contact", + tour.register( + "mass_mailing_custom_unsubscribe_tour_contact", + { + test: true, + wait_for: base.ready(), + }, + [ { - test: true, - wait_for: base.ready(), + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio:not(:checked)", + extra_trigger: "#reason_form #custom_div_feedback", }, - [ - { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio:not(:checked)", - extra_trigger: "#reason_form #custom_div_feedback", - }, - { - content: "Switch to not interested reason", - trigger: - ".radio:contains(\"I'm not interested\") :radio:not(:checked)", - extra_trigger: "[name='details']:propRequired", - }, - { - content: "Unsubscribe", - trigger: "#reason_form button:submit", - extra_trigger: "body:not(:has([name='details']:propRequired))", - }, - { - content: "Successfully unsubscribed", - trigger: "body:not(:has(#reason_form)) #subscription_info " + - ":contains('successfully unsubscribed from')", - }, - { - content: "Unsubscription reasons are invisible", - trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", - }, - { - content: "List 2 is not cross unsubscriptable", - trigger: "body:not(:has(li:contains('test list 2')))", - }, - { - content: "List 3 is not public", - trigger: "body:not(:has(li:contains('test list 3')))", - }, - { - content: "Uncheck list 1", - trigger: "li:contains('test list 1') input:checked", - }, - { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio", - extra_trigger: ".radio:contains('Other reason') " + - ":radio:not(:checked)", - }, - { - content: "Add details to reason", - trigger: "[name='details']:visible:propRequired", - run: "text I want to unsubscribe because I want. Period.", - extra_trigger: ".radio:contains('Other reason') :radio:checked", - }, - { - content: "Update subscriptions 2nd time", - trigger: "#unsubscribe_form :submit", - }, - { - content: "Successfully unsubscribed", - trigger: - "#subscription_info:contains('Your changes have been saved.')", - }, - { - content: "Subscribe again to list 0", - // eslint-disable-next-line no-multi-str - trigger:"body:not(:has(#unsubscribe_form #custom_div_feedback\ + { + content: "Switch to not interested reason", + trigger: '.radio:contains("I\'m not interested") :radio:not(:checked)', + extra_trigger: "[name='details']:propRequired", + }, + { + content: "Unsubscribe", + trigger: "#reason_form button:submit", + extra_trigger: "body:not(:has([name='details']:propRequired))", + }, + { + content: "Successfully unsubscribed", + trigger: + "body:not(:has(#reason_form)) #subscription_info " + + ":contains('successfully unsubscribed from')", + }, + { + content: "Unsubscription reasons are invisible", + trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", + }, + { + content: "List 2 is not cross unsubscriptable", + trigger: "body:not(:has(li:contains('test list 2')))", + }, + { + content: "List 3 is not public", + trigger: "body:not(:has(li:contains('test list 3')))", + }, + { + content: "Uncheck list 1", + trigger: "li:contains('test list 1') input:checked", + }, + { + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio", + extra_trigger: + ".radio:contains('Other reason') " + ":radio:not(:checked)", + }, + { + content: "Add details to reason", + trigger: "[name='details']:visible:propRequired", + run: "text I want to unsubscribe because I want. Period.", + extra_trigger: ".radio:contains('Other reason') :radio:checked", + }, + { + content: "Update subscriptions 2nd time", + trigger: "#unsubscribe_form :submit", + }, + { + content: "Successfully unsubscribed", + trigger: "#subscription_info:contains('Your changes have been saved.')", + }, + { + content: "Subscribe again to list 0", + // eslint-disable-next-line no-multi-str + trigger: + "body:not(:has(#unsubscribe_form #custom_div_feedback\ :visible)):has(.alert-success) li:contains('test list 0') \ input:not(:checked)", - }, - { - content: "Update subscriptions 3nd time", - // eslint-disable-next-line no-multi-str - trigger:"#unsubscribe_form:not(\ + }, + { + content: "Update subscriptions 3nd time", + // eslint-disable-next-line no-multi-str + trigger: + "#unsubscribe_form:not(\ :has(.js_unsubscription_reason:visible)) :submit", - }, - { - content: "Successfully subscribed", - trigger: - "#subscription_info:contains('Your changes have been saved.')", - }, - ] - ); - } -); + }, + { + content: "Successfully subscribed", + trigger: "#subscription_info:contains('Your changes have been saved.')", + }, + ] + ); +}); diff --git a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js index 063cbee..d345b5c 100644 --- a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js +++ b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js @@ -1,48 +1,48 @@ /* Copyright 2016 Jairo Llopis * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define("mass_mailing_custom_unsubscribe.partner_tour", - function (require) { - "use strict"; - var base = require("web_editor.base"); - var tour = require("web_tour.tour"); +odoo.define("mass_mailing_custom_unsubscribe.partner_tour", function(require) { + "use strict"; + var base = require("web_editor.base"); + var tour = require("web_tour.tour"); - // Allow to know if an element is required - $.extend($.expr[':'], { - propRequired: function (element) { - return $(element).prop("required"); - }, - }); + // Allow to know if an element is required + $.extend($.expr[":"], { + propRequired: function(element) { + return $(element).prop("required"); + }, + }); - tour.register( - "mass_mailing_custom_unsubscribe_tour_partner", + tour.register( + "mass_mailing_custom_unsubscribe_tour_partner", + { + tour: true, + wait_for: base.ready(), + }, + [ { - tour: true, - wait_for: base.ready(), + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio:not(:checked)", + extra_trigger: "#reason_form #custom_div_feedback", }, - [ - { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio:not(:checked)", - extra_trigger: "#reason_form #custom_div_feedback", - }, - { - content: "Switch to not interested reason", - // eslint-disable-next-line no-multi-str - trigger: ".radio:contains(\"I'm not interested\") \ - :radio:not(:checked)", - extra_trigger: "[name='details']:propRequired", - }, - { - content: "Unsubscribe", - trigger: "#reason_form button:submit", - extra_trigger: "body:not(:has([name='details']:propRequired))", - }, - { - content: "Successfully unsubscribed", - trigger: "body:not(:has(#reason_form)) #subscription_info " + - ":contains('successfully unsubscribed')", - }, - ] - ); - } -); + { + content: "Switch to not interested reason", + // eslint-disable-next-line no-multi-str + trigger: + '.radio:contains("I\'m not interested") \ + :radio:not(:checked)', + extra_trigger: "[name='details']:propRequired", + }, + { + content: "Unsubscribe", + trigger: "#reason_form button:submit", + extra_trigger: "body:not(:has([name='details']:propRequired))", + }, + { + content: "Successfully unsubscribed", + trigger: + "body:not(:has(#reason_form)) #subscription_info " + + ":contains('successfully unsubscribed')", + }, + ] + ); +}); diff --git a/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js b/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js index 7417db1..c6c0ce8 100644 --- a/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js +++ b/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js @@ -5,30 +5,30 @@ * to extend it as it is currently designed. It is almost a copy+paste from * upstream, to allow easier version/patch updates, so linter is disabled. */ /* eslint-disable */ -odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { - 'use strict'; +odoo.define("mass_mailing_custom_unsubscribe.unsubscribe", function(require) { + "use strict"; - var ajax = require('web.ajax'); - var core = require('web.core'); - require('web.dom_ready'); + var ajax = require("web.ajax"); + var core = require("web.core"); + require("web.dom_ready"); var _t = core._t; - if (!$('.o_unsubscribe_form').length) { + if (!$(".o_unsubscribe_form").length) { return $.Deferred().reject("DOM doesn't contain '.o_unsubscribe_form'"); } var email = $("input[name='email']").val(); var mailing_id = parseInt($("input[name='mailing_id']").val(), 10); var res_id = parseInt($("input[name='res_id']").val(), 10); - var token = (location.search.split('token' + '=')[1] || '').split('&')[0]; + var token = (location.search.split("token" + "=")[1] || "").split("&")[0]; var $mailing_lists = $("input[name='contact_ids']"); var $reasons = $("#custom_div_feedback"); var $details = $("textarea[name='details']"); var $radio = $(":radio"); var $info_state = $("#info_state, #custom_div_feedback"); - $radio.on('change click', function (e) { + $radio.on("change click", function(e) { $details.prop( "required", $(e.target).is("[data-details-required]") && $(e.target).is(":visible") @@ -36,9 +36,9 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { }); // Display reasons form only if there are unsubscriptions - var toggle_reasons = function () { + var toggle_reasons = function() { // Find contacts that were checked and now are unchecked - var $disabled = $mailing_lists.filter(function () { + var $disabled = $mailing_lists.filter(function() { var $this = $(this); return !$this.prop("checked") && $this.attr("checked"); }); @@ -47,11 +47,12 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { var $radios = $reasons.find(":radio"); if ($reasons.is(":hidden")) { // Uncheck chosen reason - $radios.prop("checked", false) - // Unrequire specifying a reason - .prop("required", false) - // Remove possible constraints for details - .trigger("change"); + $radios + .prop("checked", false) + // Unrequire specifying a reason + .prop("required", false) + // Remove possible constraints for details + .trigger("change"); // Clear textarea $details.val(""); } else { @@ -60,76 +61,87 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { } }; - $mailing_lists.change(function (e) { + $mailing_lists.change(function(e) { toggle_reasons(); - $('#info_state').addClass('invisible'); + $("#info_state").addClass("invisible"); }); - if (email != '' && email != undefined) { - ajax.jsonRpc('/mailing/blacklist/check', 'call', { - 'email': email, - 'mailing_id': mailing_id, - 'res_id': res_id, - 'token': token + if (email != "" && email != undefined) { + ajax.jsonRpc("/mailing/blacklist/check", "call", { + email: email, + mailing_id: mailing_id, + res_id: res_id, + token: token, }) - .then(function (result) { - if (result == 'unauthorized') { - $('#button_add_blacklist').hide(); - $('#button_remove_blacklist').hide(); - } - else if (result == true) { - $('#button_remove_blacklist').show(); + .then(function(result) { + if (result == "unauthorized") { + $("#button_add_blacklist").hide(); + $("#button_remove_blacklist").hide(); + } else if (result == true) { + $("#button_remove_blacklist").show(); toggle_opt_out_section(false); - } - else if (result == false) { - $('#button_add_blacklist').show(); + } else if (result == false) { + $("#button_add_blacklist").show(); toggle_opt_out_section(true); - } - else { - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); + } else { + $("#subscription_info").html( + _t("An error occured. Please try again later or contact us.") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); } }) - .guardedCatch(function () { - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); + .guardedCatch(function() { + $("#subscription_info").html( + _t("An error occured. Please try again later or contact us.") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); }); - } - else { - $('#div_blacklist').hide(); + } else { + $("#div_blacklist").hide(); } var unsubscribed_list = $("input[name='unsubscribed_list']").val(); - if (unsubscribed_list){ - $('#subscription_info').html(_.str.sprintf( - _t("You have been successfully unsubscribed from %s."), - unsubscribed_list - )); - } - else{ - $('#subscription_info').html(_t('You have been successfully unsubscribed.')); + if (unsubscribed_list) { + $("#subscription_info").html( + _.str.sprintf( + _t("You have been successfully unsubscribed from %s."), + unsubscribed_list + ) + ); + } else { + $("#subscription_info").html( + _t("You have been successfully unsubscribed.") + ); } - $('#unsubscribe_form').on('submit', function (e) { + $("#unsubscribe_form").on("submit", function(e) { e.preventDefault(); var checked_ids = []; - $("input[type='checkbox']:checked").each(function (i) { + $("input[type='checkbox']:checked").each(function(i) { checked_ids[i] = parseInt($(this).val(), 10); }); var unchecked_ids = []; - $("input[type='checkbox']:not(:checked)").each(function (i) { + $("input[type='checkbox']:not(:checked)").each(function(i) { unchecked_ids[i] = parseInt($(this).val(), 10); }); var values = { - 'opt_in_ids': checked_ids, - 'opt_out_ids': unchecked_ids, - 'email': email, - 'mailing_id': mailing_id, - 'res_id': res_id, - 'token': token + opt_in_ids: checked_ids, + opt_out_ids: unchecked_ids, + email: email, + mailing_id: mailing_id, + res_id: res_id, + token: token, }; // Only send reason and details if an unsubscription was found if ($reasons.is(":visible")) { @@ -140,41 +152,53 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { values.details = $details.val(); } - ajax.jsonRpc('/mail/mailing/unsubscribe', 'call', values) - .then(function (result) { - if (result == 'unauthorized') { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('You are not authorized to do this!')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning'); - } - else if (result == true) { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('Your changes have been saved.')); - $info_state.removeClass('alert-info').addClass('alert-success'); + ajax.jsonRpc("/mail/mailing/unsubscribe", "call", values) + .then(function(result) { + if (result == "unauthorized") { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t("You are not authorized to do this!") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-error") + .addClass("alert-warning"); + } else if (result == true) { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html(_t("Your changes have been saved.")); + $info_state.removeClass("alert-info").addClass("alert-success"); // Store checked status, to enable further changes - $mailing_lists.each(function () { + $mailing_lists.each(function() { var $this = $(this); $this.attr("checked", $this.prop("checked")); }); toggle_reasons(); - } - else { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('An error occurred. Your changes have not been saved, try again later.')); - $info_state.removeClass('alert-info').addClass('alert-warning'); + } else { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "An error occurred. Your changes have not been saved, try again later." + ) + ); + $info_state.removeClass("alert-info").addClass("alert-warning"); } }) - .guardedCatch(function () { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('An error occurred. Your changes have not been saved, try again later.')); - $info_state.removeClass('alert-info').addClass('alert-warning'); + .guardedCatch(function() { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "An error occurred. Your changes have not been saved, try again later." + ) + ); + $info_state.removeClass("alert-info").addClass("alert-warning"); }); }); // ================== // Blacklist // ================== - $('#button_add_blacklist').click(function (e) { + $("#button_add_blacklist").click(function(e) { e.preventDefault(); if ($reasons.is(":hidden")) { @@ -185,104 +209,161 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) { return; } - ajax.jsonRpc('/mailing/blacklist/add', 'call', { - 'email': email, - 'mailing_id': mailing_id, - 'res_id': res_id, - 'token': token, - 'reason_id': parseInt($reasons.find("[name='reason_id']:checked").val(), 10), - 'details': $details.val(), + ajax.jsonRpc("/mailing/blacklist/add", "call", { + email: email, + mailing_id: mailing_id, + res_id: res_id, + token: token, + reason_id: parseInt($reasons.find("[name='reason_id']:checked").val(), 10), + details: $details.val(), }) - .then(function (result) { - if (result == 'unauthorized') { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('You are not authorized to do this!')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning'); - } - else { + .then(function(result) { + if (result == "unauthorized") { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t("You are not authorized to do this!") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-error") + .addClass("alert-warning"); + } else { if (result) { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('You have been successfully added to our blacklist. ' - + 'You will not be contacted anymore by our services.')); - $info_state.removeClass('alert-warning').removeClass('alert-info').removeClass('alert-error').addClass('alert-success'); + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "You have been successfully added to our blacklist. " + + "You will not be contacted anymore by our services." + ) + ); + $info_state + .removeClass("alert-warning") + .removeClass("alert-info") + .removeClass("alert-error") + .addClass("alert-success"); toggle_opt_out_section(false); // set mailing lists checkboxes to previous state - $mailing_lists.each(function () { + $mailing_lists.each(function() { var $this = $(this); $this.prop("checked", $(this)[0].hasAttribute("checked")); }); // Hide reasons and reset reason fields - $reasons.toggleClass("d-none", true) - .find(":radio").prop("checked", false); + $reasons + .toggleClass("d-none", true) + .find(":radio") + .prop("checked", false); $details.val("").prop("required", false); + } else { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "An error occured. Please try again later or contact us." + ) + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); } - else { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); - } - $('#button_add_blacklist').hide(); - $('#button_remove_blacklist').show(); - $('#unsubscribed_info').hide(); + $("#button_add_blacklist").hide(); + $("#button_remove_blacklist").show(); + $("#unsubscribed_info").hide(); } }) - .guardedCatch(function () { - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); + .guardedCatch(function() { + $("#subscription_info").html( + _t("An error occured. Please try again later or contact us.") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); }); }); - $('#button_remove_blacklist').click(function (e) { + $("#button_remove_blacklist").click(function(e) { e.preventDefault(); - ajax.jsonRpc('/mailing/blacklist/remove', 'call', { - 'email': email, - 'mailing_id': mailing_id, - 'res_id': res_id, - 'token': token + ajax.jsonRpc("/mailing/blacklist/remove", "call", { + email: email, + mailing_id: mailing_id, + res_id: res_id, + token: token, }) - .then(function (result) { - if (result == 'unauthorized') { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('You are not authorized to do this!')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning'); - } - else { + .then(function(result) { + if (result == "unauthorized") { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t("You are not authorized to do this!") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-error") + .addClass("alert-warning"); + } else { if (result) { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t("You have been successfully removed from our blacklist. " - + "You are now able to be contacted by our services.")); - $info_state.removeClass('alert-warning').removeClass('alert-info').removeClass('alert-error').addClass('alert-success'); + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "You have been successfully removed from our blacklist. " + + "You are now able to be contacted by our services." + ) + ); + $info_state + .removeClass("alert-warning") + .removeClass("alert-info") + .removeClass("alert-error") + .addClass("alert-success"); toggle_opt_out_section(true); + } else { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t( + "An error occured. Please try again later or contact us." + ) + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); } - else { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); - } - $('#button_add_blacklist').show(); - $('#button_remove_blacklist').hide(); - $('#unsubscribed_info').hide(); + $("#button_add_blacklist").show(); + $("#button_remove_blacklist").hide(); + $("#unsubscribed_info").hide(); } }) - .guardedCatch(function () { - $('#info_state').removeClass('invisible'); - $('#subscription_info').html(_t('An error occured. Please try again later or contact us.')); - $info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error'); + .guardedCatch(function() { + $("#info_state").removeClass("invisible"); + $("#subscription_info").html( + _t("An error occured. Please try again later or contact us.") + ); + $info_state + .removeClass("alert-success") + .removeClass("alert-info") + .removeClass("alert-warning") + .addClass("alert-error"); }); }); }); function toggle_opt_out_section(value) { var result = !value; - $("#div_opt_out").find('*').attr('disabled', result); - $("#button_add_blacklist").attr('disabled', false); - $("#button_remove_blacklist").attr('disabled', false); - $("#custom_div_feedback").find('*').attr('disabled', false); + $("#div_opt_out") + .find("*") + .attr("disabled", result); + $("#button_add_blacklist").attr("disabled", false); + $("#button_remove_blacklist").attr("disabled", false); + $("#custom_div_feedback") + .find("*") + .attr("disabled", false); if (value) { - $('[name="button_subscription"]').addClass('clickable'); - } - else { - $('[name="button_subscription"]').removeClass('clickable'); + $('[name="button_subscription"]').addClass("clickable"); + } else { + $('[name="button_subscription"]').removeClass("clickable"); } } diff --git a/mass_mailing_custom_unsubscribe/templates/general_reason_form.xml b/mass_mailing_custom_unsubscribe/templates/general_reason_form.xml index 3aa5a13..a29b37b 100644 --- a/mass_mailing_custom_unsubscribe/templates/general_reason_form.xml +++ b/mass_mailing_custom_unsubscribe/templates/general_reason_form.xml @@ -1,24 +1,34 @@ - - - We would appreciate if you provide feedback about why you updatedyour subscriptions + + We would appreciate if you provide feedback about why you updatedyour subscriptions - - + + - + @@ -26,12 +36,25 @@ - - - - - - + + + + + + Unsubscribe now diff --git a/mass_mailing_custom_unsubscribe/templates/mass_mailing_contact_reason.xml b/mass_mailing_custom_unsubscribe/templates/mass_mailing_contact_reason.xml index debd50f..cb0a6fa 100644 --- a/mass_mailing_custom_unsubscribe/templates/mass_mailing_contact_reason.xml +++ b/mass_mailing_custom_unsubscribe/templates/mass_mailing_contact_reason.xml @@ -1,31 +1,36 @@ - - + - + - + - + - + diff --git a/mass_mailing_custom_unsubscribe/views/assets.xml b/mass_mailing_custom_unsubscribe/views/assets.xml index 6e6d075..f72bb40 100644 --- a/mass_mailing_custom_unsubscribe/views/assets.xml +++ b/mass_mailing_custom_unsubscribe/views/assets.xml @@ -1,15 +1,18 @@ - + - - + - - + + diff --git a/mass_mailing_custom_unsubscribe/views/mail_mass_mailing_list_view.xml b/mass_mailing_custom_unsubscribe/views/mail_mass_mailing_list_view.xml index 7008b82..0a4682b 100644 --- a/mass_mailing_custom_unsubscribe/views/mail_mass_mailing_list_view.xml +++ b/mass_mailing_custom_unsubscribe/views/mail_mass_mailing_list_view.xml @@ -1,16 +1,17 @@ - + - mailing.list - + - + diff --git a/mass_mailing_custom_unsubscribe/views/mail_unsubscription_reason_view.xml b/mass_mailing_custom_unsubscribe/views/mail_unsubscription_reason_view.xml index 86bc785..8047d1d 100644 --- a/mass_mailing_custom_unsubscribe/views/mail_unsubscription_reason_view.xml +++ b/mass_mailing_custom_unsubscribe/views/mail_unsubscription_reason_view.xml @@ -1,7 +1,6 @@ - + - @@ -11,11 +10,11 @@ - - - + + + - + @@ -26,9 +25,9 @@ mail.unsubscription.reason - - - + + + @@ -38,20 +37,22 @@ mail.unsubscription.reason - - + + + id="mail_unsubscription_reason_action" + name="Unsubscription Reasons" + res_model="mail.unsubscription.reason" + /> + id="mail_unsubscription_reason_menu" + parent="mass_mailing.mass_mailing_configuration" + action="mail_unsubscription_reason_action" + /> diff --git a/mass_mailing_custom_unsubscribe/views/mail_unsubscription_view.xml b/mass_mailing_custom_unsubscribe/views/mail_unsubscription_view.xml index 4d6d0ac..96cf18f 100644 --- a/mass_mailing_custom_unsubscribe/views/mail_unsubscription_view.xml +++ b/mass_mailing_custom_unsubscribe/views/mail_unsubscription_view.xml @@ -1,7 +1,6 @@ - + - @@ -11,26 +10,31 @@ - - - - - - - - - - + + + + + + + + + + - - + + @@ -41,14 +45,14 @@ mail.unsubscription - - - - - - - - + + + + + + + + @@ -58,32 +62,44 @@ mail.unsubscription - - - - - - - + + + + + + + - - + - + - + - + - + + context="{'group_by': 'mass_mailing_id'}" + /> @@ -94,9 +110,9 @@ mail.unsubscription - - - + + + @@ -106,18 +122,23 @@ mail.unsubscription - - + + - + - +
We would appreciate if you provide feedback about why you updatedyour subscriptions +
We would appreciate if you provide feedback about why you updatedyour subscriptions