summaryrefslogtreecommitdiff
path: root/addons/website_mass_mailing/static/src/js/website_mass_mailing.js
AgeCommit message (Collapse)Author
2021-02-03[FIX] website_mass_mailing, *: add fix for missing google_recaptchaqsm-odoo
*: website In 14.0, the website_mass_mailing now uses ReCaptcha. The problem is that we forgot to add the related module as a dependency. It thus works on runbot because it is indirectly installed by other apps but the newsletter popup does not work anymore if only website_mass_mailing is installed. In master, we simply fixed the dependency. For 14.0, we use this workaround as a fix: if the recaptcha is not installed as not found in the list of services in odoo.__DEBUG__, then we make sure the newsletter popup work without it. In edit mode, we now also display a warning which allows to fix the issue directly (by installing recaptcha). closes odoo/odoo#65263 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-02[FIX] website_mass_mailing: use the correct action to obtain tokenBenoit Socias
Before this commit the "subscribe to newsletter" form was using the action of the website form to obtain its reCaptcha token, while the validation of the token was done on a specific subscribe action. After this commit the "subscribe to newsletter" form is using its own action that matches the one used for validation. Fixes https://github.com/odoo/odoo/issues/62504 closes odoo/odoo#62713 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-11-17[FIX] website_mass_mailing: do not translate codeMartin Trigaux
Only translate the literal strings
2020-10-05[FIX] website_mass_mailing: close popup after successful subscriptionKishan Gajjar
closes odoo/odoo#59150 X-original-commit: 548e45b9b7eea6c395c0e6959bec5b6418239ced Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-07-01[FIX] website_mass_mailing: fix input disappearing when duplicatingSamuel Degueldre
Previously, duplicating a block inside of the newsletter popup would cause the subscribe input and button to disappear. Actually, it disappears when you use most options of the left panel, because selecting an option refreshes the public widgets, which destroys them and starts them again, but for some reason, the subscribe widget's destroy method makes it d-none, but only removes that class if the subscribe input is not inside of a modal. This commit fixes that by not using d-none on the subscribe input group at all. We keep the d-none removals for databases which may have the button saved in a disabled state. task-2244780 closes odoo/odoo#53927 X-original-commit: 5562e7dbf5205c9b3ea0ef2d5283f3ccc5fbc30e Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-05[IMP] google_recaptcha, *: integrate recaptchaV3fja-odoo
* = base_setup, website_form, website_sale, website_crm, crm_iap_lead_website, website_hr_recruitment, website_mass_mailing Integrate reCaptchaV3 on website_form submit and website_mass_mailing subscription. You can now use ReCaptchaV3 to add reCaptcha verification in any module using google_recaptcha. Also added a better error management on the form with custom messages. task-2217980 closes odoo/odoo#48466 Related: odoo/enterprise#9649 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-04-23[FIX] website_mass_mailing: fix traceback when saving with popup openSamuel Degueldre
When the newsletter popup was introduced, the modal was for some reason marked with the o_editable class, which is normally used to let the editor know which elements in the page can be edited and saved in the database. Because of this, upon saving with the modal in the page (ie, if the modal is open when saving) it would try to destroy the editor associated with the modal, which doesn't exist, resulting in a traceback. This commit fixes that by removing the o_editable class from the modal, this doesn't actually prevent edition, because the modal is already inside of an editable segment of the page. task-2092593 closes odoo/odoo#50080 X-original-commit: 856d21cef530a9393bcebbf314a9316934ffb7c7 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-11-26[FIX] website_mass_mailing: restore newsletter subscribe notificationKishan Gajjar
closes odoo/odoo#40888 X-original-commit: fcbe95642850ccda049ef504fb41c45b45c7597a Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-10-17[FIX] website_mass_mailing: fixed the traceback on close modal dialogjpr-odoo
The issue here is, the modal for the newsletter is part of the editable area, and when we click on the 'close' button of that modal, it is destroyed but the 'summer note' tries to bind the events related to the button(because close is a button). fixed the traceback, to disable invoking 'summer note' events on click of the 'close' button on modal task-2075232 X-original-commit: 110ea837903f3e6c67c1d0e0081073edea8852d1
2019-06-25[IMP] website_mass_mailing, *: improve newsletter snippetsKishan Gajjar
* 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>
2019-03-06[REF] website_mass_mailing: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-26[REF] website, *: use public widgets instead of website animationsqsm-odoo
* website_blog, website_crm_partner_assign, website_event, website_event_track, website_form, website_forum, website_links, website_mail, website_mail_channel, website_mass_mailing, website_sale, website_sale_comparison, website_sale_delivery, website_sale_stock, website_sale_wishlist, website_slides, website_twitter While using the 'Animation' class of website instead of the frontend 'Widget' class leads to the same behaviors, this refactoring is done for two reasons: - Stop using the confusing 'Animation' name for non-animated behaviors - Instantiation of 'Widget' is slightly faster than 'Animation' Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] website, *: move and review the notion of edit modeqsm-odoo
* portal, sale, web, website_blog, website_crm_partner_assign, website_forum, website_event_track, website_links, website_mail, website_slides, website_mail_channel, website_mass_mailing, website_sale, website_sale_comparison, website_sale_delivery, website_sale_wishlist The `editableMode` option and its related options in public widget should only be part of website, this commit moves them there. This is also the occasion to implement something that is long overdue: stop creating 'animations' / public widgets in edit mode by default. Indeed, lots of 'animations' were defined by beginning with 'if not edit mode'. Now, if a public widget should be considered in edit mode, it must be defined explicitely through a property at *definition* of the widget. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2018-11-12[FIX] (website_)mass_mailing: restore popup designqsm-odoo
Compatibility: rebuilding a correct modal from user database content. Since the first version, the modal is saved in databases directly but has never used a correct structure. While it was working with BS3, it is not with BS4. This was breaking the design and prevented the modal to be able to close. task-1889341 closes odoo/odoo#28589
2018-08-10[IMP] mail, mass_mailing : apply blacklist, opt_out per mailing listDavid Beguin
Purpose ======= - Apply the blacklist implementation to Improve mailing subscription to be more compliant with the European GDPR law. Keep a list of people who does not want to receive promotional emails (or mass mailing in general) anymore. - Allows the recipient to update himself his mailing preferences Specifications =========== This commit is regrouping some main changes on mass mailing. Apply Blacklist for following models through blacklist.mixin : - crm.lead - res.partner - mail.mass_mailing.contact - mail.channel.partner - Opt_out per mailing list instead of per mailing contact. - Replace opt_out by blacklist in crm.lead + res.partner models - Added 'ignored' state for mass_mailing. Ignored = blacklisted, opted-out Ignored email are not included into final statistics to avoid confusion. - Unsubscribe(d) pages migrated from website_mass_mailing to mass_mailing module as thoses pages should work without having the website module installed Detailed implementation =================== Mass-mailing : - A blacklisted email is notified by the ban icon next to the email field. (at the left of the email field for display purpose) - Renaming the '_get_blacklist' method that was actually searching opt_out list into 'get_opt_out_list' - Opt out per mailing list : Add opt_out + related fields (for display and ergonomy reasons) on the relational model - Display relational model tree view instead of mass_mailing.contact tree view when clicking on mass_mailing_list in kanban view -> In order to be align between contact_nbr displayed in kanban tile and the content of the tree view -> mass_mailing contact is accesible via the user icon in this tree view - Remove custom filters 'filter_contact_subscription' and 'filter_contact_unsubscription' as opt_out is not on mass_mailing.contact model anymore - Add 'is_public' to mailing list The name of this mailing list can be seen (or not) by recipient in the unsubscription page If the mailing lists used in the mass mailing are not public, the user in only informed that he has been unsubscribed. If the mailing lists are public, the user is informed that he has been unsubscribed from the mailing lists and he has the choice to modify his subscription to all the public mailing list he is or was subscribed to. - Unsubscription Page : - mass_mailing_contact : Opt_out per mailing list, done by email and not by id, as multiple contact can have the same email The recipient can add/remove himself to/from the blacklist The recipient can send a feedback about why he unsubscribed - crm.lead + res.partner : Once the recipient unsubscribe, he is automatically blacklisted The recipient can 'Come back' and remove himself from the blacklist if he changes his mind - Show blacklist button parameter added in config : The idea is to enable/disable the fact that the recipient can add himself to the blacklist by showing or not the 'blacklist me' button Only applies for mass_mailing.contact. The recipient, once blacklisted, can always, no matter the value of this parameter, 'come back' and unblacklist himself crm.lead + res.partner : - Replace opt_out by blacklist in crm.lead + res.partner models. As when a res.partner or crm.lead unsubcribe, we assume that the recipient does not want to receive mass mailing anymore, at all, even if we adds him to a mailing list afterwards. He is then blacklisted to avoid this. With this behaviour, if a new lead is created with the same email address, he won't be able to receive mail in mass_mode. But he will still be able to receive '1 to 1' direct email. Task ID 33224 Closes #25966
2018-07-27[REF] *: BS4, adapt formsqsm-odoo
The 'form-horizontal' class have been removed; the '.form-group' elements must now use the 'row' class for an horizontal layout. The 'control-label' class was renamed to 'col-form-label'. The 'help-block' class was renamed to 'form-text'. The 'has-error' and 'has-success' classes have been removed and replaced by a new system using the :valid and :invalid pseudo-classes, when a parent has the 'was-validated' class. While this system is great, it is not straightforward to use it in Odoo. Fortunately, BS4 provides the 'is-valid' and 'is-invalid' classes as fallback. This commit replaces the 'has-error' and 'has-success' classes by 'o_has_error' and 'o_has_success' classes (for JS compatibility) and use the 'is-*' fallback classes. (The 'has-warning' class has no equivalent but was unused in Odoo anyway).
2018-07-27[REF] *: BS4, adapt input-group structureqsm-odoo
The input-group-addon class has been replaced by a combination of the input-group-text and the input-group-append/prepend classes. The input-group-btn class is replaced by the input-group-append/prepend classes.
2018-07-27[REF] *: BS4, adapt display classesqsm-odoo
The system completely changed. I also had to adapt classes to new screen breakpoints. hidden/hide -> d-none show -> d-block hidden-xs -> d-none d-md-(block/inline/...) hidden-sm -> d-md-none d-lg-(block/inline/...) hidden-md -> d-lg-none d-xl-(block/inline/...) hidden-lg -> d-xl-none visible-xs-* -> d-* d-md-none visible-sm-* -> d-none d-md-* d-lg-none visible-md-* -> d-none d-lg-* d-xl-none visible-lg-* -> d-none d-xl-* hidden-print -> d-print-none visible-print-* -> d-none d-print-* ... and all possible combination of those had to be handled too.
2017-08-16[REF] web_editor, website, *: complete refactoringqsm-odoo
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour, website_blog, website_crm_partner_assign, website_event, website_event_questions, website_form, website_forum, website_gengo, website_hr_recruitment, website_links, website_mail, website_mail_channel, website_mass_mailing, website_quote, website_sale, website_sale_options, website_slides, website_twitter This commit reviews the whole "JS side" of the web_editor and website apps. This is a first step to be able to improve them with new and better functionnalities; this commit is not supposed to change any visual behavior. The main goal was to achieve a structure similar to the backend one. Now, the frontend side also has a root widget (like the WebClient) and all other widgets are attached to it one way or another. This allows the benefits of using the 'trigger_up' functionnality for example. As RPC are now mainly done with the `this._rpc` functionnality (being possible thanks to the parent hierarchy), the frontend will also be possible to test thanks to QUnit in a future update (besides the "text" editor side which still requires a refactoring to be able to do that). --- Here are some of the changes: (-) conventions and documentation The code has been updated to follow JS conventions and a lot of code has been commented (around +2000 lines of comment). This also means that lots of functions have been renamed to use camelCase or simply to make their name understandable. See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines. (-) deprecated: web_editor.base The "web_editor.base" module has been split and does not force the modules which require it to wait for DOM ready anymore. This was indeed slowing loading times, but also prevented to use some modules in some contexts (see the LESS editor use in web_studio which is the subject of another task). Now the "editor context" can be got thanks to the "web_editor.context" JS module with its "get" function. The "web_editor.base" module should probably not be used anymore (see its code and recent updates). (-) new: web.dom_ready If a JS module should wait for the DOM to be ready to be executed, a new JS module has been created: "web.dom_ready". This should always be used in a module which only want to instantiate stuff. Do not extend (or worst, include) classes after DOM ready. (-) website.website The "website.website" module has been split. "website.website" does not return anything useful anymore, it just initialize some miscellaneous stuff, without waiting for the DOM to be ready. You might want to check "website.utils", "website.content.compatibility" or `WebsiteRoot`. Also `website.form` has been deleted (use `this._rpc`), so has been `website.error`. `website.prompt` will be removed in a future update to be replaced by `Dialog.prompt`. (-) widgets are great Many classes which were not widgets are now widgets. This allows them to use the 'events', the 'xmlDependencies' and the 'this._rpc' features for example. Here are some of the main ones: - Snippet options: these were classes with a `$el` for the menu element and `$target` for the customized element. This is still the case but following standard `Widget` structure (one exception: using `this.$(...)` searches in the `$target` as before this update). - Snippet animations: instead of class instances with a `$target` element which can be `start` and `stop`, these are now standard widgets which can be `start` and `destroy`. `this.$target` is an alias to `this.$el` for ease of compatibility. - Snippet editors: instead of class instances in charge of an editor overlay, these are now widgets. Each "child" snippet editor is properly attached as a "child", which allows editors to communicate and to be properly destroyed. (-) root widgets and website navbar The frontend is different of the backend. In the backend, the page has an empty <body/> element and all the components are instantiated from parent to children (i.e. the `WebClient` is instantiated and is in charge of instantiating the `ControlPanel`, etc). The frontend cannot work like that on page loadings as they are way more frequent than in the backend and we do not want them to flicker. A frontend page is loaded as a <body/> element which already contains the website navbar and its menus and the whole content page. JS code has to be "attached" to these existing elements. This is possible thanks to the `RootWidget` instances and the specialized `WebsiteRoot`, `IframeRoot` and `WebsiteNavbar` (see code for details). (-) lazy loading No more (or at least a lot less) XML/JS has to be loaded on page loading, thanks to the use of the `Widget.xmlDependencies` feature. XML which have to be lazy loaded is loaded only on related Widget instantiation if necessary, which allows to execute a lot of JS code before the DOM is ready and to start many widgets on DOM ready (not later). A visual benefit of this is clicking on the 'edit' button as soon as it is possible: before this commit, this was sometimes not doing anything as event handlers were not binded yet. Still a possible exception: loading the session and locales. This may be asynchronous stuff which is still required before widget instantiations but this will be the subject of another task. (-) deprecated code and code location More than reviewing code and organizing it, many apparent dead code was removed. More importantly, mislocated code was put in the right app. This is the case for snippet animations which is a concept for website apps but was defined in the web_editor app, or some translation concepts which were part of website but should have been part of web_editor. --- There are probably more things to say about this commit but I will let the comments speak for those.
2017-01-06[MERGE] forward port branch saas-11 up to 9073ecb6f59Christophe Simonis
2017-01-05[FIX] website_mass_mailing: typo in unsubscription confirmations and ↵Denis Ledoux
translatable There was an obvious typo in these confirmations, and they were not yet translatable. opw-703745
2016-09-30[FIX] website_mass_mailing: restore missing image files + snippets refqsm-odoo
Commit 9676ceec0260671cf86a27d02160f132378319a1 removed/replaced image files in mass_mailing module but two of them were still used by website_mass_mailing. This commits adds these two images in website_mass_mailing module and use a more standard convention to define associated snippets and link them in the snippet panel. Also lint JS files.
2015-11-24[FIX] website_mass_mailing: missing requiresDenis Ledoux
`mass_mailing.unsubscribe` depends on 1. `web.ajax`, as it uses `ajax.jsonRpc` 2. `web_editor.base`, to explicitely wait for all dependencies to be loaded, so the DOM can contain `o_unsubscribe_form` opw-654396
2015-09-24[FIX] website_mass_mailing: newsletter_popup edition: remove traceback on ↵Christophe Matthieu
edit and fix reset value
2015-07-22[IMP] web: module can be asynchronous loaded if it return a deferredChristophe Matthieu
Each module can return a deferred. In that case, the module is marked as loaded only when the deferred is resolved, and its value is equal to the resolved value. The module can be rejected (unloaded). This will be logged in the console as info. Remove if_dom_contains from the website, the modules return a rejected deferred if the DOM doesn't contains the seleted values.
2015-07-10[IMP] mass_mailing: remove depends to website. Create a website_mass_mailing ↵Christophe Matthieu
bridge to add subscribe snippet into website builder. Split website_links to have link_tracker to create short and trackable URLs, and website_links to have a website layout for link_tracker and add button to share page.