summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/static/src/js/mass_mailing_editor.js
AgeCommit message (Collapse)Author
2019-01-17[REF] web_editor,*: Move and rename files to prepare refactoringChristophe Matthieu
The refactoring of the wysiwyg editor and 'html' field allows us to move some of the code that was in web_editor but only used in website or in mass_mailing. Some parts are still in web_editor but will be moved at a later time.
2018-08-13[IMP] mass_mailing: focus on content when user selects the plaintext themeParth Gajjar
2018-08-13[IMP] mass_mailing: removed font-family from plain textAnshuman Sharma
Purpose behind this commit is to remove font-family from all elements in plaintext theme. So mail receiver will see this mail in default system font. This is inspired by new Gmail and suggested by FP As we want to show system's default font in the mail sent with the basic theme. And so we remove font-family from basic theme while saving. But by doing so in readonly mode is not getting proper font in odoo as we don't having any assets in readonly mail editor. So we added stylesheet just for display purpose.
2018-07-27[REF] *: BS4, adapt dropdowns and caretsqsm-odoo
- The dropdown structure was simplified, allowing to get rid of the 3-levels structure induced by <ul/> elements and dropdowns can now contain anything. The class 'dropdown-item' is now mandatory for each dropdown clickable element. The class 'dropdown-item-text' can be used to add same padding and style but without making the element have a clickable look. - Dividers now use the class 'dropdown-divider' - The way dropdowns are opened and hidden also changed (before the 'open' class was added on the `.dropdown-menu` parent, now the 'show' class is added on both the `.dropdown-menu` parent and the `.dropdown-menu` itself). - JS-wise, no click event handlers can be put on `.dropdown-toggle` elements anymore (instead, use handlers for dropdown events). - Carets are automatically put on `.dropdown-toggle` elements, so this commit replaces the `.caret` elements with this. This feature was possible to disable but would prevent us from adding a caret with scss. Also, this simplifies the DOM. The 'o-no-caret' class was also introduced to allow using the 'dropdown-toggle' class on non-caret elements. - Also adapt the scss to use $caret-width instead of $caret-width-base
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.
2018-02-15[MERGE] forward port branch saas-11.1 up to a277b585072Christophe Simonis
2018-02-14[MERGE] forward port branch saas-16 up to 77927559465Christophe Simonis
2018-02-14[MERGE] forward port branch saas-14 up to 9d0de611147Christophe Simonis
2018-02-13[FIX] mass_mailing, *: duplicating two-columns snippetsqsm-odoo
* web_editor, website This commit fixes a bug with table duplication in mailing template: - Click on a snippet with two columns - Duplicate it -> the snippet is duplicated but the two columns are transformed in two rows. This was because there is an implemented behavior for column duplication: if we duplicate a column which was alone on its row, we duplicate the row instead. This code should however be triggered when duplicating the column alone to be working, not the snippet that contains it. Note: this required a backport of a33ec972abf1cadbae2a6a04f759617c82f2a95e which was fixing a non-critical "bug" for 11.0. This non-critical "bug" is therefor fixed here too. opw-807105
2018-02-05[FIX] mass_mailing: complete commit 66aefb1723c336cc1c61fb32926ed926ba9e29e4qsm-odoo
- There should not be margins around lists - There should not be editor overlay on the whole content
2018-02-01[MERGE] forward port branch saas-11.1 up to 7e469eb77aaChristophe Simonis
2018-01-26[FIX] mass_mailing: lower the risk of messing with the mail wrapperqsm-odoo
Mail content is wrapped in a table to properly allow centering the layout in all mail clients. The problem was that this table was able to be customized by the editor while it should not.
2018-01-08[IMP] web_editor, *: change height/margin system to padding systemqsm-odoo
* web, website, mass_mailing Before this commit, the editor allowed defining the margin of some elements and the height of some elements. There were three main problems with this system: 1) When an user dragged the arrow, he often expected to change the size of the element while he was in fact changing the margin 2) When changing the margin, you increase the space between two elements but with a white space (while most users want a space with the same color of the block they are resizing = padding) 3) When changing the height, the user was able to hide snippet parts and the height was not consistent accross screen sizes Now, the only thing you can edit is padding. There is only one arrow for each direction, which allows increasing spacing and consistent dimension at the same time. The only feature that is lost with this change is the ability to control vertical alignement of colored columns. This is not a problem as colored columns are rare in our current snippets and there still have the possibility to add margin classes by hand if necessary (there are also plans to control vertical alignement another way). Note: margin classes are kept for compatibility.
2017-11-16[MERGE] forward port branch saas-16 up to 745d00362abChristophe Simonis
2017-11-13[MERGE] forward port branch saas-14 up to abfd6621091Christophe Simonis
2017-11-13[FIX] mass_mailing: switch to theme images at 1st theme selectionJairo Llopis
Without this patch, default images for themes are not used automatically in themes' templates when one is chosen for the 1st time. This was not inducing any bug in standard 10.0 but with custom-made templates, you had to put the correct themes images in the defined template. This allows to just `t-call` snippets instead of having to fully hardcode them in theme templates.
2017-10-20[MERGE] forward port branch saas-16 up to dc2a6c6cd2aChristophe Simonis
2017-10-17[MERGE] forward port branch saas-14 up to fbdda5437a8Christophe Simonis
2017-10-17[MERGE] forward port branch 9.0 up to d5c0cae60b5Christophe Simonis
2017-10-17[FIX] mass_mailing: background snippet option outlook compatible (#20137)Lucas Perais
Origin of the fix: the snippet background image did not change the background image. This was due to commit a14f89c which wraps the snippet's content into a table for outlook display compliance This issue is fixed here, with the modificaion of the background snippet option. OPW 772442
2017-09-29[FIX] mass_mailing: never ending resizeNicolas Lempereur
In odoo@2972976 a mouseup that unbound resizing in mass mailing was missing so once resizing there was no way to stop resizing.
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-06-16[IMP] mass_mailing: allow to don't wrap a template in a tableJeremy Kersten
In some case we don't want to wrap the content to be centered. Now, you can add a data-nowrap when you define the theme params to don't wrap it in a table automatically Eg: <div data-name="blank" data-img="/xxx" >> data-nowrap="1" data-images-info='{...}'>
2017-05-15[FIX] mass_mailing: increase email clients compatibilityqsm-odoo
Creating a mail template which is complex and compatible with all mail clients is a very difficult task as each mail client supports a different subset of basic CSS rules. This commit fixes 3 problems which were occuring in outlook and/or thunderbird but not in gmail: - Main layout horizontal overflow -> change 24px horizontal padding of main layout to 3% and set the width to 94% (so that the sum is 100%) - Fixed 600px content was full width instead -> Change the .o_mail_wrapper to be a <table> element instead of a <div> element. The table is full-width and contains one row of 3 cells: an empty left one, a fixed 600px-width center one and an empty right one. This allows to have the same layout as before but without using the unsupported max-width css rule. - Texts were not using the right color and font-size -> <p> elements were not properly inheriting the color and font-size properties, so force the style on <p> elements. opw-743156
2017-03-21[FIX] mass_mailing: do not remove image with linkJairo Llopis
If you followed these steps, Chrome deleted the link and image: 1. Create a new mass mailing, fill the subject. 2. Drag & drop any snippet with pictograms. 3. Change a pictogram for an image. 4. Add a link to the image. 5. Save the record. This happen in chrome if the image was for example floating in the link, so this change check if an element is a contained element is visible before removing it. This issue doesn't happen with [jQuery 3][1] and may be linked to [this][2]. [1]: http://api.jquery.com/visible-selector/ [2]: http://stackoverflow.com/a/8337382/1468388 closes #15623 opw-710237 note: this is only needed in 9.0 and saas-11 because this features doesn't seem present in version 10.0
2017-01-02[MERGE] forward port branch saas-11 up to b844d938890Christophe Simonis
2017-01-02[MERGE] forward port branch 9.0 up to 3805eb620aaChristophe Simonis
2016-12-23[FIX] mass_mailing: crash with Firefox with the breadcrumbDenis Ledoux
- When opening a mass mailing - Editing it and making a change (e.g. add a block) - Click on the breadcrumb - Click "OK" on the warning popup telling your changes will be discarded - Choose another mass mailing A crash occured. This is basically the same case than in the revision 7bf80d22ddb443e635442f1a633b75a51f2a0d85 but for Firefox, for which `window` is still there `!window` returns False but is `closed` opw-702211
2016-11-16[FIX] mass_mailing: initialize theme images on re-editionqsm-odoo
The mass_mailing editor has a feature which switches the images of the content and/or the droppable snippets according to the theme. Unfortunately, this images were only initialized on theme choice and not when entering in edit mode. So when reediting an already edited mass mailing (or when duplicating one), the theme images were not initialized.
2016-09-30[FIX] mass_mailing, web_editor: set up correct iframe communicationqsm-odoo
Previous commit tried to handle iframe assets in a more standard way but instead broke the order followed to install iframe communication. While waiting for a more clean way to handle iframe assets and communication, revert to old set up.
2016-09-30[IMP] mass_mailing, web_editor: propose installation of mass_mailing_themesqsm-odoo
When an user starts a new mail template, he is now proposed to upgrade to enterprise to install mass_mailing_themes.
2016-09-30[IMP] mass_mailing: only keep one theme in community moduleqsm-odoo
Only keep default theme in community module and replace old enterprise ones with new ones.
2016-09-23[FIX] mass_mailing: properly switch to right theme imagesqsm-odoo
The default image inside undropped snippet had to be switched everytime a theme is selected, even on first theme choice as the switch_theme method only switch images of snippet already dropped in the page.
2016-09-23[FIX] mass_mailing: properly manage td/th elementsqsm-odoo
Refactore width-x snippet option and create another option to handle cloning and removing td elements properly. * on_focus: the handle to resize are now hidden when the td/th is alone on its row * on_clone: when cloning a td element which is alone on its row, it is instead cloned in a new row. If not, empty td are added on the whole column to maintain table integrity. * on_remove: handle removing td in complex table
2016-09-21[FIX] mass_mailing, *: allow to auto select default text of templatesqsm-odoo
* + web_editor The feature was only activated in the web_editor in snippet contents (before they are dropped in the page). Now, on first theme selection, the feature is activated in the template content.
2016-09-20[IMP] mass_mailing: automatically include the o_mail_wrapper elementqsm-odoo
2016-09-20[IMP] mass_mailing, web_editor: improve themes/snippets/templatesstefanorigano
2016-09-20[IMP] mass_mailing: add default layout for mail themesqsm-odoo
When there is no content in the mail, the user is now forced to choose a theme. Once the choice is made, the theme introduces default content (series of snippet to simplify user edition). The default images are also changed when the theme is switched. To do that, JS code was implemented so that on theme switch, all the images are changed to check for images in the static theme folder or use a theme related xml_id. + Refactore theme data management.
2016-09-05[REF] mass_mailing: convert templates to themes and clean codeqsm-odoo
* Remove mass mailing template switching system (lemon, airmail, ...) and replace it with a theme selector which only toggle a different class on the body. * Lint JS files. * Change the way the editor is overridden by mass_mailing in a more odoo way (put the JS in assets and check on runtime if it must be applied. + fix editor style + remove useless code + remove odoo template
2016-09-05[REF] mass_mailing: change/add snippets/themes layout/designCsaba Fazekas
* Airmail/Lemon/Tech template/Odoo template * Add bg color option * Clean snippets
2016-09-05[REF] mass_mailing: change theme/template selection and add new snippetsChristophe Matthieu
* remove theme/template selection screen for mass_mailing * allow to use different layout on edition * add new snippets
2016-06-23Revert "[FIX] web_editor: test jinja content to load editor in codeview"Christophe Matthieu
This reverts commit f38f8930f0436a40f675fa1d054a9d46f550d440. Revert for internal choice. Odoo want to use qweb in template and remove jinja support on next version. If users want to use jinja they can change the view to use text widget instead of html widget.
2016-06-22[FIX] web_editor: test jinja content to load editor in codeviewChristophe Matthieu
The preview change the content because the browser try to fix the dom. If a user use jinja and activate the preview, the jinja code is (re)moved by the browser and broke the template.
2016-02-24[REF] web_editor,website,mass_mailing: JS/XML updateqsm-odoo
* Adapt DOM selectors * Refactore dialog XMLs to have odoo styling * New editor options (background-position, ...) * Various improvements
2016-01-15[FIX] mass_mailing: set theme without changing template contentDenis Ledoux
When opening a mail template, and choosing a theme, then directly saving, without changing anything within the template, the chosen template wasn't saved in the template. Therefore, when re-editing the same template, the theme selection re-appeared, while you had already chosen in the previous steps. opw-665537
2015-11-18[FIX] mass_mailing: fix tooltip for "Select a theme"Nicolas Lempereur
The popover in the mass mailing are not enabled, also the whole CSS of the website is not used (particularly, the popover CSS is not included). This commit replace the popover by a tooltip and enable tooltip on [data-toggle="tooltip"] elements. second half of: opw-656693
2015-10-02[FIX] web_editor, mass_mailing: summernote oversight and videoNicolas Lempereur
* some oversight when updating summernote with d33086c, * fix style when replacing image with video
2015-09-01[FIX] mass_mailing: remove the on_change_model_and_list empty message from ↵Christophe Matthieu
onchange
2015-09-01[FIX] mass_mailing: window can be undefinedChristophe Matthieu
If the user cancel a mass_mailing creating and click on create again, _downup is called but the iframe don't exist
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.