Commit Graph
40 Commits
Author SHA1 Message Date
qsm-odoo 6e4db7d13a [REF] *: review scss variables handling
Unlike LESS, SCSS variables are not lazy loaded. Our system has thus
to be updated. This commit creates new templates which are t-called
in assets bundles (to replace the old less_helpers template):

- web._assets_utils: regroups the mixins and functions which *can*
  (and so should) be available in every asset bundle

- web._assets_primary_variables: regroups the variables (or mixins
  used as variables) which *can* (and so should) be available in
  every asset bundle

- web._assets_secondary_variables: same as above but provides an
  environnement where all the 'primary' ones are accessible. This is
  for example useful to handle the community/enterprise split:

  // Community primary variables
  $o-pink-color: pink; // enterprise color
  $o-brand-primary: blue;

  // Enterprise primary variables
  $o-brand-primary: $o-pink-color;

  // Community secondary variables
  $o-my-darker-primary: darken($o-brand-primary, 5%);

  => If there was only one variable template, enterprise edition would
     have been able to define its primary color at the end but the
     darker primary would not have been updated. Using the "!default"
     system and putting enterprise definition above would not have
     solved the problem as the $o-pink-color would not have been
     accessible.

- web._assets_backend_helpers: regroups the variables, mixins and
  functions which *can* (and so should) be available in the backend
  asset bundle only. This is especially (only?) useful for bootstrap
  variables overriddes.

- web._assets_frontend_helpers: regroups the variables, mixins and
  functions which *can* (and so should) be available in the frontend
  asset bundle only. This is especially (only?) useful for bootstrap
  variables overriddes.

Note: bootstrap variables are not accessible in any of those anymore.
If you have variables that should depend on bootstrap, you have 3
solutions:

- Find another way: your variable is probably useless, use bootstrap
  variables directly or create a variable that will influence the
  value of bootstrap variables. E.g. instead of declaring:
  `$myvar: $bootstrapvar * 3`
  and using $myvar alone, declare:
  `$myvar: 3` and use `$myvar * $bootstrapvar` where needed.

- Declare a copy of the bootstrap variable and use that one. In that
  case, you should also force-set the real bootstrap one to be sure
  they match (this should be done in appropriate templates mentioned
  above). E.g.
  ```
  $o-boostrapvar: 5;
  ...
  $boostrapvar: $o-bootstrapvar;
  ```

- Set your variable to null and set it to your bootstrap expression
  in the file you will need it (where bootstrap variables are accessible)
  without forgetting to add the !default flag to allow overriddes.
  ```
  $myvar: null;
  ...
  $myvar: $bootstrapvar * 5 !default;
  ```

This commit also partly changes the variable names to follow the
convention:
$o-<app_id>-<name> where 'app_id' is the current's app name or a
meaningful unique identifier ("theme" for all themes for example, as
no multiple themes can be installed).
2018-04-18 15:59:19 +02:00
qsm-odoo b04dec4025 [REF] *: rename all LESS files to SCSS
This is a simple renaming without adaptation.
2018-04-18 15:59:15 +02:00
qsm-odoo 9435fe110c [REF] web_editor: convert summernote less to css
Summernote is using LESS and no SCSS version exists (at least
officially). As summernote is meant to be replaced in the future and
that the LESS file was already overridden directly by Odoo, this
commit converts the LESS file to CSS once and for all.
2018-04-18 15:59:12 +02:00
qsm-odoo 1a007c1a96 [REF] *: stop mentioning "LESS" where this is not required
* web, web_editor, website, im_livechat
2018-04-18 15:59:07 +02:00
qsm-odoo a5e9acfb69 [REF] portal, website, web: rename/regroup LESS files 2018-01-10 17:54:22 +01:00
Aaron Bohy 9bc5009481 [FIX] web(_editor): enable mobile tests
This rev. introduces a new test suite meant to test the webclient
components on mobile devices. The key 'config.device.isMobile' is
forced to true in this test suite, so that mobile specific JS files
are properly executed, which isn't the case in the classic JS test
suite (setting isMobile to true in the test definition is too late,
as the JS files are already processed).

For now, this new test suite contains a single test, which was
skipped until this rev. as it couldn't be executed in the classical
JS test suite.

Both suites are executed at each build of the runbot, and they
can be manually executed from the webclient as well (via the debug
manager).
2017-11-10 10:24:42 +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
qsm-odoo 4f925af06f [MOV] web_editor, website: reorganize files 2017-08-16 10:59:39 +02:00
qsm-odoo 16f0e50318 [REF] web, web_editor, website: always let session load translations
Before this commit, the session object was responsible for loading the
translations in the backend only. There was then ugly code in web_editor
(which is also loaded in backend...) which was doing "if frontend then
load translations by myself". This code was also translating templates
while this is the qweb object's job. Now session is always responsible
for loading translation.

Note: the session object should be refactored/split.
2017-07-27 14:31:42 +02:00
Géry Debongnie 905e01921f [REF] web, *: redesign all JS views
This commit introduce a full redesign of all JS views.  We started
basically from scratch.  The goal was to unify all the various views
under a common framework, to make them testable, to make then usable in
different conditions (in studio, or in the frontend), and to make our
lives easier.

Some important points are:
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- all new code should be documented

We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.

Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-04-11 19:44:38 +02:00
qsm-odoo 8924abc0f1 [IMP] web, web_editor, website: add meaningful bundle names
As the user will be able to customize the bundles thanks to the LESS
editor, this commit give them meaningful names.
2017-02-14 16:31:51 +01:00
stefanorigano 5b8c93f073 [IMP] web_editor: change design of transparent colors palette
* Add a "transparent" button
* Add a special background for transparent background buttons

+ Some minor colorpicker design change
2016-09-07 12:58:50 +02:00
Christophe Matthieu ea8f29e260 [FIX] web_editor: debug mode is not applied in the iframe of html field 2016-09-05 17:00:33 +01:00
Christophe Matthieu cdaee93f7f [FIX] web_editor: odoo.define can be undefined if not in edit mode
Commit 933949085d added the odoo variable
definition in the iframe template so the condition which checked if
odoo.define is available had to be adapted.
2016-09-02 11:27:29 +01:00
Martin Geubelle e59a7fe3ff [REF] web_editor, website: move ACE editor to web_editor 2016-09-01 17:15:01 +02:00
stefanorigano 8c035a7a41 [IMP] web_editor: add transparent grayscale color palette
These colors were usually hardcoded in some snippets (.s_banner for
example) to increase text legibility over background images.

This commit will let the user personalize them.
2016-08-31 16:37:20 +02:00
qsm-odoo 933949085d [FIX] web_tour,web_editor: allow running tour in every context
Previous implementation allowed to run tour as a non-superuser but
this was only working in the backend where the static file tip.xml
is always loaded. In the frontend or in other non-backend context,
this file has to be loaded just before trying to launch the tour as
a non superuser (indeed, previous implementation loaded the file in
the frontend only if the user is a superuser).
2016-08-26 13:39:55 +02:00
qsm-odoo b4cfe36b05 [IMP] *: replace snippet sections menu by a title
* 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 17:44:28 +02:00
fwi-odoo a32c1d3c8d [MIG] web_editor: migrate to new api 2016-08-03 13:42:25 +02:00
Géry Debongnie d56b35e26e [REF] web, *: move QWeb odoo init to web.QWeb
this js module centralizes all odoo initialization
2016-06-17 13:27:18 +02:00
Géry Debongnie b107b14e6b [REF] report,web(_editor): services extracted in their own files
session_instance.js moved from framework/ to services/ and renamed into
session.js, which required to change the bundles in report and web_editor
addons.
2016-05-27 16:08:41 +02:00
qsm-odoo 1f15ffe4b0 [FIX] web_editor: assets_frontend inheritance
The assets_frontend inheritance made by the web_editor module should be
the first to be done as the website.assets_frontend rules have to come
after (LESS variables overridden).
2016-04-18 10:36:52 +02:00
qsm-odoo b03921cbca [FIX] report: missing mt/mb (and others) definitions
Since the website/web_editor split, the mt/mb definitions were not
included in reports anymore. Those were not the only rules that
were forgotten. In 9.0, as a fix, those rules were added back in the
report.css file.
As the assets have been refactored in saas-10, the fix here is to
link the missing file (unique in saas-10) in the report assets.
2016-04-13 12:57:26 +02:00
qsm-odoo 5a099117c4 [FIX] web(_editor): qunit tests
* Correct qunit template assets
* Delete useless template which broke qunit qweb inheritance
2016-02-25 14:45:34 +01:00
qsm-odoo 6610d05549 [REF] web_editor,website,mass_mailing: JS/XML update
* Adapt DOM selectors
* Refactore dialog XMLs to have odoo styling
* New editor options (background-position, ...)
* Various improvements
2016-02-24 13:47:36 +01:00
qsm-odoo 88c2b6843a [REF] web,web_editor,website(_*),report,pos,mass_mailing: assets
* Remove recursive assets inclusions (i.e. assets_editor was including
assets_common, summernote, ...)
* Better construct the assets (link, then script + type attribute)
* Better include the assets (split js / css, always use t-call-assets)
* Simplifies the number of assets
* Move bootstrap js to assets common
* assets_frontend is now created by web module to allow using it on the
connexion page but also in the web_editor, where colors have to be
bootstrap/theme ones. Note: if a module depends on website, then keep
using the inherit_id="WEBSITE.assets_frontend"
2016-02-24 13:47:06 +01:00
qsm-odoo 40334b3342 [REF] web_editor,website,mass_mailing: editor UI unification
Before, the whole editor UI was redefined for web_editor, each
mass_mailing template, website builder, ... Now they all inherit
from the web_editor one.
2016-02-24 13:09:15 +01:00
stefanorigano c4a896a8a0 [REF] website,web_editor: complete restyling 2016-02-24 11:15:55 +01:00
Christophe Matthieu da880a48db [FIX] web_editor: don't insert css inline for readonly html frame
The preview is not equal to the real email rendering because inline.css is present.
2016-01-18 17:09:01 +01:00
Nicolas Lempereur 21a8c76b6a [FIX] web_editor: set csrf_token in editor iframe
Some feature of the iframe embedded editor may require csrf token
present, thus it has been added in the same way that cea29e0c0 did.

The web editor iframe template is also used to display the value without
editing it and in this instance having the csrf has no meaning.

opw-656685
2015-11-18 14:31:55 +01:00
Christophe Matthieu d7b5eeabeb [IMP] web_editor: move picture options from snippet to summernote bar
Difficulty for the user to understand how to change the images.
Some options summernote being in the bar and the other in the snippets editor.
Need to merge this options.
2015-10-26 11:43:36 +01:00
Nicolas Lempereur d33086c03f [IMP] web_editor: update summernote up to 2015-08-31
update summernote library up to revision:
 https://github.com/summernote/summernote/commit/a0f26e300

see https://github.com/summernote/summernote/ for history

closes #8704
2015-09-29 14:47:24 +02:00
Nicolas Lempereur eed63c793a Revert "[IMP] web_editor: update summernote up to 2015-08-31"
Revert till several issues are solved.
2015-09-25 10:53:08 +02:00
Nicolas Lempereur 7747e0751f [IMP] web_editor: update summernote up to 2015-08-31
update summernote library up to revision:
 https://github.com/summernote/summernote/commit/a0f26e300

see https://github.com/summernote/summernote/ for history

closes #8704
2015-09-25 08:29:16 +02:00
Christophe Matthieu e4866f830e [FIX] mass_mailing: remove the wrong scrollbar in html field
Add "web_editor_inside_iframe" id in web_editor iframe template to apply css style only when the field is in html field.
Remove "content" css media query in iframe editor to remove scrollbar.
2015-09-21 13:45:36 +02:00
Christophe Matthieu 41e730cbfa [IMP] web_editor: add document into the media editor
User can upload documents and add the link in the page to download it.
2015-08-21 22:06:52 +02:00
Christophe Simonis 2cf91d16a5 [MERGE] forward port of branch saas-6 up to 63e92cb 2015-07-22 16:17:54 +02:00
David Monjoie df9725df26 [IMP] web_editor,website: added scalable margins in less
The original commit by fka used to define less variables like this:
@px-4: 4px
@px-8: 8px

The goal was to be able to change the margin values in
media queries for smaller screens.
However, as the less is only compiled once in css, those
variables didn't really help as you couldn't redefine them
from inside a media query and have the less magically
reassign the margins on the fly.

I created less helper functions to be able to easily redefine
the margins for smaller screens from inside media queries.

The task also required to replace the nbsp in the html by the
newly created mr and ml classes.

This is also the first phase of the sass -> less transition.
2015-07-20 15:00:24 +02:00
Christophe Matthieu 2868a86401 [FIX] web_editor: web_editor.css must be in common to have the css for public user 2015-07-10 17:00:15 +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