diff --git a/website_mass_mailing_name/README.rst b/website_mass_mailing_name/README.rst index 7c573cb7..00e5a708 100644 --- a/website_mass_mailing_name/README.rst +++ b/website_mass_mailing_name/README.rst @@ -1,17 +1,40 @@ -.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 - =========================================== Mass Mailing Subscription Snippet With Name =========================================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/12.0/website_mass_mailing_name + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-website_mass_mailing_name + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module extends the functionality of mass mailings to support asking for the contact name directly in the subscription snippet. If you want to get partners created automatically and linked to the contacts, -you can additionally install the `mass_mailing_partner -`_ module. +you can additionally install the `mass_mailing_partner` + +**Table of contents** + +.. contents:: + :local: Usage ===== @@ -24,37 +47,45 @@ To use this module, you need to: #. Choose the newsletter of your liking. #. Press *Save*. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/186/10.0 - Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Tecnativa + Contributors ------------- +~~~~~~~~~~~~ + +* `Tecnativa `_: -* Jairo Llopis + * Jairo Llopis + * Victor M.M. Torres -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_mass_mailing_name/__init__.py b/website_mass_mailing_name/__init__.py index 16545e96..eafb6c38 100644 --- a/website_mass_mailing_name/__init__.py +++ b/website_mass_mailing_name/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from . import controllers diff --git a/website_mass_mailing_name/__manifest__.py b/website_mass_mailing_name/__manifest__.py index 9a4316ed..646ba58e 100644 --- a/website_mass_mailing_name/__manifest__.py +++ b/website_mass_mailing_name/__manifest__.py @@ -1,10 +1,9 @@ -# -*- coding: utf-8 -*- -# Copyright 2016-2017 Jairo Llopis +# Copyright 2016-2019 Jairo Llopis # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "Mass Mailing Subscription Snippet With Name", "summary": "Ask for name when subscribing, and create and/or link partner", - "version": "10.0.1.0.1", + "version": "12.0.1.0.0", "category": "Website", "website": "https://github.com/OCA/social", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/website_mass_mailing_name/controllers/__init__.py b/website_mass_mailing_name/controllers/__init__.py index c02fd56e..6b7a5e0d 100644 --- a/website_mass_mailing_name/controllers/__init__.py +++ b/website_mass_mailing_name/controllers/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from . import main diff --git a/website_mass_mailing_name/controllers/main.py b/website_mass_mailing_name/controllers/main.py index cb50267c..67eff894 100644 --- a/website_mass_mailing_name/controllers/main.py +++ b/website_mass_mailing_name/controllers/main.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Jairo Llopis # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). diff --git a/website_mass_mailing_name/readme/CONTRIBUTORS.rst b/website_mass_mailing_name/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..6c68b4b1 --- /dev/null +++ b/website_mass_mailing_name/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Jairo Llopis + * Victor M.M. Torres diff --git a/website_mass_mailing_name/readme/DESCRIPTION.rst b/website_mass_mailing_name/readme/DESCRIPTION.rst new file mode 100644 index 00000000..6aa451e2 --- /dev/null +++ b/website_mass_mailing_name/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module extends the functionality of mass mailings to support asking for +the contact name directly in the subscription snippet. + +If you want to get partners created automatically and linked to the contacts, +you can additionally install the `mass_mailing_partner` diff --git a/website_mass_mailing_name/readme/USAGE.rst b/website_mass_mailing_name/readme/USAGE.rst new file mode 100644 index 00000000..f9095bb9 --- /dev/null +++ b/website_mass_mailing_name/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module, you need to: + +#. Go to any website page. +#. Insert any structure block. +#. Insert the *Newsletter* block as you would usually, inside a structure one. +#. Choose the newsletter of your liking. +#. Press *Save*. diff --git a/website_mass_mailing_name/static/description/index.html b/website_mass_mailing_name/static/description/index.html new file mode 100644 index 00000000..afa439fc --- /dev/null +++ b/website_mass_mailing_name/static/description/index.html @@ -0,0 +1,438 @@ + + + + + + +Mass Mailing Subscription Snippet With Name + + + +
+

Mass Mailing Subscription Snippet With Name

+ + +

Beta License: LGPL-3 OCA/social Translate me on Weblate Try me on Runbot

+

This module extends the functionality of mass mailings to support asking for +the contact name directly in the subscription snippet.

+

If you want to get partners created automatically and linked to the contacts, +you can additionally install the mass_mailing_partner

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to any website page.
  2. +
  3. Insert any structure block.
  4. +
  5. Insert the Newsletter block as you would usually, inside a structure one.
  6. +
  7. Choose the newsletter of your liking.
  8. +
  9. Press Save.
  10. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Jairo Llopis
    • +
    • Victor M.M. Torres
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.sass b/website_mass_mailing_name/static/src/css/website_mass_mailing_name.sass deleted file mode 100644 index 094153aa..00000000 --- a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.sass +++ /dev/null @@ -1,10 +0,0 @@ -/*! Copyright 2016-2017 Jairo Llopis - License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). - -.js_subscribe - .form-control - width: 50% - - &[data-subscribe="on"] - .js_subscribe_name:not([disabled]) - display: none diff --git a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.scss b/website_mass_mailing_name/static/src/css/website_mass_mailing_name.scss new file mode 100644 index 00000000..05adc26e --- /dev/null +++ b/website_mass_mailing_name/static/src/css/website_mass_mailing_name.scss @@ -0,0 +1,8 @@ +/*! Copyright 2016-2017 Jairo Llopis + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ +.js_subscribe .form-control { + width: 50%; +} +.js_subscribe[data-subscribe=on] .js_subscribe_name:not([disabled]) { + display: none; +} diff --git a/website_mass_mailing_name/static/src/js/editor_and_public_tour.js b/website_mass_mailing_name/static/src/js/editor_and_public_tour.js index c13b2268..81b8b3f5 100644 --- a/website_mass_mailing_name/static/src/js/editor_and_public_tour.js +++ b/website_mass_mailing_name/static/src/js/editor_and_public_tour.js @@ -19,7 +19,7 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir }, { content: "Drag and drop a text snippet", - trigger: ".oe_snippet[name='Text Block'] .oe_snippet_thumbnail", + trigger: ".oe_snippet[name='Text block'] .oe_snippet_thumbnail", run: "drag_and_drop #wrap", }, { @@ -45,11 +45,11 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir { content: "Open user menu", extra_trigger: ".js_subscribe .alert-success", - trigger: "#top_menu span:contains('Administrator')", + trigger: "#top_menu span:contains('Admin')", }, { content: "Logout", - trigger: "#o_logout a", + trigger: "#o_logout", }, // Now use the widget as a random public user { @@ -59,7 +59,7 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir }, { content: "Enter a name", - extra_trigger: ".js_subscribe.has-error", + extra_trigger: "div.input-group.js_subscribe", trigger: ".js_subscribe_name", run: "text Visitor", }, @@ -69,7 +69,7 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir }, { content: "Remove the name", - extra_trigger: ".js_subscribe.has-error", + extra_trigger: "div.input-group.js_subscribe", trigger: ".js_subscribe_name", run: function () { $(".js_subscribe_name").val(""); @@ -86,7 +86,7 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir }, { content: "Enter the name again", - extra_trigger: ".js_subscribe.has-error", + extra_trigger: "div.input-group.js_subscribe", trigger: ".js_subscribe_name", run: "text Visitor", }, @@ -101,7 +101,7 @@ odoo.define("website_mass_mailing_name.editor_and_public_tour", function (requir }, { content: "Enter the good email", - extra_trigger: ".js_subscribe.has-error", + extra_trigger: "div.input-group.js_subscribe", trigger: ".js_subscribe_email", run: "text example@example.com", }, diff --git a/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js b/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js index 922faf96..5b31b80a 100644 --- a/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js +++ b/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js @@ -4,12 +4,12 @@ odoo.define("website_mass_mailing_name.subscribe", function (require) { "use strict"; require("mass_mailing.website_integration"); - var animation = require("web_editor.snippets.animation"); + var animation = require("website.content.snippets.animation"); animation.registry.subscribe.include({ start: function(editable_mode) { - this.$email = this.$target.find(".js_subscribe_email"); - this.$name = this.$target.find(".js_subscribe_name"); + this.$email = this.$(".js_subscribe_email"); + this.$name = this.$(".js_subscribe_name"); // Thanks upstream for your @$&#?!! inheritance-ready code. // Injecting ajax events to modify behavior of snippet. if (this.$name) { @@ -18,16 +18,12 @@ odoo.define("website_mass_mailing_name.subscribe", function (require) { return this._super(editable_mode); }, - on_click: function() { - var email_error = !this.$email.val().match(/.+@.+/), - name_error = this.$name.length && !this.$name.val(), - values = { - "list_id": this.$target.data('list-id'), - "email": this.$email.val(), - }; - // Stop on error - if (email_error || name_error) { - this.$target.addClass("has-error") + _onClick: function() { + // Upstream will not tell user what is wrong with the + // email validation so this will report with a helping message + var email_valid = this.$email[0].reportValidity(), + name_valid = this.$name[0].reportValidity(); + if (!name_valid || !email_valid) { return false; } return this._super.apply(this, arguments); diff --git a/website_mass_mailing_name/templates/assets.xml b/website_mass_mailing_name/templates/assets.xml index 52c9f08d..4933d92c 100644 --- a/website_mass_mailing_name/templates/assets.xml +++ b/website_mass_mailing_name/templates/assets.xml @@ -8,7 +8,7 @@ inherit_id="website.assets_frontend"> + href="/website_mass_mailing_name/static/src/css/website_mass_mailing_name.scss"/>