Commit Graph
65 Commits
Author SHA1 Message Date
95d0ca4b2c [REF] web_editor,web: adapt to new jabberwock editor
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2020-10-14 10:29:09 +00:00
Goaman 55f10ac9a0 [IMP] web_editor: add assets for jabberwock editor
This commit lays the groundwork for the new editor by adding empty files to the assets in
order to change them later on. The new editor is not stable enough to be merged right
now, but delaying it to 15.0 would be problematic as the current editor has many bugs that
we are unable to fix because of how summernote interacts with browser-dependent code as well
as all the hacks that were done on top of it for Odoo since 8.0.
2020-10-02 08:52:40 +00:00
Samuel Degueldre 42abf8f496 [IMP] web_editor: add webgl image filters
This commit adds webgl image filter to the existing image options,
including a custom filter that lets the user access color-correction
options (saturation, brightness, contrast, sepia, ...) as well as
blending modes for color filters.

Part of https://github.com/odoo/odoo/pull/53114
task-2279190

closes odoo/odoo#53114

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-08-19 08:32:23 +00:00
Samuel Degueldre aa8d2a8be2 [IMP] web_editor, *: move image optimization feature to left-panel
*: website, mass_mailing

In continuity with the nline crop, in an effort to make the image
workflow as seamless as possible in the website editor, the image
optimization feature has been moved out of the modal which could be
opened through the media-dialog and into the left panel.

This commit adds a quality slider and a width selector, as well as a
preview of the image's weight to the left panel, and removes the
image_optimize dialog.

This commit also introduces the possibility to add a color filter on
images.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755

closes odoo/odoo#51517

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-06-05 18:11:53 +00:00
Samuel Degueldre 59cd23a4df [MOV] web_editor: rename crop_dialog.js in preparation for inlining
In the next commit the crop functionality will be made into an inline
widget instead of a modal dialog, as such, the name no longer makes
sense.

Part of https://github.com/odoo/odoo/pull/51517
task-2192755
2020-06-05 18:11:34 +00:00
qsm-odoo 7736cde22c [IMP] web_editor, website, *: use new color names
*: mass_mailing, website_blog, website_forum, website_hr_recruitment

Deprecate alpha, beta, gamma, delta and espilon color names and now use
a new color system: o-color-x, with x from 1 to 5.

This will allow to review the colors of all themes to have nice visuals
for the new color combinations classes, without breaking the current
uses of bg-alpha, alert-delta, etc in current websites of customers
(by keeping the old color and classes for compatibility).

This will also allow to uniformize all themes under the same conventions
to enforce BS color override:
- o-color-1 used as primary (as before, for alpha)
- o-color-2 used as secondary (as before, for beta)

Before, some themes were not following the 2 guidelines. The users
using those themes will simply have the possibility to choose o-color-1
and o-color-2 colors accordingly to restore their website without
breaking the new system features.

Another change is that those colors are defined through color palettes
and not theme color palettes. This will avoid them to generate automatic
bootstrap classes which we don't want (alert, btn) and generate the one
we want by ourself.

Note: for mass mailing, the colors and classes also have been renamed
but the system stays unchanged.

Part of https://github.com/odoo/odoo/pull/45856
task-2197038
2020-06-02 09:42:19 +00:00
Samuel Degueldre be54b82afd [FIX] web_editor, mass_mailing: fix assets template unable to load
View rendering from javascript has recently been made to check
permissions (See commits 64d0dab0a6
through ccc98e0169). Some assets required
by the iframe editor are rendered in JS so that they can be injected
into the iframe, but their permissions had not been updated, causing a
crash when trying to create or edit a mass_mailing campaign.

This commit fixes that by adding groups="base.group_user" to the
required templates.

closes odoo/odoo#51598

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-20 13:36:19 +00:00
Aaron Bohy 798931fc39 [REF] web(_editor): move jquery.nearest lib to web
This lib is also used by the Gantt view, so we move it to the
common basis between web_editor and web_gantt, which is web.

Part of task 2205607

closes odoo/odoo#51606

Related: odoo/enterprise#9740
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-05-20 09:33:04 +00:00
fja-odoo 99910b526e [IMP] web, web_editor: integrate colorpicker in colorpalette
Stop using the colorpicker dialog in the colorpalette widget.
Integrate the colorpicker widget in the colorpalette widget. Of course,
the colorpicker behaviors are adapted so that no useless rerendering
of the colorpalette is made on each value change.

The 'reset color' button is now a button like the other colors, no need
for a 'color_reset' event anymore. It is removed and replaced with a
'color_picked' event with color being an empty string. The clear button
now also work on hover.

Also, the topbar colorpalette for text and text background colors now
has the exact same behaviour as the background colorpalette: adding
color preview on hover.

The colorpalette now also closes on 'enter' keypress.

Part of https://github.com/odoo/odoo/pull/46088
task-2195313

closes odoo/odoo#46088

Related: odoo/enterprise#8696
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-15 11:05:00 +00:00
Martin Trigaux 64d0dab0a6 [FIX] *: add group_ids where it is needed
Following the previous commit adding access via groups_id
These views are rendered publicly by specific user
2020-05-14 13:59:10 +02:00
Julien Mougenot 48ee7272b6 [IMP] *: adapt qunit suite bundle inheritance
Since the test assets bundle name has been changed and its structure is different,
the inheriting assets need to be updated.

Task 2002399
2020-04-07 14:40:53 +00:00
Samuel Degueldre c305f89e51 [FIX] web_editor: fix summernote files showing up in media dialog
Due to the infamous web_editor revert, summernote assets filesa are once
again created and stored in DB, but because they do not contain
'assets_' in their name, they would show up in the media dialog. This
commit fixes that by prefixing the created summernote assets file with
'assets_'

closes odoo/odoo#45298

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-13 10:38:25 +00:00
qsm-odoo 74419dc80b [REF] web_editor: remove useless files
Commit https://github.com/odoo/odoo/commit/eb0ea8efbe932c140302e9f8da33a839bcd73146
removed the use of the 'rte' and 'rte_inline' without removing the tests
themselves. They apparently cannot work anymore as using routes which
do not exist anymore.

This commit removes the test files.

Part of https://github.com/odoo/odoo/pull/41789
2019-12-19 15:15:19 +00:00
qsm-odoo b38253f400 [REF] web_editor, *: use widgets for left panel components
Before this commit, the rendering of inner content of the left panel
options was handled through _buildXXXElement methods in the options
widgets. Now they are handled through sub-widgets which also handle
the user events.

Each sub-widget is notified with the string value it should hold
according to the snippet option target and methods. Each sub-widget
notifies a string value following user interactions, which snippet
options can use to adapt their target through their option methods.

The current sub-widgets introduced by this commit are (others will
follow):

1) we-button
2) we-checkbox
3) we-input
4) we-select (typically containing multiple we-button widgets)
5) we-multi (typically containing multiple we-input widget)

Following this commit only 3 standard option methods remain, which can
be used with any meaningful widget:

1) selectClass

-> Same as before + handle the old 'toggleClass' method when used with
   a checkbox-like widget.

2) selectStyle

-> Same as old setStyle, introduced recently (simply renamed)

3) selectDataAttribute

-> Handle both old selectDataAttribute and setDataAttribute, introduced
   recently

The parameters these methods received are now:
- previewMode: same as before
- widgetValue: the string value the widget currently holds
- params: additional parameters (mainly dataset of the related xml)
    + params.possibleValues (all the possible values for the method,
      meaninful for a select or a checkbox)
    + params.defaultValue (the value that the widget would give if it
      even holds no value)

When defining a method in XML, the given value is the default value.
e.g. data-select-style="34px" data-css-property="margin-top"
-> if set on any widget, allows to retrieve a value from the user to
   customize the margin-top, the default value being 34px.
   -> if used with a we-input, allow to retrieve any value and an empty
      value will be equal to 34px
   -> if used on a checkbox, allow to toggle between no value and 34px.
   -> ...

Hopefully, detailed documentation about all of this will follow. Code
documentation should already be helpful.

Last note: the _updateUI method (replacing the old _setActive) is now
async (so does all the functions calling it). In particular, the _select
method is now async.

Part of https://github.com/odoo/odoo/pull/40282
In preparation of task-2122935 and other tasks
2019-12-01 15:49:57 +00:00
fja-odoo 22c5fc5dd2 [IMP] web_editor, website: generalize colorpicker
Currently we have:
- a colorpicker for background color of snippets
- a colorpicker for foreground and background text (topbar)
- a colorpicker for menu/footer/navbar/etc
These 3 are separate colorpickers with different options.

After this Commit
All 3 will use the same color palette wich allow you to select
theme color, common colors, custom color and transparent filter.

Part of https://github.com/odoo/odoo/pull/38959
maintask-2066614
task-2087383
2019-11-18 09:56:40 +00:00
qsm-odoo aa9db571e3 [REF] web_editor: update the cropper library
Just after we first added the library in Odoo (in april 2018), the
library was released in its last and deprecated version (4.0.0). At the
same time, the author indeed split its 'cropper' library into 2 parts:
'cropperjs' which is the core of the original library without jquery
and 'jquery-cropper' which is a jquery wrapper of the 'cropperjs'
library. This commit updates our code to use the latest version of those
two libraries.

Note: the commit also removes the lazy loading of the library which is
useless and maybe breaking since it comes with the editor assets which
are themself lazy loaded.

Note 2: we may want to remove the jquery wrapper in another update and
simply use the standard JS library.

Part of https://github.com/odoo/odoo/pull/36880
task-2059480

closes odoo/odoo#36880

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-09-13 14:55:26 +00:00
qsm-odoo 8025205bb4 [IMP] web_editor, *: introduce wysiwyg frontend loader
* website_forum, website_profile

- Share some code between website_forum and website_profile by exposing
  a function in web_editor to instantiate a wysiwyg instance on a
  textarea

- Use no-lazy loaded JS to add a visual loading effect while the
  wysiwyg is not yet available.

This is made in preparation of task-2024197
(see https://github.com/odoo/odoo/pull/35749)

Thanks to @stefanorigano

closes odoo/odoo#36581

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-09-10 12:12:28 +00:00
qsm-odoo 4f27e52cab [IMP] web_editor, *: introduce and restore new web_editor UI
* mass_mailing, note, website, website_blog, website_form,
website_mass_mailing, website_sale

This commit, unfortunately, mixes three things:

- Restoring as much as possible the scss organisation to allow styling
the web_editor UI properly.

- Fixing some bugs like a border around the page once the editor is
loaded, no ability to scroll the snippets, etc

- Introducing a whole new UI for snippet options: a left panel instead
of the old dropdown & button overlay.

Note: this commit also do some linting and ES6 convertion even though
some of it has been done in the parent commit.

Note 2: some elements that were removed are still styled in the POS apps
but this is because part of a feature was removed while leaving dead
code behind, this is handled in another PR which is to be merged
(https://github.com/odoo/odoo/pull/36136).

Part of https://github.com/odoo/odoo/pull/36068
task-1942370

closes odoo/odoo#36068

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-28 09:04:55 +00:00
qsm-odoo b47f097feb [FIX] web_editor, *: review assets organisation
* mass_mailing, point_of_sale, website

- Lib files were included twice
- Variables files were split but added multiple times in the same assets
  bundle
- Useless assets templates were defined or split
- ...

Part of https://github.com/odoo/odoo/pull/36068
Related to task-1942370
2019-08-28 09:04:25 +00:00
56d0c1ed97 [REF] web_editor, mass_mailing: new iframe mechanism
Since we reverted the saas-12.2 editor in favor of the 12.0 one,
we faced a dilemna regarding how the editor iframe is handled in
mass_mailing.

The 12.0 version was using a special controller to get the website
assets required for mass_mailing while the saas-12.2 version used
a completely different mechanism that was, obviously, not handled
by the 12.0 version.

We did not want to reintroduce the old controllers who were
considered to be a hack to load the assets in the mass_mailing
iframe. However, we were very cautious about changing the editor
itself to avoid introducing new bugs in the editor core of 13.0.

The approach we chose at the end, is to use the loadAsset mechanism
introduced in saas-12.2 to load the necessary assets and inject them
in the mass_mailing iframe. This did not reintroduce the controllers
nor did it require to change the code of the editor itself. However,
it required moderate changes to the wysiwyg interface.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-22 06:41:05 +00:00
1eb1c2b029 [REF] web_editor: adapt wysiwyg tests to older summernote version
These modifications crystalize the behavior of the old editor, even
if it makes less sense than the behavior of the saas-12.2 one.

In some cases, the only reasonable adaptation we could do for 13.0
was to delete the tests, as these tests relied on mechanisms of
the newer version of summernote introduced in saas-12.2 which
cannot be easily replicated in the older version from 12.0 that
we are reintroducing in this PR.

It is sad to see these tests go, but we knew this was going to be
something we would lose in reverting back to the older editor.

That being said, since these tests were not present back in 12.0,
we are simply back to the 12.0 state of things, not worse. Don't
weep for them though, they will be back in Odoo 14.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-21 19:11:31 +00:00
35b61822a8 [REV] wev_editor, website: revert saas-12.2 editor
This commit reverts the saas-12.2 editor by putting back the editor
of Odoo 12.

The saas-12.2 editor was an intermediate work between the previous
editor of Odoo 12 and the new one slated for Odoo 13. It was unstable
but it was supposed to be replaced by the new editor of version 13.

However, since the new editor has been postponed to Odoo 14, the
saas-12.2 one would have been staying in Odoo 13, which would have
been a nightmare to maintain. To avoid this outcome, we chose to
put back the 12.0 editor in its place.

This has the particular advantage that Odoo 13 will share the same
bugfixes as Odoo 12 and 11 as they all run under the same core
editor, while the saas-12.2 one would have been an entirely
different beast to maintain.

This is a partial revert of f2969923.

Part of PR 35677.

Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-21 18:52:36 +00:00
Julien Mougenot edc60f7fb4 [REF] web,web_editor: moved ColorpickerDialog to web
The reason this widget was moved is that the next improvement
([IMP] base: Configure document layout) defines a new field (FieldColor)
which needs to call the colorpicker dialog inside of the base module.
This couldn't be done while the dialog was located in the wysiwyg assets.
2019-07-29 08:28:15 +00:00
Kishan Gajjarandqsm-odoo 34c4b3ad8a [IMP] website_mass_mailing, *: improve newsletter snippets
* website, mass_mailing, web_editor

This commit adds various improvements in newsletter snippets as follow:

- Improves UI for newsletter popup.

- We only had one popup for all websites. Now, we can have a different
popup for each website.

- The popup was not appearing on mobile/tablet devices. Now, in
mobile/tablet devices, the popup appears automatically after 5secs.

- Added the ability to customize the whole editor popup like any
editable area (background colors, etc).

- User needed to enable popup snippet from the settings. We removed that
setting so now popup snippet will always be available.

- Added new snippet "Newsletter block".

- Display notification after successful subscription the same way for
all newsletter snippets.

Closes https://github.com/odoo/odoo/pull/29353
task-1903256

closes odoo/odoo#29353

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>


Co-authored-by: qsm-odoo <qsm@odoo.com>
2019-06-25 09:20:35 +00:00
Thomas Werland 515fb62fc4 [IMP] base_geolocalize,web_editor,doc: create map_view
In order for the map view to work properly:
- I moved scss property to a  file only scoped to website module.
- moved the definiton of "partner_latitude" and "partner_longitude" from
base_geolocalise to base/res.partner

closes odoo/odoo#32487

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-11 07:36:53 +00:00
Sébastien Theys 87a35d4263 [IMP] web, web_editor, *: add media image optimize dialog
* = website, website_blog

The goal is to give the user an opportunity to optimize his images before using
them.

For this we introduce a preview/configuration dialog after every image upload,
where appropriate default values are filled for the quality and resolution,
based on where the image is going to be used. Since this is not going to be
perfect all the time, we still allow the user to configure them, and we display
a preview to ease this process.

Indeed it is important for SEO and for usability in general that the images are
as light as possible in size.

Technically the original image is uploaded and saved first, and then it can be
optimized. This way the upload only happens once, and the preview can be
computed from the already saved image.

task-1930726
PR: #31208
2019-06-04 22:14:13 +02:00
David Monjoie 3d3db1f035 [FIX] web_editor: insert assets in head instead of body
This made the test suite fail as there are leftovers in the body
after tests.
2019-03-06 20:07:17 +01:00
qsm-odoo 3f4e760f34 [MOV] web, *: simple moves of JS files to 'public' folder
* web_editor, website, survey, im_livechat

Part of https://github.com/odoo/odoo/pull/29442
task-1932066
2019-02-26 17:02:58 +00:00
Christophe Matthieu b49745e52d [IMP] web_editor: lazy load the wysiwyg
Issue: wysiwyg asset slow down the loading of the website, error
inadvertently introduced: https://github.com/odoo/odoo/pull/29775

The assets are now loaded assynchroneously, when the editor is needed,
its assets will be loaded.

closes odoo/odoo#30700
2019-02-14 15:11:19 +00:00
Christophe MatthieuandAntoine Guenet f296992317 [IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' field
* Creating a new structure by transforming all the plugins in the
  library using the odoo inheritance system. Plugins are easier to
  implement with the AbstractPlugin to add Odoo behaviors.

* From now on, the methods of the library (in this case Summernote) can
  no longer be called by other modules or files. Only the wysiwyg
  widgets can access it, to simplify the updating process. The wysiwyg
  object serves as an interface.

* Depending on the options the snippets will be loaded or not, the
  editor will be in an iframe or not... all of this is transparent from
  the outside.

* Regarding iframes, all controllers related to editing have been
  removed: the new API no longer needs them. This speeds up loading,
  eases testing and removes complexity for the same
  features.

PUBLIC FEATURES

There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
  library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
  a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
  element (option available to select all, start or end)

A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
  element
* focusInEnd: makes a focus and places the cursor at the end of the
  element
* selectContent: makes a focus and selects the content

HTML FIELD

The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
  saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
  dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
  an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
  into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
  cssEdit)
* wrapper: {template} qweb static template (containing a tag:
  id = "wrapper") that will include the content during editing (removed
  on save)

MASS MAILING

A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.

Co-authored-by: Antoine Guenet <age@odoo.com>
2019-01-17 08:40:21 +00:00
qsm-odoo 70f35620ba [FIX] web_editor: restore backend colors
Commit https://github.com/odoo/odoo/commit/52ec536cef2ec84af0b36746f19a8cdf9f23fe2a
made a mistake which made the backend use the website colors. This is
because the web_editor app adds its bootstrap_overridden.scss file in
both backend and frontend assets as the backend needs the editor colors
(alpha, beta, ...). However, the 'primary', 'secondary', etc that the
backend customizes should not be overridden by the web_editor. Therefore
the file contained a hack to determine if it is the backend or not...
hack which did not work anymore with the new system the mentioned
commit implements.

Also some comments were not adapted correctly by the mentioned commit.

closes odoo/odoo#29935
2019-01-04 11:27:07 +00:00
qsm-odoo 52ec536cef [REF] *: make stronger bootstrap assets
* portal, theme_bootswatch, web, web_editor, website

With less2sass and bs3tobs4 tasks, the assets structure was reviewed to
handle the specificities of both framework and to prepare for our next
odoo tasks. In particular, the assets_helpers and bootstrap overrides
were basically split into 4 parts: utils, primary variables, secondary
variables and bootstrap variables.
(see https://github.com/odoo/odoo/commit/6e4db7d13a926845bf82f5b035afede42d6d5a89)

Using the !default system for the bootstrap variables parts seems now
a good improvement. This is part of what this commit does: adding the
default flag for all bootstrap variables overrides and inverting the
order of the files in the _assets_backend_helpers and
_assets_frontend_helpers templates. This allows to avoid code like this:

portal:
```
$body-bg: white;
```

website:
```
@​if $var != null {
    $body-bg: $var;
}
```

This code makes the body white with portal or equal to $var with website
if $var has a value. The same behavior in the new file order is achieved
with:

website:
```
$body-bg: $var !default;
```

portal:
```
$body-bg: white !default;
```

This order is now also followed for the _assets_secondary_variables
templates (there are only a few).

This commit also make better assets hierarchy by making website inherit
from portal assets (instead of web) and portal inherit from web_editor
assets (instead of web) (thus relying on strong dependencies instead of
installation order which is not always right for migrated databases).

closes odoo/odoo#29757
2018-12-26 17:25:23 +00:00
qsm-odoo 1f9bf60260 [FIX] web_editor, website: review grays
What was designed as a new feature appeared as a regression: users were
not able to choose a bootstrap gray as a background color anymore but
instead got the possibiility to choose a hardcoded gray. This commit
restores the use of the custom gray palette that themes can customize
and which automatically uses the correct text color when used as a
background. This also allows to remove ugly inline style from snippet
definitions and allows to solve bugs like the described below one:

---------------------------------------
Also add bg-* classes on snippet cards:
---------------------------------------

Snippet cards are often put (or may be put by the user) in an element
which have a bg-* class on it. This means that the card will still have
a white background (as chosen by BS4 by default) but the text color will
be adapted to that ancestor bg-* classed element.

This commit forces the card background color (as suggested by BS4) with
bg-* classes.

closes odoo/odoo#27637
2018-10-10 15:09:24 +00:00
qsm-odoo 77402a4efc [REF] web_editor, *: review color theming system
* web, website

- Introduce gray color palettes (needed for themes migration)

- Synchronize BS4 color maps with individual variables (see comments
 about this in the code).

- Review alpha/primary, beta/secondary matching:

Before this commit, we decided that the common way to define a color
palette was defining primary, secondary, gamma, delta and epsilon.
alpha and beta were then forced to primary and secondary without other
possibility.
The new system makes more sense:
1) define alpha, beta, gamma, delta and epsilon
2) primary and secondary will automatically be set to your alpha and
  beta (allowing to style the default UI with BS4-independant
  variables)
3) if you are not happy with (2), you can define primary / secondary
  in your color palette so that they are not automatically set to
  alpha / beta

This commit also changes what classes the editor uses. Background colors
and text colors will now use alpha/beta/gamma/delta/epsilon (not primary
and secondary anymore). For buttons, all the possibilities are suggested
but color duplicates are hidden (so if your primary and alpha are equal,
only one button color is suggested).
2018-08-30 11:10:56 +02:00
Cocographique 4dce6cc98b [IMP] website, *: review snippets and colors
* web, web_editor, website_hr_recruitment, website_mail_channel,
  website_mass_mailing

- Review all snippets and add new ones
- Add lots of new options
- Use odoo colors as default theme colors

task-38878
2018-08-13 18:30:01 +02:00
Dipalee Bhalodia c31e2047b1 [IMP] web_editor: change UI for snippet background color menu
Replace current UI of the snippet background options with the
same one as the standard editor colorpicker

task-37974
Closes #26274
2018-08-12 18:37:08 +02:00
qsm-odoo 22c4311e28 [IMP] *: make customize dialog generic and improve options
* web, web_editor, website, website_theme_install, portal,
  theme_default, theme_bootswatch

The purpose of this task is to make the customize dialog as generic as
possible, that is theme-independant:

1) The design is now totally generic (Odoo visuals)
2) The XML definition is form-view like. This allows themes to extend
   the dialog without any risk of breaking the style and also allows to
   not care about lots of technical details.
3) New options have been included. Those were themes options that are
   now generic and which themes can simply adapt without touching the
   customize modal (navbar colors, footer color, navbar layout, fonts,
   body background, ...).

The color palette can now also be customized with user colors.

Using sass functionnalities, color palettes and fonts integration is now
a lot better.

Thanks to @qha-odoo for the original design.

task-31677
2018-08-10 16:49:29 +02:00
qsm-odoo 1ea9ef7992 [REF] web_editor: rename scss file to respect convention
The file was introduced with BS4 but the name was not well chosen.
2018-08-10 15:43:07 +02:00
qsm-odoo 76f714dca8 [REF] web, web_editor, *: review theme color extensions
* survey, website_slides

Before this commit, the web_editor app created bg and text classes its
own way for theming (alpha, beta, grays, ...). Now the system is far
more automatic by extending BS4 color maps.
2018-07-27 12:36:54 +02:00
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
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