summaryrefslogtreecommitdiff
path: root/addons/website_event/static/src/js/website_geolocation.js
AgeCommit message (Collapse)Author
2020-11-04[FIX] website_event: Prevent event block title to be editedAchraf (abz)
Issue - Install "Website" and "website_event" - Try to add Event block The title is editable Cause The contentEditable attribut is enabled Solution Disable the contentEditable attribut opw-2367538 closes odoo/odoo#61267 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-01-27[FIX] web_editor, *: remove automatic content on undo/redoqsm-odoo
* website_event Commit https://github.com/odoo/odoo/commit/a153ed42a09f8b7f5e0865112eb7d5affc22a353 solved a big problem which was that when an undo/redo is performed, the whole DOM was reconstructed breaking all the JS relying on the old one. For example, the latest blog posts which are dynamically loaded in JS were not removed before saving since the JS relied on the old DOM... and this broke the page because that dynamic content contained non-valid XML markup. The solution was to destroy all JS widgets before applying an undo/redo and rebuilding them all afterwards. Ideally this operation should be done on the undo recording action but this would have a huge flickering impact since many DOM would be destroyed each time the user types text (flickering which is also bad on undo/redo but it is more acceptable). The problem now is the following: if a widget, like many, is declared like this: ``` start: function () { this.$el.append(/* Some dynamic content on page loading */); }, destroy: function () { this.$el.find(/* Dynamic content to remove */).remove(); }, ``` Then it works in all standard cases: dynamic content is loaded on page load and is removed when saving the editor. But this happens with the undo/redo system: 1. The users types text, we record an undo, which is the whole page current DOM, containing all the dynamic contents. 2. The users hits CTRL-Z: a. We destroy all JS widgets, calling destroy, the dynamic content is removed from the page. b. We replace the whole DOM with the one that was saved. That one contains the dynamic content DOM. c. The JS widgets are recreated, calling start... creating the dynamic content again. Result: the dynamic content appears duplicated. On save, depending on how the destroy was implemented only the last generated content may be removed or both... but in any case it appears duplicated during edition. Hopefully, our current stable version do not contain that many dynamic content so a perfect amelioration of all of this can be found in master. As a fix, this commit introduces an extra step between (a) and (b): we remove the dynamic content of the DOM-to-re-apply before applying it. For this to work, widgets have to mark their dynamic content with the class 'o_temp_auto_element' when creating it. They also must add the content they replace on the 'data-temp-auto-element-original-content' attribute. closes odoo/odoo#44025 X-original-commit: f0d2559afd3094f6fbd7e6788f7c10fa421c9080 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-10-01[FIX] website_event: restore 'local events' snippet in edit modeqsm-odoo
Since https://github.com/odoo/odoo/commit/335a505d1f9b6a978c0fe0f6ea760a45b0d0a67f, the frontend widgets are not used in edit mode by default. The local events snippet's one had to be explicitly enabled. Discovered while working on task-2043872 closes odoo/odoo#37672 X-original-commit: 5424a4b590e73d2cf3cfb39bbbe656e908db2b46 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-19[MERGE] forward port branch 12.0 up to 32039b2ab44Christophe Simonis
2019-08-09[FIX] website_event: clean local events snippet before saveqsm-odoo
The local events snippets is an empty HTMLElement which is filled by JavaScript on page loading. Before this commit, the filled content was saved in database. This does not create a real problem as the content is reloaded as soon as the page loads but you can see old events flickering before the new events are actually loaded. Now the snippet is cleaned before saving. This also allows to add default content with a custo so that it is shown during the events loading (as we are currently doing on odoo.com...). closes odoo/odoo#35597 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-06[REF] website_event: 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-05[MERGE] forward port branch saas-15 up to 66efbf2b5bfChristophe Simonis
2019-01-29[FIX] website_event: restore country events optionqsm-odoo
With https://github.com/odoo/odoo/commit/ac8b0fcfc5299b5ea62543b8382cb419fed4868e, the 'country_events' class was renamed to 'oe_country_events'. This was done correctly for JS animations and snippets but not for the 'Country Events' option in the customize menu. This made the option useless. This commit solves the problem by supporting the two classes (as it is a stable fix). closes odoo/odoo#30662
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.
2015-10-01[FIX] website_event: unnecessary POST callXavier Morel
2015-07-10[IMP] web_editor: adapt css, js and xml to use web_editorChristophe Matthieu
2015-03-18[IMP] web+addons: improvement to module systemGéry Debongnie
The module system needs to know the dependencies of a given module before executing the function. This is why the dependencies were defined once in an array, and then were described one more times in the call to require. But a trick can simplify this: the boot function can parse the string representation of the module and extract the calls to require from it. It is more work for the processor, but it leads to simpler module definitions.
2015-03-18[REF] website_event: update to the new module systemGéry Debongnie
2014-03-20[IMP] removed terminal slash from url and routeDharmraj Jhala (OpenERP)
bzr revid: dizzy.zala@gmail.com-20140320063728-kuie1id6t7shvbc7
2014-03-18[IMP] improved code as suggestedDharmraj Jhala (OpenERP)
bzr revid: dizzy.zala@gmail.com-20140318130903-6u2t94bfvh98jby7
2014-02-28[IMP] moved snippet to content, Get country with help of GeoIP moduleParth Gajjar (Open ERP)
bzr revid: pga@tinyerp.com-20140228094148-e2nr13o9e9u0vkor
2014-02-26[ADD] added snippet for country event, script for finding coordinates from ↵Parth Gajjar (Open ERP)
brwoser, And display events from users country bzr revid: pga@tinyerp.com-20140226113121-vni0182v0cc2u3d4