diff options
| author | Kishan Gajjar <kig@odoo.com> | 2019-02-05 06:55:25 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-06-25 09:20:35 +0000 |
| commit | 34c4b3ad8a23988ecdd8112156ea13da518a2e90 (patch) | |
| tree | 201c2047661b6cf4f58771da45abba6f9d3857bb /addons/website_mass_mailing/models | |
| parent | 2ad49ec93e39ae5d59ccc17884408870e1c86c5e (diff) | |
[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) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
Diffstat (limited to 'addons/website_mass_mailing/models')
| -rw-r--r-- | addons/website_mass_mailing/models/__init__.py | 1 | ||||
| -rw-r--r-- | addons/website_mass_mailing/models/mass_mailing_list.py | 29 | ||||
| -rw-r--r-- | addons/website_mass_mailing/models/res_config_settings.py | 10 |
3 files changed, 16 insertions, 24 deletions
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 '<p>Thanks for subscribing!</p>' + + 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 """<div class="modal-header text-center"> - <h3 class="modal-title mt8">Odoo Presents</h3> -</div> -<div class="o_popup_message"> - <font>7</font> - <strong>Business Hacks</strong> - <span> to<br/>boost your marketing</span> -</div> -<p class="o_message_paragraph">Join our Marketing newsletter and get <strong>this white paper instantly</strong></p>""" - - 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") |
