diff --git a/website_mass_mailing_name/README.rst b/website_mass_mailing_name/README.rst
index 7a0a47b03..7c573cb79 100644
--- a/website_mass_mailing_name/README.rst
+++ b/website_mass_mailing_name/README.rst
@@ -1,6 +1,6 @@
-.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
- :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
- :alt: License: AGPL-3
+.. 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
@@ -11,7 +11,7 @@ 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.
+`_ module.
Usage
=====
@@ -26,14 +26,7 @@ To use this module, you need to:
.. 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/8.0
-
-Known issues / Roadmap
-======================
-
-* If you use Firefox, you could hit https://github.com/odoo/odoo/issues/7722.
- Just use Chromium to work with this snippet until you update to Odoo 9.0.
-* When migrating to v9, improve the tour test to check autofilling of inputs.
+ :target: https://runbot.odoo-community.org/runbot/186/10.0
Bug Tracker
===========
diff --git a/website_mass_mailing_name/__init__.py b/website_mass_mailing_name/__init__.py
index 6b59127ea..16545e96a 100644
--- a/website_mass_mailing_name/__init__.py
+++ b/website_mass_mailing_name/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import controllers
diff --git a/website_mass_mailing_name/__openerp__.py b/website_mass_mailing_name/__manifest__.py
similarity index 54%
rename from website_mass_mailing_name/__openerp__.py
rename to website_mass_mailing_name/__manifest__.py
index a547e36a1..019fc5426 100644
--- a/website_mass_mailing_name/__openerp__.py
+++ b/website_mass_mailing_name/__manifest__.py
@@ -1,21 +1,24 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# Copyright 2016-2017 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": "8.0.1.0.0",
+ "version": "10.0.1.0.0",
"category": "Website",
"website": "https://tecnativa.com/",
"author": "Tecnativa, Odoo Community Association (OCA)",
- "license": "AGPL-3",
+ "license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
- "mass_mailing",
+ "website_mass_mailing",
+ ],
+ "demo": [
+ "demo/assets.xml",
],
"data": [
- "views/assets.xml",
- "views/snippets.xml",
+ "templates/assets.xml",
+ "templates/snippets.xml",
],
}
diff --git a/website_mass_mailing_name/controllers/__init__.py b/website_mass_mailing_name/controllers/__init__.py
index 494785710..c02fd56eb 100644
--- a/website_mass_mailing_name/controllers/__init__.py
+++ b/website_mass_mailing_name/controllers/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# 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 069de5d1c..cb50267cb 100644
--- a/website_mass_mailing_name/controllers/main.py
+++ b/website_mass_mailing_name/controllers/main.py
@@ -1,22 +1,28 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# Copyright 2016-2017 Jairo Llopis
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
-from openerp.addons.mass_mailing.controllers.main import MassMailController
-from openerp.http import request, route
+from odoo.addons.website_mass_mailing.controllers import main
+from odoo.http import request, route
-class MassMailingPartner(MassMailController):
+class MassMailController(main.MassMailController):
@route()
def is_subscriber(self, *args, **kwargs):
"""Get user name too."""
- result = super(MassMailingPartner, self).is_subscriber(*args, **kwargs)
- email = result.get("email") or ""
+ result = super(MassMailController, self).is_subscriber(*args, **kwargs)
if request.website.user_id != request.env.user:
name = request.env.user.name
else:
- name, email = (request.env["mail.mass_mailing.contact"]
- .get_name_email(email, context=request.context))
- result["name"] = name
- result["email"] = email
+ name = request.session.get("mass_mailing_name", "")
+ return dict(result, name=name)
+
+ @route()
+ def subscribe(self, list_id, email, **post):
+ """Store email with name in session."""
+ result = super(MassMailController, self).subscribe(
+ list_id, email, **post)
+ name, email = request.env['mail.mass_mailing.contact'].sudo() \
+ .get_name_email(email)
+ request.session["mass_mailing_name"] = name if name != email else ""
return result
diff --git a/website_mass_mailing_name/demo/assets.xml b/website_mass_mailing_name/demo/assets.xml
new file mode 100644
index 000000000..b569efc65
--- /dev/null
+++ b/website_mass_mailing_name/demo/assets.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/website_mass_mailing_name/i18n/de.po b/website_mass_mailing_name/i18n/de.po
index 9319d0b66..e4a5540ed 100644
--- a/website_mass_mailing_name/i18n/de.po
+++ b/website_mass_mailing_name/i18n/de.po
@@ -3,14 +3,14 @@
# * website_mass_mailing_name
#
# Translators:
-# Rudolf Schnapka , 2017
+# OCA Transbot , 2017
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
+"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-04-30 10:22+0000\n"
-"PO-Revision-Date: 2017-04-30 10:22+0000\n"
-"Last-Translator: Rudolf Schnapka , 2017\n"
+"POT-Creation-Date: 2017-07-22 00:51+0000\n"
+"PO-Revision-Date: 2017-07-22 00:51+0000\n"
+"Last-Translator: OCA Transbot , 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -19,6 +19,6 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: website_mass_mailing_name
-#: view:website:website.snippets
+#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form
msgid "your name..."
msgstr "Ihr Name..."
diff --git a/website_mass_mailing_name/i18n/es.po b/website_mass_mailing_name/i18n/es.po
index 414d94401..59e2a9e4d 100644
--- a/website_mass_mailing_name/i18n/es.po
+++ b/website_mass_mailing_name/i18n/es.po
@@ -1,23 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * website_mass_mailing_name
-#
+# * website_mass_mailing_name
+#
+# Translators:
+# OCA Transbot , 2017
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
+"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-05-24 15:03+0000\n"
-"PO-Revision-Date: 2016-05-24 17:04+0200\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
+"POT-Creation-Date: 2017-07-22 00:51+0000\n"
+"PO-Revision-Date: 2017-07-22 00:51+0000\n"
+"Last-Translator: OCA Transbot , 2017\n"
+"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: \n"
+"Content-Transfer-Encoding: \n"
"Language: es\n"
-"X-Generator: Poedit 1.8.7.1\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: website_mass_mailing_name
-#: view:website:website.snippets
+#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form
msgid "your name..."
msgstr "su nombre..."
diff --git a/website_mass_mailing_name/i18n/fr.po b/website_mass_mailing_name/i18n/fr.po
index b5d843b34..dc22bc7bc 100644
--- a/website_mass_mailing_name/i18n/fr.po
+++ b/website_mass_mailing_name/i18n/fr.po
@@ -3,14 +3,14 @@
# * website_mass_mailing_name
#
# Translators:
-# Christophe CHAUVET , 2016
+# OCA Transbot , 2017
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
+"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-06-30 01:08+0000\n"
-"PO-Revision-Date: 2016-06-30 01:08+0000\n"
-"Last-Translator: Christophe CHAUVET , 2016\n"
+"POT-Creation-Date: 2017-07-22 00:51+0000\n"
+"PO-Revision-Date: 2017-07-22 00:51+0000\n"
+"Last-Translator: OCA Transbot , 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -19,6 +19,6 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: website_mass_mailing_name
-#: view:website:website.snippets
+#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form
msgid "your name..."
msgstr "votre nom..."
diff --git a/website_mass_mailing_name/i18n/hr.po b/website_mass_mailing_name/i18n/hr.po
new file mode 100644
index 000000000..169fa6bd0
--- /dev/null
+++ b/website_mass_mailing_name/i18n/hr.po
@@ -0,0 +1,24 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * website_mass_mailing_name
+#
+# Translators:
+# Bole , 2017
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 10.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-12-01 02:19+0000\n"
+"PO-Revision-Date: 2017-12-01 02:19+0000\n"
+"Last-Translator: Bole , 2017\n"
+"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: hr\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+
+#. module: website_mass_mailing_name
+#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form
+msgid "your name..."
+msgstr "vaše ime..."
diff --git a/website_mass_mailing_name/i18n/sl.po b/website_mass_mailing_name/i18n/sl.po
index 6a319b33b..fb0572af6 100644
--- a/website_mass_mailing_name/i18n/sl.po
+++ b/website_mass_mailing_name/i18n/sl.po
@@ -3,14 +3,14 @@
# * website_mass_mailing_name
#
# Translators:
-# Matjaž Mozetič , 2016
+# OCA Transbot , 2017
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
+"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-06-30 01:08+0000\n"
-"PO-Revision-Date: 2016-06-30 01:08+0000\n"
-"Last-Translator: Matjaž Mozetič , 2016\n"
+"POT-Creation-Date: 2017-07-22 00:51+0000\n"
+"PO-Revision-Date: 2017-07-22 00:51+0000\n"
+"Last-Translator: OCA Transbot , 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -19,6 +19,6 @@ msgstr ""
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: website_mass_mailing_name
-#: view:website:website.snippets
+#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form
msgid "your name..."
msgstr "vaše ime..."
diff --git a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css b/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css
deleted file mode 100644
index d64ff5d05..000000000
--- a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@charset "UTF-8";
-/* © 2016 Jairo Llopis
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
-.js_subscribe .form-control {
- width: 50%; }
-.js_subscribe[data-subscribe="on"] .js_subscribe_name:not([disabled]) {
- display: none; }
-
-/*# sourceMappingURL=website_mass_mailing_name.css.map */
diff --git a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css.map b/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css.map
deleted file mode 100644
index 6e5fb9c66..000000000
--- a/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css.map
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-"version": 3,
-"mappings": ";;;AAKI,2BAAa;EACT,KAAK,EAAE,GAAG;AAGV,qEAAkC;EAC9B,OAAO,EAAE,IAAI",
-"sources": ["website_mass_mailing_name.sass"],
-"names": [],
-"file": "website_mass_mailing_name.css"
-}
\ No newline at end of file
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
index 63584b86e..094153aaf 100644
--- 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
@@ -1,6 +1,5 @@
-@charset "UTF-8"
-/* © 2016 Jairo Llopis
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+/*! Copyright 2016-2017 Jairo Llopis
+ License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
.js_subscribe
.form-control
diff --git a/website_mass_mailing_name/static/src/js/editor_tour.js b/website_mass_mailing_name/static/src/js/editor_tour.js
new file mode 100644
index 000000000..b6fe1c956
--- /dev/null
+++ b/website_mass_mailing_name/static/src/js/editor_tour.js
@@ -0,0 +1,50 @@
+/* Copyright 2016-2017 Jairo Llopis
+ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
+odoo.define("website_mass_mailing_name.editor_tour", function (require) {
+ "use strict";
+ var base = require("web_editor.base");
+ var tour = require("web_tour.tour");
+
+ tour.register(
+ "mass_mailing_name_editor",
+ {
+ test: true,
+ wait_for: base.ready(),
+ },
+ [
+ {
+ content: "Edit the homepage",
+ trigger: ".o_menu_systray a[data-action=edit]",
+ },
+ {
+ content: "Drag and drop a text snippet",
+ trigger: ".oe_snippet[name='Text Block'] .oe_snippet_thumbnail",
+ run: "drag_and_drop #wrap",
+ },
+ {
+ content: "Drag and drop a newsletter snippet",
+ trigger: ".oe_snippet[name='Newsletter'] .oe_snippet_thumbnail",
+ run: "drag_and_drop #wrap .s_text_block",
+ },
+ {
+ content: "Let the default mailing list",
+ trigger: ".modal-dialog button:contains('Continue')",
+ },
+ {
+ content: "Save changes",
+ extra_trigger: "body:not(:has(.modal:visible))",
+ trigger: "#web_editor-top-edit button[data-action=save]",
+ },
+ {
+ content: "Subscribe Administrator",
+ extra_trigger: "body:not(:has(#web_editor-top-edit))",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Open user menu",
+ extra_trigger: ".js_subscribe .alert-success",
+ trigger: "#top_menu span:contains('Administrator')",
+ },
+ ]
+ );
+});
diff --git a/website_mass_mailing_name/static/src/js/public_tour.js b/website_mass_mailing_name/static/src/js/public_tour.js
new file mode 100644
index 000000000..6236747b0
--- /dev/null
+++ b/website_mass_mailing_name/static/src/js/public_tour.js
@@ -0,0 +1,77 @@
+/* Copyright 2016-2017 Jairo Llopis
+ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
+odoo.define("website_mass_mailing_name.public_tour", function (require) {
+ "use strict";
+ var base = require("web_editor.base");
+ var tour = require("web_tour.tour");
+
+ tour.register(
+ "mass_mailing_name_public",
+ {
+ test: true,
+ wait_for: base.ready(),
+ },
+ [
+ {
+ content: "Try to subscribe without data",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Enter a name",
+ extra_trigger: ".js_subscribe.has-error",
+ trigger: ".js_subscribe_name",
+ run: "text Visitor",
+ },
+ {
+ content: "Try to subscribe without email",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Remove the name",
+ extra_trigger: ".js_subscribe.has-error",
+ trigger: ".js_subscribe_name",
+ run: function () {
+ $(".js_subscribe_name").val("");
+ },
+ },
+ {
+ content: "Enter an email",
+ trigger: ".js_subscribe_email",
+ run: "text example@example.com",
+ },
+ {
+ content: "Try to subscribe without name",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Enter the name again",
+ extra_trigger: ".js_subscribe.has-error",
+ trigger: ".js_subscribe_name",
+ run: "text Visitor",
+ },
+ {
+ content: "Enter a wrong email",
+ trigger: ".js_subscribe_email",
+ run: "text bad email",
+ },
+ {
+ content: "Try to subscribe with a bad email",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Enter the good email",
+ extra_trigger: ".js_subscribe.has-error",
+ trigger: ".js_subscribe_email",
+ run: "text example@example.com",
+ },
+ {
+ content: "Try to subscribe with good information",
+ trigger: ".js_subscribe_btn",
+ },
+ {
+ content: "Subscription successful",
+ trigger: ".js_subscribe:not(.has-error) .alert-success",
+ },
+ ]
+ );
+});
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 ffbe2e589..922faf96f 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
@@ -1,55 +1,53 @@
-/* © 2016 Jairo Llopis
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
+/* Copyright 2016-2017 Jairo Llopis
+ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
-"use strict";
-(function ($) {
- openerp.website.snippet.animationRegistry.subscribe.include({
+odoo.define("website_mass_mailing_name.subscribe", function (require) {
+ "use strict";
+ require("mass_mailing.website_integration");
+ var animation = require("web_editor.snippets.animation");
+
+ animation.registry.subscribe.include({
start: function(editable_mode) {
- var self = this;
- self.$email = self.$target.find(".js_subscribe_email");
- self.$name = self.$target.find(".js_subscribe_name");
-
+ this.$email = this.$target.find(".js_subscribe_email");
+ this.$name = this.$target.find(".js_subscribe_name");
// Thanks upstream for your @$?!! inheritance-ready code.
// Injecting ajax events to modify behavior of snippet.
- if (self.$name) {
- $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
- return self.on_ajax_send(event, jqXHR, ajaxOptions);
- });
+ if (this.$name) {
+ $(document).ajaxSend($.proxy(this.on_ajax_send, this));
}
-
- return self._super(editable_mode);
+ return this._super(editable_mode);
},
- on_click: function() {
- var self = this,
- email_error = !self.$email.val().match(/.+@.+/),
- name_error = self.$name.length && !self.$name.val(),
- values = {
- "list_id": self.$target.data('list-id'),
- "email": self.$email.val(),
- };
+ 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) {
- self.$target.addClass("has-error")
+ this.$target.addClass("has-error")
return false;
}
- return self._super();
+ return this._super.apply(this, arguments);
},
- on_ajax_send: function(event, jqXHR, ajaxOptions) {
- var self = this;
+ on_ajax_send: function(event, jqXHR, ajaxOptions) {
// Add handlers on correct requests
if (ajaxOptions.url == "/website_mass_mailing/is_subscriber") {
- jqXHR.then(function(data) {
- return self.on_start(data);
- });
+ jqXHR.done($.proxy(this.on_start, this));
} else if (ajaxOptions.url == "/website_mass_mailing/subscribe") {
var data = JSON.parse(ajaxOptions.data);
- data.params.email =
- self.$name.val() + " <" + data.params.email + ">";
+ data.params.email = _.str.sprintf(
+ "%s <%s>",
+ this.$name.val(),
+ data.params.email
+ );
ajaxOptions.data = JSON.stringify(data);
}
},
+
on_start: function(data) {
this.$name.val(data.result.name)
.attr(
@@ -58,4 +56,4 @@
);
},
});
-})(jQuery);
+});
diff --git a/website_mass_mailing_name/static/src/js/website_mass_mailing_name.tour.js b/website_mass_mailing_name/static/src/js/website_mass_mailing_name.tour.js
deleted file mode 100644
index 555904052..000000000
--- a/website_mass_mailing_name/static/src/js/website_mass_mailing_name.tour.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/* © 2016 Jairo Llopis
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
-
-"use strict";
-(function ($) {
- openerp.Tour.register({
- id: "mass_mailing_partner",
- name: "Insert a newsletter snippet and subscribe",
- path: "/",
- mode: "test",
- steps: [
- {
- title: "Edit the homepage",
- waitFor: "button[data-action=edit]",
- element: "button[data-action=edit]",
- },
- {
- title: "Click on Insert Blocks",
- waitFor: "button[data-action=snippet]",
- element: "button[data-action=snippet]",
- },
- {
- title: "Click on Structure",
- waitFor: "a[href='#snippet_structure']",
- element: "a[href='#snippet_structure']",
- },
- {
- title: "Drag and drop a text snippet",
- waitFor: ".oe_snippet:contains('Text Block'):visible",
- snippet: ".oe_snippet:contains('Text Block')",
- },
- {
- title: "Click on Insert Blocks again",
- waitFor: "#wrap h2:contains('A Great Headline'), \
- button[data-action=snippet]",
- element: "button[data-action=snippet]",
- },
- {
- title: "Click on Content",
- waitFor: "a[href='#snippet_content']",
- element: "a[href='#snippet_content']",
- },
- {
- title: "Drag and drop a newsletter snippet",
- waitFor: ".oe_snippet:contains('Newsletter'):visible",
- snippet: ".oe_snippet:contains('Newsletter')",
- },
- {
- title: "Let the default mailing list",
- waitFor: ".modal button:contains('Continue'):visible",
- element: ".modal button:contains('Continue'):visible",
- },
- {
- title: "Save changes",
- waitNot: ".modal:visible",
- element: "button[data-action=save]",
- },
- {
- title: "Subscribe Administrator",
- waitFor: "button[data-action=edit]:visible, \
- .js_subscribe_btn:visible",
- element: ".js_subscribe_btn",
- },
- {
- title: "Open user menu",
- waitFor: ".js_subscribe .alert-success:visible",
- element: "#top_menu span:contains('Administrator')",
- },
- {
- title: "Log out",
- waitFor: ".js_usermenu a:contains('Logout'):visible",
- element: ".js_usermenu a:contains('Logout'):visible",
- },
- {
- title: "Try to subscribe without data",
- waitFor: "#top_menu a[href='/web/login']:visible, \
- .js_subscribe_btn:visible",
- element: ".js_subscribe_btn",
- },
- {
- title: "Enter a name",
- waitFor: ".js_subscribe.has-error",
- element: ".js_subscribe_name",
- sampleText: "Visitor",
- },
- {
- title: "Try to subscribe without email",
- element: ".js_subscribe_btn",
- },
- {
- title: "Remove the name",
- waitFor: ".js_subscribe.has-error",
- element: ".js_subscribe_name",
- sampleText: "",
- },
- {
- title: "Enter an email",
- element: ".js_subscribe_email",
- sampleText: "example@example.com",
- },
- {
- title: "Try to subscribe without name",
- element: ".js_subscribe_btn",
- },
- {
- title: "Enter the name again",
- waitFor: ".js_subscribe.has-error",
- element: ".js_subscribe_name",
- sampleText: "Visitor",
- },
- {
- title: "Enter a wrong email",
- element: ".js_subscribe_email",
- sampleText: "bad email",
- },
- {
- title: "Try to subscribe with a bad email",
- element: ".js_subscribe_btn",
- },
- {
- title: "Enter the good email",
- waitFor: ".js_subscribe.has-error",
- element: ".js_subscribe_email",
- sampleText: "example@example.com",
- },
- {
- title: "Try to subscribe with good information",
- element: ".js_subscribe_btn",
- },
- // Expect this test to work in v9 when uncommenting this
- // {
- // title: "Subscription successful",
- // waitFor: ".js_subscribe:not(.has-error) \
- // .alert-success:visible",
- // },
- ],
- });
-})(jQuery);
diff --git a/website_mass_mailing_name/templates/assets.xml b/website_mass_mailing_name/templates/assets.xml
new file mode 100644
index 000000000..52c9f08d1
--- /dev/null
+++ b/website_mass_mailing_name/templates/assets.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/website_mass_mailing_name/views/snippets.xml b/website_mass_mailing_name/templates/snippets.xml
similarity index 53%
rename from website_mass_mailing_name/views/snippets.xml
rename to website_mass_mailing_name/templates/snippets.xml
index 7c0867441..7b1580ef8 100644
--- a/website_mass_mailing_name/views/snippets.xml
+++ b/website_mass_mailing_name/templates/snippets.xml
@@ -1,12 +1,11 @@
-
+
-
-
+
-
+
-
-
+
diff --git a/website_mass_mailing_name/tests/__init__.py b/website_mass_mailing_name/tests/__init__.py
index 16a388f09..211f990a4 100644
--- a/website_mass_mailing_name/tests/__init__.py
+++ b/website_mass_mailing_name/tests/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import test_ui
diff --git a/website_mass_mailing_name/tests/test_ui.py b/website_mass_mailing_name/tests/test_ui.py
index ea8f36cc7..f0ad21052 100644
--- a/website_mass_mailing_name/tests/test_ui.py
+++ b/website_mass_mailing_name/tests/test_ui.py
@@ -1,15 +1,25 @@
# -*- coding: utf-8 -*-
-# © 2016 Jairo Llopis
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+# Copyright 2016-2017 Jairo Llopis
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
-from openerp.tests.common import HttpCase
+from odoo.http import root
+from odoo.tests.common import HttpCase
class UICase(HttpCase):
def test_ui(self):
"""Test snippet behavior."""
+ tour = "odoo.__DEBUG__.services['web_tour.tour'].%s"
+ # Admin edits home page and adds subscription snippet
self.phantom_js(
"/",
- "openerp.Tour.run('mass_mailing_partner', 'test')",
- "openerp.Tour.tours.mass_mailing_partner",
- "admin")
+ tour % "run('mass_mailing_name_editor')",
+ tour % "tours.mass_mailing_name_editor.ready",
+ login="admin")
+ # Forced log out
+ root.session_store.delete(self.session)
+ # Public user uses subscription snippet
+ self.phantom_js(
+ "/",
+ tour % "run('mass_mailing_name_public')",
+ tour % "tours.mass_mailing_name_public.ready")
diff --git a/website_mass_mailing_name/views/assets.xml b/website_mass_mailing_name/views/assets.xml
deleted file mode 100644
index 0f4c2806f..000000000
--- a/website_mass_mailing_name/views/assets.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-