summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/libs
AgeCommit message (Collapse)Author
2021-04-21[FIX] web: find scrollingElement despite roundingNicolas Lempereur
In mass mailing edition, in some configuration of: - being in a modal or not - size of window - zoom level we might get an error when getting the scrolling element. For example when editing a mass mailing, if I set my viewport to 595 pixels height and have a 90% zoom, the editor is broken. This is because in SnippetsMenu.starts `$().getScrollingElement()` doesn't find an element that has the height of body. In my use case body height is 329.111 pixels, and scroll height is 328 pixels. Testing different zoom level and viewport height, the maximum difference I was able to get was 1.25 so this commit increase to 1.5 the maxmimum difference. opw-2455727 opw-2469174 closes odoo/odoo#69592 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-16[FIX] web: properly find the scrolling element of zoomed pagesqsm-odoo
To find the main element which scrolls in the page, we rely on its height being as tall as the body one. The code which checks that was making a comparison between a rounded value and floating value without care of the rounding errors that might induce, especially on zoomed pages. Fixes https://github.com/odoo/odoo/issues/63306 closes odoo/odoo#67961 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-15[FIX] website_forum, *: refit the forum biography popoverOussama MESSAOUDI
*: web task-2276974 closes odoo/odoo#66049 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-13[FIX] web_editor, *: ease understanding of snippet drag, not clickqsm-odoo
*: web, website Make the empty oe_structure messages "wizz" when the user clicks on a snippet to drag instead of dragging it. Part of https://github.com/odoo/odoo/pull/60837 Related to task-2363616 closes odoo/odoo#60837 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-24[FIX] website, *: review modal behaviors with right-panelizationqsm-odoo
*: web, web_editor Since the right-panelization made with [1], the modals were not compensating the body scrollbar when opened anymore and the backdrop was misplaced. This commit fixes the problems generically, to support modals with non-body scrolling. [1]: https://github.com/odoo/odoo/pull/57975 closes odoo/odoo#58414 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-22[IMP] website, *: move page scrollbar to #wrapwrapqsm-odoo
*: web, web_editor, portal, account, website_blog, website_forum This is probably not ideal to move the scrolling behavior out of the html element but this will be needed for the editor to not have a double scrollbar on the right. This is actually also useful for the scrollbar to appear under the purple odoo menu instead of its right. This commit, if to be reverted in the future, however contains many improvements to make the transition easier that should be kept: jQuery and Odoo functions to be able to scrollTo a specific element, get the top scrollable element, check if an element is scrollable, etc. Also, some magic was done: if some code tries to scroll to a specific scroll position via jQuery's scrollTop or animate functions on the html/body element, those will still work as intended (obviously, using the new utils to do that is however recommended). This commit also reviews our scroll behaviors to make them more robust and share the code. Part of https://github.com/odoo/odoo/pull/57975 task-2344227
2020-08-11[IMP] base,web: add year scale to calendarMichael Mattiello (mcm)
This commit adds a new year scale to the calendar view. It comes with a new view in the calendar, this view displays a 4x3 grid which cells are month views. Task: 2193921
2020-07-10[FIX] web: fix zoomodoo attachToTarget/dashboard compatiblejvm-odoo
Issue - Install Employees & Dashboard - Add employees to kanban - Dashboard - Hover an employee picture There is only the picture visible on the page, the remaining space is white. Cause I found several issues. 1. The pictures are not shown on hover in employees But they are on dashboard. 2. $attach = all `.content` and on dashboard there is 2 `.content` so the flyout is append 2 times 3. The move method is trigerred on hover too, it hides the flyout if we are not in it. But with attachToTarget we are not in it so it's hidden all time. 4. If everything above is solved, the image is shown but not at the correct position because the flyout base position is not top 0, left 0 Solution 1. Reduce the minimum required size to 128px 2. use closest instead of parents 3. Don't hide if we have the option attachToTarget 4. Calculate the flyout offset and replace it correctly and set it to position fixed to handle scrolling OPW-2291493 closes odoo/odoo#54333 X-original-commit: 2c6d692ee40c97d2ae63da64db7623702948407e Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-07-08[FIX] web: fix zoomodoo flyout widthjvm-odoo
Issue - Install eCommerce - Modify a product image with one which has more than 1024px width/height to enable zoom (I used: https://bit.ly/2VETQZS) - Go on the website preview & hover the image Depending on the screen size, a part of the flyout is hidden because of overflow-x if you want to see it, you should scroll right width right arrow key. Cause The flyout has 100% width and is put right (position absolute, left: 100%) Solution To avoid this error on all screen size, the solution is to compute the max-width of the flyout depending on the available space on the right. OPW-2283648 closes odoo/odoo#54222 X-original-commit: c89b4c25ed92542f6fd0279cf3a9e4ef1bac9fa5 Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-02-27[IMP] web: better positionning of daterangepickerParth Choksi
Before this commit, the daterangepicker always opened below the input, even when there was not enough space to display it. Moreover, when the user scrolled while the picker was opened, it wasn't stucked to the input, so the picker was displayed at a random position after the scroll. With this commit, we compute the available space above the picker when opening it, and if there is enough space, we display it above, otherwise, we display it below. Moreover, we automatically close the picker when the user scrolls. task-2117229 closes odoo/odoo#42161 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-03-26[FIX] web: Fix the bug while zoom on imagehpr-odoo
Currently when zoom slowly from right to left on employee image it will not zoom the image. currently to hide the zoom image we used target.width() and the method width gives the width of the selected element (excluding padding, border and margin) so due to border excluded it will hide the zooming image. Aslo the offsetHeight property returns the viewable height of an element in pixels, including padding, border and scrollbar, but not the margin. The reason why the 'viewable' word is specified, is because if the element's content is taller than the actual height of the element, this property will only return the height that is visible. so instead of method width we used method outerWidth which gives width of the selected element (including padding and border, excluding margin). closes odoo/odoo#46619 Co-authered-by: Mahendra Barad <mba@odoo.com> Task: 2199218 Closes: #46619 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-05[FIX] web: eventBusDispatchToDOM set to true in pdf.jsfda-odoo
In the module account_invoice_extract, the the code need to react to the 'pagerendered' event triggered by pdf.js. However in recent version of pdf.js, event are not visible outside of the library, except if the 'eventBusDispatchToDOM' has been set to true. We tried to set this option from outside of the library but without success, as our pdf viewer is in an iframe. There is no state of the iframe in which we can add an event listener to set the option. pdf.js has an event used to signal when we can set settings, called 'webviewerloaded'. This event is triggered in an EventListener attached to the 'DOMContentLoaded' event. So, to list options we had, we could: a) add an eventListener to the iframe document or window to react to 'webviewerloaded'. This doesn't work as document and windows are not the definitive ones and won't catche the event later. b) add an eventListener to the iframe to react to 'DOMContentLoaded', which doens't work too as our listener will be called after the pdf.js one. Finally the option was choosed to modify the default value of this option directly in pdf.js as no hook worked in the 'account_invoice_extract' module. closes odoo/odoo#47024 X-original-commit: 42e6f56c887c3175c76f0f84b8581e288ebc7daf Related: odoo/enterprise#9044 Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
2020-02-12[FIX] web: Avoid open too fast zoomjbm-odoo
Picture of employees are maximazed directly which is annoying when you move the mouse in kanban view. Add the ability to put a waiting time before opening the zoom in option of the field in the view (default value is 0). closes odoo/odoo#45229 Taskid: 2191289 X-original-commit: a264b17d8fe18464df439d896ecb7dea106caa5a Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
2019-12-06[REF] web_editor: review user value widgets scssqsm-odoo
Part of https://github.com/odoo/odoo/pull/41402
2019-10-01[FIX] web, *: review Bootstrap tooltip/popover sanitizationqsm-odoo
* website_sale_comparison The Bootstrap sanitization introduced with BS 4.3.1 was disabled with https://github.com/odoo/odoo/commit/36caf5fc16b5a95a0bf37f08f0caf974683b2df6 https://github.com/odoo/odoo/commit/ee94decd30c4514d5bc410b1652bc6464bb600aa This commit re-enables it by default but extends it to accept more common tag names like tables and buttons. If a specific tooltip or popover must accept custom tags or attributes (such as data-* attributes required by a related JS), they must be supplied through the whitelist BS parameter explicitely (see example with website_sale_comparison in this commit). Note: data-oe-* attributes are also whiteListed by default. We cannot disable sanitization because bootstrap uses tooltip/popover DOM attributes in an "unsafe" way. closes odoo/odoo#37631 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-07-18[IMP] web: add new date range picker field widgetJigar Patel
Adds a new widget to support start & end date or datetime. closes odoo/odoo#33266 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-26[IMP] base: Add option on image widget to enable zoomKevin Baptiste
Purpose ======= As the employee picture on a form view is often too small, it should be possible to zoom on it like for products in eCommerce. Specification ============= Added new bool options on FieldBinaryImage: `zoom` and `background`. `zoom` will call zoomOdoo.js and display a popup with the zoomed out image. `background` is used to either display the image as a div element with a background-url (to be used e.g. in a kanban view) or as a standard img element. closes odoo/odoo#33839 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-09[FIX] web: disable sanitization for bootstrap popoverPriyanka Kakadiya
Since saas-11.3: Bootstrap sanitizer sanitizes html and removes attributes which are not defined in whitelist, here is the documentation link: https://getbootstrap.com/docs/4.3/getting-started/javascript/#sanitizer Restore sanitize=false for bootstrap popover. A scenario where the sanitizer will break a popover: compare 2 products and open Compare popover and try to delete a comparison item from the popover -> item can not be deleted because data-product_product_id has been removed by sanitizer and so the item can not be deleted because deletion logic depends on data-product_product_id. Reference commit: https://github.com/odoo/odoo/commit/36caf5fc16b5a95a0bf37f08f0caf974683b2df6 Closes https://github.com/odoo/odoo/pull/31961 task-1950702
2019-04-01[IMP] web: remove nvd3 libraryMathieu Duckerts-Antoine
It has been decided to use Chart.js instead of nvd3 to render charts. Now that nvd3 is no more in use, we remove it. Task ID: 1946138
2019-02-27[FIX] web: disable (new) sanitization of tooltipsqsm-odoo
Bootstrap 4.3.1 introduced tooltip sanitization. Odoo should normally use tooltips for secure content anyway, so this commit disables this sanitization. A proper analyse of our tooltip should however be done to know if sanitizing is needed (it can also be enabled case by case).
2018-09-20[IMP] web: add a fix on underscore to support cancellableThrottleVincent Schippefilt
2018-08-22[FIX] web: restore odooBounce once againqsm-odoo
The odooBounce (previously openerpBounce) function has been fixed many times over the years. Each time breaking the layout a different way after the backend was redesigned. It is time for the proper fix: no more JS animation relying on jQuery, instead: a CSS animation. Let's try a bouncing outline instead of a bouncing button for a change.
2018-08-07[FIX] web: BS4, fix tooltip flickering issuesSiddarth Gajjar
Closes #26186
2018-07-27[REF] web, *: BS4, adapt use of tooltip/popover.jsqsm-odoo
2018-07-13[IMP] web: replace iframe-based get_file by XHRXavier Morel
The error handling in get_file has always been somewhat problematic (sarcasm ho!). Pending PR #24854 attempts to add special handling for gateway timeout aside from its base stuff, and that's really quite terrible due to get_file's limitation of only being able to read the content of the document loaded in the iframe (no proper access to status codes & al). That was the occasion to look up modern API and see if we could do file downloads in JS without iframe crap. Turns out we can: xhr2 is well supported so we can POST, get a blob back, and create a "local download" for that in-memory blob using either a[download] (most browsers) or msSaveBlob (IE10+, that's actually a convenient-to-great API and it's a shame there's nothing like it in the standard). The changes are not trivial but save ~30LOC and most of the overhead is replicating the old/weird error handling as that requires additionally decoding the blob to a string & parsing that string to a document before being able to get the content (whereas before we'd just access to the document loaded in the iframe). OTOH we can now properly forward non-200 status codes to the crash manager (as name) which will allow using regular CM hooks to provide custom warning and error messages. Note that this requires two libraries: * a stripped down version of the content-disposition NPM lib, as download file names are provided via that header and parsing the header is decidedly non-trivial * the download.js library as it handles the various edge cases from different browsers, I'm don't think all of it is necessary for our use case but the library is not that big so no real point in trying to strip it out and potentially break it in the process
2018-03-22[FIX] base: settings view match on label.textJeremy Kersten
Before this commit, search was broken because containsLike was searching on the innerHtml. (3dd93ed129) Settings use _wordHighlighter to change the background of the matching text into the label, so the label was not only text, but html. <label><span class="highlighter">Mul</span>ti-company</label> : looking for (mul) After this commit, the match is based on the text content and not on the html.
2017-09-29[FIX] web: max one wiggle per readonly clickNicolas Lempereur
The wiggling effect of the edit button when clicking on the form (hinting that to change the form you should edit it) could happen several times. With 85d1e76 there was also a visual deffect on the Edit button when the wiggle happened several times, because bounce are stacked but the CSS class was removed after the first bounce was removed.
2017-08-31[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset sizeChristophe Matthieu
2017-08-03[REF] web, *: improve behavior of jQuery extension 'prependEvent'qsm-odoo
* web_editor Odoo extends jQuery to add some utility functions. The 'prependEvent' one add the possibility to add an event handler on an element (like the jQuery built-in 'on' function) but to be executed before the already binded ones. This function was however incomplete and did not allow to use jQuery namespaced events.
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-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.