From 34c4b3ad8a23988ecdd8112156ea13da518a2e90 Mon Sep 17 00:00:00 2001 From: Kishan Gajjar Date: Tue, 5 Feb 2019 06:55:25 +0000 Subject: [IMP] website_mass_mailing, *: improve newsletter snippets * website, mass_mailing, web_editor This commit adds various improvements in newsletter snippets as follow: - Improves UI for newsletter popup. - We only had one popup for all websites. Now, we can have a different popup for each website. - The popup was not appearing on mobile/tablet devices. Now, in mobile/tablet devices, the popup appears automatically after 5secs. - Added the ability to customize the whole editor popup like any editable area (background colors, etc). - User needed to enable popup snippet from the settings. We removed that setting so now popup snippet will always be available. - Added new snippet "Newsletter block". - Display notification after successful subscription the same way for all newsletter snippets. Closes https://github.com/odoo/odoo/pull/29353 task-1903256 closes odoo/odoo#29353 Signed-off-by: Quentin Smetz (qsm) Co-authored-by: qsm-odoo --- addons/website_mass_mailing/models/__init__.py | 1 - .../models/mass_mailing_list.py | 29 ++++++++++++---------- .../models/res_config_settings.py | 10 -------- 3 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 addons/website_mass_mailing/models/res_config_settings.py (limited to 'addons/website_mass_mailing/models') diff --git a/addons/website_mass_mailing/models/__init__.py b/addons/website_mass_mailing/models/__init__.py index c9e39e466ca..ecf18af5dd6 100644 --- a/addons/website_mass_mailing/models/__init__.py +++ b/addons/website_mass_mailing/models/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import res_config_settings from . import mass_mailing_list diff --git a/addons/website_mass_mailing/models/mass_mailing_list.py b/addons/website_mass_mailing/models/mass_mailing_list.py index 3e49bcba59b..a10344ecddb 100644 --- a/addons/website_mass_mailing/models/mass_mailing_list.py +++ b/addons/website_mass_mailing/models/mass_mailing_list.py @@ -7,17 +7,20 @@ from odoo import fields, models class MassMailingList(models.Model): _inherit = 'mail.mass_mailing.list' + def _default_toast_content(self): + return '

Thanks for subscribing!

' + + website_popup_ids = fields.One2many('website.mass_mailing.popup', 'mailing_list_id', string="Website Popups") + toast_content = fields.Html(default=_default_toast_content, translate=True) + + +class MassMailingPopup(models.Model): + _name = 'website.mass_mailing.popup' + _description = "Mailing list popup" + def _default_popup_content(self): - return """ -
- 7 - Business Hacks - to
boost your marketing
-
-

Join our Marketing newsletter and get this white paper instantly

""" - - popup_content = fields.Html(string="Website Popup Content", translate=True, sanitize_attributes=False, - default=_default_popup_content) - popup_redirect_url = fields.Char(string="Website Popup Redirect URL", default='/') + return self.env['ir.ui.view'].render_template('website_mass_mailing.s_newsletter_block') + + mailing_list_id = fields.Many2one('mail.mass_mailing.list') + website_id = fields.Many2one('website') + popup_content = fields.Html(string="Website Popup Content", default=_default_popup_content, translate=True, sanitize=False) diff --git a/addons/website_mass_mailing/models/res_config_settings.py b/addons/website_mass_mailing/models/res_config_settings.py deleted file mode 100644 index b39a9eb10b1..00000000000 --- a/addons/website_mass_mailing/models/res_config_settings.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import fields, models - - -class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' - - group_website_popup_on_exit = fields.Boolean(string="Website Popup", implied_group="website_mass_mailing.group_website_popup_on_exit") -- cgit v1.2.3