Commit Graph
33 Commits
Author SHA1 Message Date
qsm-odoo abde8bddf8 [REF] web_editor, website(_*): refactore media & link dialogs
* blog, gengo, sale
2018-01-16 17:03:15 +01:00
qsm-odoo 2972976962 [REF] web_editor, website, *: complete refactoring
* 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-08-16 11:04:14 +02:00
jpr-odoo 9e26d875db [IMP] *: uniformize modals buttons: remove 'oe_link' class and 'or' between buttons 2016-11-09 15:27:01 +01:00
Jainik Patel a4d7540ed9 [ADD] various: add missing icons for website apps 2016-08-18 16:45:38 +02:00
vbh-odoo 8acfb0d72d [FIX] website_gengo: fixed button click and translations
- Fixed linking issue after click on 'Translate' button.
- Controller added to post terms in gengo

opw-648546
2016-05-18 15:15:41 +02:00
Christophe Simonis 57168a9e90 [MERGE] forward port of branch saas-6 up to a669433 2015-09-23 14:34:26 +02:00
Christophe Matthieu 9665882fba [IMP] web_editor: adapt css, js and xml to use web_editor 2015-07-10 17:00:12 +02:00
Christophe Matthieu 8c559044a5 [IMP] web_editor: split website into web_editor (to use editor in backend for html field) and website 2015-07-10 17:00:11 +02:00
Pankaj Joshi 98d0e3cc4b [IMP] updated icon classes which are renamed in font-awesome v4.2 and removed useless icon-* classes of old font-awesome 2015-06-08 12:52:29 +02:00
Géry Debongnie 4fdf74fe21 [IMP] web+addons: improvement to module system
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 09:23:37 +01:00
Géry Debongnie 43ed24c375 [REF] website_gengo: update to the new module system 2015-03-18 09:23:35 +01:00
Jeremy Kersten fd0c52550a base_gengo: [FIX] change http status code for gengo_callback because status 100 make response very slow
[FIX] Cron for gengo was always in mode 'do missed' what we don't want, replace 0 by False
[FIX] Remove unused regexp to find view_id from js which was breaking the count words
2014-07-16 14:59:22 +02:00
Fabien Meghazi eae846f2c8 [FIX] remove @translatable conditions and de-activate group_website_designer specifics
Bundlification (and later merge of editor and web client) can't work with conditional
script inclusion

bzr revid: fme@openerp.com-20140425124913-9jsfhbfhoq6j6xxl
2014-04-25 14:49:13 +02:00
Fabien Pinckaers d5599de606 [IMP] Gengo Fixes
bzr revid: fp@tinyerp.com-20140409214509-0ww46dnt3np66ncx
2014-04-09 23:45:09 +02:00
Parth Gajjar (Open ERP) fc84161c7a [IMP]improved Arabic Language Code in base_gengo
bzr revid: pga@tinyerp.com-20140401054518-jhw4t5noxsmju9rt
2014-04-01 11:15:18 +05:30
Parth Gajjar (Open ERP) ff1588a46d [IMP] added new supportable languages, bog solved in config dialog, improved count words dialog
bzr revid: pga@tinyerp.com-20140331070625-qtr7l45lnca5rfze
2014-03-31 12:36:25 +05:30
Parth Gajjar (Open ERP) 3de6738dbb merged with trunk addons
bzr revid: pga@tinyerp.com-20140328131822-0kc0f5j5qhupkhbr
2014-03-28 18:48:22 +05:30
Parth Gajjar (Open ERP) 1ccbc213e7 [IMP] limit option in gengo manual request instead of20 reqests every time, post jobs on gengo at the time of website post without compromise speed
bzr revid: pga@tinyerp.com-20140328113715-5y14vtgcfnojk7bs
2014-03-28 17:07:15 +05:30
Parth Gajjar (Open ERP) 488111719c [IMP] improved config dialog if api key not set
bzr revid: pga@tinyerp.com-20140328063623-it6j2lptjoieik91
2014-03-28 12:06:23 +05:30
Parth Gajjar (Open ERP) e1fee1a4c3 [IMP] improved dialog
bzr revid: pga@tinyerp.com-20140327111612-g0cukmzw4kripewq
2014-03-27 16:46:12 +05:30
Parth Gajjar (Open ERP) eedb1bedb1 [IMP] minor changes
bzr revid: pga@tinyerp.com-20140327105352-46q4jgti549978x7
2014-03-27 16:23:52 +05:30
Parth Gajjar (Open ERP) f75d77db4c [IMP] minor changes
bzr revid: pga@tinyerp.com-20140327103014-3h8kbrdyn33jsepp
2014-03-27 16:00:14 +05:30
Parth Gajjar (Open ERP) daed4c8c41 [IMP] send user's company_id for link if api key not set
bzr revid: pga@tinyerp.com-20140326071057-fr76le4yr2yaiohq
2014-03-26 12:40:57 +05:30
Parth Gajjar (Open ERP) 744b4bb2b6 [IMP] opened dialog if api key not set, final total in dropdown, improved requests in base_gengo
bzr revid: pga@tinyerp.com-20140325141308-5h2rtlbm2ctytbt1
2014-03-25 19:43:08 +05:30
Fabien Pinckaers fa46f255f2 [IMP] wording
bzr revid: fp@tinyerp.com-20140324203540-rx76yaqaw3p9aql9
2014-03-24 21:35:40 +01:00
Parth Gajjar (Open ERP) 69e6a7a808 [IMP] send source url in gengo comment, and save page on gengo post
bzr revid: pga@tinyerp.com-20140324111253-xts034vw3rjjl1cb
2014-03-24 16:42:53 +05:30
Parth Gajjar (Open ERP) bf0d35dbdd [IMP] merged gengo translator with main translator, removed 'Restart Job' from wizard,removed constraint from base_gengo
bzr revid: pga@tinyerp.com-20140324103631-j4cswrlk5huuibt5
2014-03-24 16:06:31 +05:30
Parth Gajjar (Open ERP) bc0a7cbc0c [IMP] added sync option in base_gengo wizard,do not show option in website_gengo
bzr revid: pga@tinyerp.com-20140321071438-kip2lkzlzvm0et7n
2014-03-21 12:44:38 +05:30
Parth Gajjar (Open ERP) ac8babe0e5 [IMP] minor changes
bzr revid: pga@tinyerp.com-20140320120758-ojgqpqb8sakdhkbb
2014-03-20 17:37:58 +05:30
Parth Gajjar (Open ERP) a378f547f4 [IMP] minor changes
bzr revid: pga@tinyerp.com-20140320092643-1pw62dmbj9h6sjh4
2014-03-20 14:56:43 +05:30
Parth Gajjar (Open ERP) b7a68828ed [IMP] improved statistics, added sendbox options for testing, improved UI
bzr revid: pga@tinyerp.com-20140320071028-adyh8d89o7dij81o
2014-03-20 12:40:28 +05:30
Parth Gajjar (Open ERP) b8d87606f0 [IMP] added gengo statistics, displayed inprogress elements
bzr revid: pga@tinyerp.com-20140319133121-31umju0ea84sm93y
2014-03-19 19:01:21 +05:30
Parth Gajjar (Open ERP) c49befd59f [ADD] added website_gengo module
bzr revid: pga@tinyerp.com-20140318133036-j1hcrz7bybolw44u
2014-03-18 19:00:36 +05:30