summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/snippets.editor.js
AgeCommit message (Collapse)Author
2017-08-16[MOV] web_editor, website: reorganize filesqsm-odoo
2017-08-04[REF] web, web_editor: expose 'cssFind' functionqsm-odoo
The web_editor app uses a 'cssFind' function but does not expose it. It makes sense to move it in the web app in the 'dom' utility function set.
2017-08-03[REF] web, *: create jQuery ':hasVisibility' and ':hasOpacity' selectorsqsm-odoo
* web_editor, web_tour jQuery has the built-in ':visible' selector. This is however not enough as this only checks if the element and its parents have a visible 'display' property. Ironically, if the element has the 'visibility' property set to 'hidden', it will be considered ':visible' by jQuery. This commit creates the ':hasVisibility' and ':hasOpacity' selectors which respectively check if the element and its parents have a visible 'visibility' property and a visible 'opacity' property.
2017-07-04[IMP] web_editor, website(_*): show all snippets even if module is not installedKishan Gajjar
* mail_channel, mass_mailing, twitter, event - t-install attribute holds the technical name of the module that needs to be install to use a particular snippet. - Disable the drag & drop feature for these dummy snippets. - Move some images to website module. - Installed snippets display at the top of the list. - Hide not-installed module snippets if user don't have rights to install module.
2017-06-21[IMP] web, *: reorganize our libraries' extensionsqsm-odoo
* web_editor, web_tour, website_event_track Before this commit, one JS file was responsible for all the library extensions and fixes. There were two main problems with this system: - The file was only available in the backend (as some extensions are made on backend-only libraries). - Some other modules were doing library customizations. This commit creates one file per library to regroup their associated customization and adds them in the right asset. These are placed in the web module and every other module should avoid doing customizations. This allows to have libraries consistency accross all modules and between the backend and the frontend.
2017-06-06[MERGE] forward port branch saas-16 up to 6f3eada2c3aChristophe Simonis
2017-06-03[MERGE] Forward-port 10.0 up to 76cd8d2558d2a1fc11681dbc4a134ba06fb698c0Olivier Dony
2017-06-02[FIX] web_editor, website: allow to detect indirect clonesDharmraj Jhala
When cloning a snippet section thanks to the editor, the associated snippet options' `on_clone` methods are called. Now these methods receive a new argument `options`. The option this commit introduces is the `isCurrent` one. It allows the method to know if the snippet section it is associated to is the one that was cloned or if it is a child of the one that was cloned. This is useful to solve a known bug when cloning elements which have bootstrap columns: - When one column is cloned we want it to lose its col-*-offset-* classes so that the offset is not duplicated (only the column). - When a container with column children is cloned we do not want these column' offsets to be removed (we want the whole cloned container to be the same).
2017-06-01[FIX] web_editor: hide customize menu when there are no optionsKishan Gajjar
2017-06-01[MERGE] Forward-port 10.0 up to 7e44444878760ca44cf1b22bf05d77e26c477cabOlivier Dony
2017-05-23[FIX] web_editor: properly match snippet options' DOMqsm-odoo
The snippet options are attached to `closest`, `all` and `is` functions to be able to find/check DOM they are associated to. Their behavior depend on the snippet option type: the search in the DOM is either done in the body, the editable parts, the editable children only, .... The problem is that when searching from a given DOM element, jQuery won't match the elements whose selector contains this given DOM element. Or in code terms, jQuery find function behavior is: `$('A').find('A B')` <=> `$('A A B')` (not `$('A B')`) This was indeed a problem on the job position apply form pages where the main editable element is the <form/> element itself. Indeed, the snippet options' selectors which began by 'form' were not able to match. Worse, the selector is used for a jQuery search for drag & drop and saving but not for initialization (where it is used as a `is` check on clicked elements). So, some DOM were able to be modified by options but not properly (re)configured before saving. opw-705902 opw-741305
2016-11-24[IMP] web_editor: allow lazy loadings in Animation instanceqsm-odoo
This commit comments the code of the Animation class and allows for lazy loading of resources before animations' start methods are called. This lazy loading can be performed in the willStart method (to use the same way as in the Widget class). This commits also removes the "stop" function of the module as it was not really useful. It was used to restart the animations (by immediatly calling start again after the stop call). Now the Animation class contains a restart method and the module "start" function automatically knows if it has to instanciate an animation or restart an existing one. Animation start should only be performed by instanciating an Animation (thanks to new) or by calling the restart method, to insure the willStart method is always called. Anyway, the best way to start animations is to let the system handle them, using the "selector" attributes in your Animation definitions as before. See in-code comments for details.
2016-11-08[MERGE] forward port branch saas-12 up to 6386037Christophe Simonis
2016-11-03[FIX] web_editor: do not delete empty .oe_structure elementqsm-odoo
If a snippet contains a .oe_structure element inside of it, it allows the user to drop other snippets in that location. The web_editor contains code which removes all empty parent of an element being deleted. This is done so that, for example, when the last col of a 3-col snippet is removed, the whole snippet is removed. However, there was an exception to this rule which was not considered, if one of these empty parent is an .oe_structure, it should not be removed. Note: the only snippet which does this is the parallax snippet.
2016-09-22[MERGE] forward port branch saas-12 up to b1b700aChristophe Simonis
2016-09-22[FIX] web_editor: prevent crash when deleting multiple snippets in one deletionqsm-odoo
Since saas-12, when deleting contents, parents are deleted too if they become empty (while it was not possible to delete contents in that case before). The problem here was that the history was recorded multiple times if one deletion made multiple snippets be deleted and this sometimes could crash. Now the history is recorded only on first deletion when the user ask for it.
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-16[FIX] web_editor: remove dead code and refactore show_blocks methodqsm-odoo
Following commit e634a52cace081edfce324f14228ddb419af0a31, the show_blocks method had to be refactored to remove the dead code and refactore the old one it contained.
2016-09-16[MERGE] forward port branch saas-12 up to 10cde43Christophe Simonis
2016-09-16[MERGE] forward port branch saas-11 up to 4c2b536Christophe Simonis
2016-09-15[FIX] web_editor: mark snippets which can't be dropped in the pageqsm-odoo
The system was lost with the editor refactoring which came with saas-10 and commit bf39884a5c95c3f69e94d65e10a4d4eda3726649. Indeed the show() method of the BuildingBlock class was removed as the widget is now always showed but the show_blocks() method it called was not removed (and thus was not called anymore). As a fix, the show_blocks method is now called again, on snippets initializations and each time a snippet is dropped or removed.
2016-09-15[FIX] website, web_editor: remove born-dead codeqsm-odoo
This code was introduced in 8.0 and has never been called.
2016-09-14[MERGE] forward port branch saas-12 up to 13765b5Christophe Simonis
2016-09-14[MERGE] forward port branch saas-11 up to 19b4f5eChristophe Simonis
2016-09-14[MERGE] forward port branch 9.0 up to 5be4086Christophe Simonis
2016-09-13[IMP] web_editor: select default text on click instead of mouseupqsm-odoo
When a snippet contains two p elements, they will both get the "o_default_snippet_text" when placed in the page. The individual p are then automatically selected on mouseup event. This induces strange behavior when trying to select the two paragraph together ; indeed only the paragraph on which you mouseup will be selected.
2016-09-13[FIX] web_editor: allow to drop a snippet where its movement beganqsm-odoo
Before this commit, if we dragged a snippet and dropped it where we began the drag, the snippet was removed.
2016-09-12[FIX] web_editor: properly call on_remove method of snippet optionsqsm-odoo
The snippet options can define an on_remove method which was supposed to be called when the snippet is removed. This was not the case since the method was written so that the options were removed before the on_remove method was called... (Un)fortunately, the on_remove callbacks were not doing any critical job in current implementation. In saas-13 however, some elements will rely on this.
2016-09-03[MERGE] forward port branch saas-12 up to 476cb5a0Christophe Simonis
2016-08-29[FIX] web_editor: hide header in customize dropdown when it has no contentqsm-odoo
In some snippets, the parent hierarchy has many elements. So, when selecting a deep child of one of those, the customize dropdown had many dropdown headers showing the parent hierarchy but without any option for many of them. Commit de0d9fd6661691488fcf4fd546d89042c0c99a4b already fixed the case where the dropdown only contains dropdown headers. This commit is an adaptation to hide these headers one by one.
2016-08-29[FIX] web_editor: change margin and resize handle icons on focusqsm-odoo
The feature was lost because of a programmation error (use of this in a non-binded function).
2016-08-19[IMP] *: replace snippet sections menu by a titleqsm-odoo
* web_editor, website, mass_mailing This menu allowed to scroll to the snippets sections by clicking on their corresponding icons. It was useless as the sections are not taking a lot of height. This also appeared buggy as clicking on the last icon highlighted only the second one as this second one was still the first section visible on the screen when the last section was fully visible. This also added fours buttons to the interface which contains already a lot of them. Now this is replaced by a title "Add blocks" which makes the editor cleaner and also improved the performance to enter the edit mode.
2016-08-19[FIX] web_editor: visibility of customize snippet option buttonqsm-odoo
Commit 57c09e8a8effe0e0ec8f96dd940218027789feaa was supposed to fix the problem but only made it worse in some cases. Since the new option parenting system, the customize button visibility should not be determined on creation as parent and own options are appended on snippet focus. Also, removing the dropdown header if it was alone was a bad idea as this is it which contains the information of options and all the options have not necessarily a <li/> tag in the dropdown. For example, the many2one option has no <li/> in the dropdown and is the only option of the field snippet. So with the previous commit, the dropdown header was removed as there is no <li/> in the dropdown other than this header. So as the header was removed, on snippet focus, there was no way to determine the many2one option exists, so its on_focus method was not called. Now, the dropdown-header is always kept. The visibility of customize button is determine on snippet focus.
2016-08-19[FIX] web_editor: properly handle many2one fieldsqsm-odoo
The many2one fields and their search bar were not working anymore since the loss of some functionnalities with commit b309f3ab543b5195eedc5b06ad08cfa81f43171a. * The dropdown which regroups a snippet options list is hidden if it does not contain any option. This was not the case anymore because it now always contains a dropdown title. This is fixed by simply removing this title if it is alone in the dropdown. * Snippet options attached to an element whose parent is not editable cannot be moved/deleted/duplicated as it is supposed to remain where it is. This is often the case for many2one fields and the feature was simply lost in the refactoring.
2016-08-12[FIX] web_editor: visibility of customize snippet option buttonqsm-odoo
Commit 57c09e8a8effe0e0ec8f96dd940218027789feaa was supposed to fix the problem but only made it worse in some cases. Since the new option parenting system, the customize button visibility should not be determined on creation as parent and own options are appended on snippet focus. Also, removing the dropdown header if it was alone was a bad idea as this is it which contains the information of options and all the options have not necessarily a <li/> tag in the dropdown. For example, the many2one option has no <li/> in the dropdown and is the only option of the field snippet. So with the previous commit, the dropdown header was removed as there is no <li/> in the dropdown other than this header. So as the header was removed, on snippet focus, there was no way to determine the many2one option exists, so its on_focus method was not called. Now, the dropdown-header is always kept. The visibility of customize button is determine on snippet focus.
2016-08-05[FIX] web_editor: properly handle many2one fieldsqsm-odoo
The many2one fields and their search bar were not working anymore since the loss of some functionnalities with commit b309f3ab543b5195eedc5b06ad08cfa81f43171a. * The dropdown which regroups a snippet options list is hidden if it does not contain any option. This was not the case anymore because it now always contains a dropdown title. This is fixed by simply removing this title if it is alone in the dropdown. * Snippet options attached to an element whose parent is not editable cannot be moved/deleted/duplicated as it is supposed to remain where it is. This is often the case for many2one fields and the feature was simply lost in the refactoring.
2016-07-19[FIX] web_editor: prevent adding snippets by mistakeqsm-odoo
* Start dragging after the mouse move of some distance * Cancel drop if the user drops a snippet in the snippet bar
2016-07-04[IMP] web_editor,website: snippet options (parent & deletion)qsm-odoo
* Always allow to delete a part (and delete parent if empty) * Show parent options (by displaying the snippet name if any, "column" for col-* and "Block" otherwise) * ...
2016-07-04[REF] web_editor: code refactoring and simplificationqsm-odoo
* Remove dead code + optimization * Use Dialog API from web module * Reorganize files * Correct buggy $() function for snippet option class * Add comments * Fix the snippet parent navigation : If a page contained a three level snippet structure (i.e A contains B contains C), when editing the following bug occured : If B or C was selected first, parenting buttons were correctly set. But if selecting A then C, clicking on the parent lead to going back on A instead of going on B. * Fix snippet thumbnail layout * Better isolate ui css from themes * MediaDialog image list : prevent displaying empty attachments * ...
2016-06-22[FIX] web_editor: `save` method of RTE is asyncSimon Lejeune
So if you include this method without returning the deferred, weird things happen and i lose a lot of time.
2016-06-14[IMP] base ir.qweb: compile template (and use ast) to improve rendering speedChristophe Matthieu
* The compiled templates are cached per user, lang, inherit context values * ir.ui.fields: attributes method return an dict, and record_to_html return only the content value of the field * all rendered text use build_text and all attributes use build_attribute * t-esc-options is removed and replace by format_value method * AssetsBundle receive the list files and remains
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-02-24[REF] website,web_editor: complete restylingstefanorigano
2015-10-29[FIX] web_editor: select default text of the snippet when click on the textChristophe Matthieu
2015-10-29[FIX] web_editor: keep the javascript reference to globalSelector object for ↵Christophe Matthieu
odoo javascript module related to #9284 opw-653061 opw-653167
2015-10-27[FIX] website, web_editor: missing returns in theme JSqsm-odoo
2015-09-01[FIX] web_editor: clean_for_save is not called for custom snippets because ↵Christophe Matthieu
all() not contains all html matched tags
2015-09-01[FIX] web_editor: drop near select children of editable nodesChristophe Matthieu
2015-08-31[MERGE] forward port of branch saas-6 up to 7faf72cChristophe Simonis
2015-08-26[FIX] web_editor: fixed typos introduced by 88c0ce0David Monjoie
It seems this.BuildingBlock was changed to this.buildingBlock by 8c559044a5e1be111dcb577ad7e5ab462c1002a0. Care should be taken when forward porting code using this.BuildingBlock.