Commit Graph
2161 Commits
Author SHA1 Message Date
Samuel Degueldre 56cddd70d1 [FIX] web_editor: stop snippet editors from finding widget in parent
Because of the event propagating to an option's parent, a snippet option
requesting a uservalue widget would also get back the corresponding
widgets on the parent snippetEditor, this has the potential to cause
unforeseen problems. This commit fixes that by stopping the event's
propagation.

closes odoo/odoo#46724

X-original-commit: 1441b3c2f4f935771b3210be82f7b471aa028b64
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-03 11:28:16 +00:00
qsm-odoo 0280b5fb01 [REF] web_editor, website: rename editor left panel tabs
- "Options" -> "Style"
- "Theme" -> "Options" (as now contains not-theme-related options)

closes odoo/odoo#46602

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-28 16:17:25 +00:00
Thanh Dodeur 560e3af48a [IMP] web_editor, website: adds custom code to head and footer
This commit adds two buttons on the Theme side menu that allow users to
add custom XML to the head and to the footer of the website.

Part of #44633
task-2168391

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-28 13:48:39 +00:00
Jérémy Hennecart 3abf0e7df1 [IMP] web_editor: increase height of iframe
The heigth of the iframe for editing a mail template
was to small, which makes it quite uncovenient.
The height has been raised to improve the usability
of the editing feature.

task-2198656
2020-02-27 09:59:24 +00:00
alt-odoo b0be65f211 [FIX] web_editor: crash in date formatting if no langage set
This issue was introduced with commit 251b880de1caeeef1f27447d4ad69e1abeffde19 : in case current user has no langage,
we should have a fallback case by retrieving the first langage installed in the database.

closes odoo/odoo#46487

X-original-commit: 67cf1150507b8092c32bf745e4c8620409fdc238
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
2020-02-27 20:04:06 +00:00
Kishan Gajjar a4451579bc [FIX] web_editor: do not store base64 of cropped image to html field
On crop dialog save, the image src is set to the base64.
We are creating an attachment for the cropped image if the user save the changes
and after that, we set the newly created image as the src of that image.

Meanwhile, when the user save the 'html' field, it is not creating
any attachment for the cropped image and also it leaves base64 as it is.
Due to that field store large data into the database.

this commit makes sure that attachment is created for cropped images
and update src before storing field value to the database.

closes odoo/odoo#46455

X-original-commit: 2bcaa25e67260e3013d4400d1b3ce380ba5cbd1d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-27 13:53:25 +00:00
Romain DerieandJeremy Kersten 4eafd78847 [FIX] web_editor, website: handle date edition in all lang and format
Before d00c0e317, `Datetime` fields would be editable in frontend but would
have unexpected results, especially in non-English languages, for when the
english lang format had been changed.
It would also crash when saving non-English strings, such as `Lundi`.
For more details, see https://github.com/odoo/odoo/pull/44484#issuecomment-586850490

Since d00c0e317, only date displayed in lang format would be editable, which
case is Event page in Odoo 12.0. Everywhere else, the format is changed for a
nicer layout, either with `widget=XXX` or `t-options=YYY`, such as:
`<time t-field="record.date" t-options='{"format": "MMM d, yyyy"}'/>`
`<time t-field="record.date" t-options="{'time_only': 'true', 'format': 'short'}"/>`

When a date parsing crashes during editor save, the problem is not only that
the date can be saved, but the whole changes of the page are lost, as they
won't be saved either.

This commit attempts to fix every languages cases, regardless of the website
lang or user lang.
To do so, we store the date in the user lang format in a data attribute of
every date field in the DOM. Once the field is clicked (to edit probably),
that value will replace the one displayed according to the widget/options.
That way, dates will always be sent to the server in the user lang format,
avoiding any possible mismatch.

This whole fix apply to `Datetime` and `Date` fields.

opw-2183055
Closes #44484
Closes #45555
Fixes #44047

closes odoo/odoo#45725

closes odoo/odoo#45997

X-original-commit: c0db9bb8027ff926c619aebe6e0a5cdd05808232
Original-signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
2020-02-21 18:57:59 +00:00
Harpritsinh SisodiyaandMohammed Shekha 7639f7fbcb [IMP] web_editor: check resource is custom or not to display warning on editor
adds _isCustomResource method which will check whether resource is custom or
not, this method checks for JS and SCSS resource, if resource is custom then
do not show "No Update" warning inside ace editor.

task-2167570

closes odoo/odoo#44536

Related: odoo/enterprise#8368
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-02-21 08:34:24 +00:00
Romain Estievenart 4582f4ade3 [FIX] web_editor: add scope to apply z-index web-editor dialog on mobile
this bug was introduce by the inline z-index define inside the template 'web_editor.FieldTextHtml.fullscreen' (https://github.com/odoo/odoo/commit/912996fe902c41cafa12dcfe09713ce9857f95ab#diff-76a385e3a3e67f1b88b34afd8181f732R13)

This was breaking the z-index web-editor dialog (using inside mass-mailing), so a first fix using a new z-index was made for the web-editor dialog (https://github.com/odoo/odoo/commit/65c8d33c2922bd90e2755cff0a6751c8b3b130d8)

But we a missing a scope to identifiable a web-editor dialog was missing. So this commit add a class to allow target only the web_editor dialog.

Task ID: 2198649

closes odoo/odoo#45702

X-original-commit: 441a5fa5a67f25398744ea18860eebdc4d17dddb
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-02-19 11:21:39 +00:00
Andrea Grazioso (agr-odoo) 3ee9a9fbdc [FIX] web_editor: deny videos in mass mailing
Create a new mass mailing, add a video via youtube embed link, save.
Send email.

Embedding a video can't work because it embeds an iframe, which is not
supported by most email clients for security reasons.
Extending the noVideo flag also to mass_mailing

opw-2179665

closes odoo/odoo#45104

X-original-commit: f9f8c9cc4075fdc5fd4556aa49c914054469198a
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-11 14:44:01 +00:00
Samuel Degueldre 416500f6e3 [IMP] web_editor, website: add callback to editor clone and remove
We recently transitioned to async option methods, this allows us to have
better control on the order of execution in the edition workflow, and
among other things, keep the editor's UI in sync with the current state
of the DOM.

However, some snippet options (such as the number of columns option)
need to remove or clone portions of the DOM, and as such, trigger the
onClone or onRemove methods of the snippets contained in that portion if
applicable. Because these methods are defined on other options, we first
need to make sure all the snippetEditors for this portion are created,
which is asynchronous.

This commit adds support for an onSuccess callback to the
'clone_snippet' and 'remove_snippet' event handlers, such that options
can choose to be notified when the work has been done, allowing them to
wait for it before proceeding.

This commit also adapts the layout_column snippet option to make use of
that new feature, and remove code that was used as a workaround before,
ie: precomputing the expected number of columns after the clone/remove,
and using that number to adjust the width of the columns and update the
UI. We can now just wait for the clone/remove, and use the real number
of columns currently in the DOM.

closes odoo/odoo#45343

X-original-commit: c159d58ce9cfca4a44f159b18eb10d1138977e23
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-13 18:02:48 +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
Martin Trigaux 0cc8610923 [I18N] export saas-12.3 source terms
closes odoo/odoo#45285

X-original-commit: bb281e98f52a2716f00d43a07446a08df698c1dd
Related: odoo/enterprise#8413
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-13 11:45:39 +00:00
fja-odoo 1262648486 [FIX] web_editor, website_form: fix submit btn edit
The edition of the submit button's text was broken.

Part of https://github.com/odoo/odoo/pull/44907

closes odoo/odoo#45124

X-original-commit: 85966ac29b53d9e1c2ad1efb2c35ab13c9baae89
Related: odoo/enterprise#8360
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-11 17:35:07 +00:00
qsm-odoo 0ac7d67c5f [FIX] web_editor: fix gallery blocking the editor after image reordering
When snippets deeply alter the DOM (e.g. image reordering in gallery),
the related option might be destroyed since they are referencing old
DOM. If such a case occurred, the destroyed option was still waiting for
an option update response by the editor before being considered as
finished... which then never occurred and blocked the editor.

closes odoo/odoo#44998

X-original-commit: 9eeea4c4107dc15984c475582d5ee58a17cd2568
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 14:28:34 +00:00
Samuel Degueldre 99427c2c5a [FIX] web_editor: fix apply-to methods not being awaited
When the apply-to data attribute was first introduced, a mistake was
made when storing the results of the methods calls, using _.each instead
of _.map to associate each target element with the promise of the method
execution, as a result, Promise.all would resolve immediately instead of
waiting. While there are no currently documented bug caused by this,
they are just waiting to happen.

This commit fixes that.

closes odoo/odoo#44988

X-original-commit: 32271be1f696c11b3e5157426b8f7c9efa93134b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 13:48:40 +00:00
fja-odoo 574bf9bb12 [FIX] web_editor: fix color palette custom color behaviors
Selecting a css color equals to a theme color via the custom color
was not selecting the theme color.

Opening and closing the custom color without picking a color was
unselecting the selected color.

Now the custom color picker has the selected color as default even if it
does not appear in the palette as selected. This was appearing in the
parallax snippet as no custom color is displayed.

closes odoo/odoo#44986

X-original-commit: 0c8be24ac72c223c12eadbdcf635628f203a6766
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 13:48:19 +00:00
qsm-odooandfja-odoo ed999bc88e [FIX] web_editor: fix image removal inside image gallery
Since we use Promise instead of jQuery deferred, the onRemove method
class was no longer triggered before the actual removal of the elements.

Original fix with https://github.com/odoo/odoo/pull/43918
This PR is the same with the async/await form, not breaking the history
of half of the removeSnippet method's lines.

closes odoo/odoo#44963

X-original-commit: 37941159c82d487ff172f0e6b27028f23ab32810
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: fja-odoo <fja@odoo.com>
2020-02-10 11:43:00 +00:00
fja-odoo 1ebc4661dc [FIX] web_editor, *: unblock editor after any option dialog closing
*: website

Some dialog promises were not resolved on close, blocking the editor.

closes odoo/odoo#44953

X-original-commit: 20f97470cdc59a817526305806e94b222f26a0f2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 10:54:02 +00:00
jvm-odoo fe6a45945a [FIX] web_editor: trigger content_changed when updating alt or title
Issue

	- Install Website
	- Go on your website
	- Add text block with image
	- Change ONLY the image's alt and/or the image's title text
	- Save dialog
	- Save page

	Not saved

Cause

	The element doesn't become dirty after changes in alt dialog.

Solution

	Trigger content_changed to make the element become dirty.

OPW-2189909

closes odoo/odoo#44885

X-original-commit: 4f1712075fbc4d95d83690fbcfe72f9b72260254
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-07 15:04:57 +00:00
qsm-odoo ef03b02af6 [FIX] web_editor, website, *: editor notify method must be synchronous
* website_form

Some technical explanations:

The method became async because the `setTarget` call which was in there
became `async` since it performed an UI update. As this method being
async is a problem with some snippets, it is best to keep it synchronous
for now. For this, the UI update in `setTarget` is removed and becomes
the responsibility of the caller. Nothing relied on it except one code,
which is solved by calling `onFocus` before the UI update which occurs
on focus, as it is already the case in master.

closes odoo/odoo#44850

X-original-commit: 53bba0660237abbcadc9675fd89ec94a2a31e130
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-07 12:43:25 +00:00
qsm-odoo 6fb4ed44a0 [IMP] website, *: make theme custo options act as simple snippet options
* web_editor, theme_bootswatch

Instead of having an entirely dedicated system for theme options in a
third tab of the left panel, those theme options are now simple snippet
options. See the customizeWebsite generic method.

This allows to make any option available in the third tab or on any
meaningful element like the header or the footer. This also allows to
take advantage of all the features of the left panel: dependencies,
visibility update, etc.

Note: same as before, those changes do apply the color/size/layout
immediately on the website, even if not saved. Changing that behavior
is complex and might be the job of another task.

Part of https://github.com/odoo/odoo/pull/41166
task-2088298
2020-02-05 23:49:53 +00:00
Samuel Degueldre 3bb666c226 [REF] website, web_editor: move theme customization to edit mode
Previously, theme customization was done through a modal dialog in the
website module, this was not very user friendly since the rest of the
customization for the website design was done from edit mode, meaning
the user had to exit edit mode to customize things such as theme colors
or fonts. It was also rather confusing to have these seemingly related
things in completely unrelated places.

This commit moves all of the options that used to be in the theme
customization modal into a new tab in the editor's left panel.

This commit is mainly just about rendering the old modal as a third left
panel content. See next commit for deeper changes.

Note: same as before, those changes do apply the color/size/layout
immediately on the website, even if not saved. Changing that behavior
is complex and might be the job of another task.

Part of https://github.com/odoo/odoo/pull/41166
task-2088298
2020-02-05 23:49:53 +00:00
qsm-odoo 1e576ee899 [FIX] web_editor: consider negative values in the left panel
A negative value, even if legit, was not understood by the editor and
induced empty inputs in the left panel.

closes odoo/odoo#44683

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 21:39:22 +00:00
fja-odoo 617eba9417 [IMP] website_form, *: entirely review s_website_form snippet
*: web_editor, website_crm, website_form_project,
website_hr_recruitment, website_sale

The form builder is now using the left panel option system. Many new
options are introduced to build better forms more quickly.

The tests are now running with the new website_form implementation.

Part of: https://github.com/odoo/odoo/pull/42189
task-2092425

closes odoo/odoo#42189

Related: odoo/enterprise#7365
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 16:13:25 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
Jeremy Kersten 537644ec3e [IMP] website_blog: activate cover snippet on edit mode enter
As this is the first thing you want to do when creating a blog, it will ease
the onboarding.

task-2144335
2020-02-04 10:59:22 +00:00
Romain Derie b3ffb756a2 [IMP] web: restore blockquote style lost with BS4
Before this commit, the web_editor option 'Style' which has a `Quote` entry
would not do anything visually.

Indeed, what it does is inserting a `<blockquote/>` element in the DOM but is
has no style anymore in BS4.

This commit restore the style we had with BS3.

task-2144335
2020-02-03 15:25:20 +00:00
Jason Van Malder 5b252215dc [FIX] web_editor: replace root style/class attrib
Issue

    - Install eLearning
    - Edit the header > change image
    - Save

    Image not changed

Cause

    We do not take new style/class attrib in account in
    replace_arch_section.

Solution

    Take them in account

OPW-2122947
OPW-2182109

closes odoo/odoo#44541

X-original-commit: 8579c0cae839c615415120b79d6ec22c71f7affd
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-02-04 08:00:14 +00:00
qsm-odoo a5281de40e [FIX] web_editor: always notify snippet option 'reset' after 'preview'
Some code was added to prevent notifying a 'reset' if there was no
'preview' before. Unfortunately, checking "if there was a 'preview'
before" cannot be done properly so some 'reset' were stopped while they
should not have. This commit simply removes the code which is in fact
not needed.

closes odoo/odoo#44499

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-03 13:58:38 +00:00
fja-odoo c547d7c1c5 [FIX] web_editor: fix input selection not supported
Some elements like the file input are not compatible with selection.
Since there is no reliable way of figuring out if the element is
compatible or not we will simply try catch it.

closes odoo/odoo#44470

X-original-commit: 1f0a0b380c2738795b0b5a7976692d9e9cd88583
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-03 11:07:15 +00:00
Jason Van Malder cf2f53e4cf [FIX] web_editor: fix required html fields
Issue

    - Studio
    - Add an required html field
    - Create new record
    - Leave it empty

    It is saved

Cause

    The isSet function of FieldHtml widget, have a "/" in the <br> tag
    and summernote empty = <p><br></p>. If you add a space, the value
    becomes <p>&nbsp;&nbsp;   <p>.

Solution

    Remove the "/" and the spaces, check if value != <p></p> &&
    <p><br></p>

OPW-2183687

closes odoo/odoo#44427

X-original-commit: c984b1b1210cea1e63f3bc66cec2120554c76c2a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-31 17:20:34 +00:00
Nicolas Lempereur 661e190a3f [FIX] mass_mailing, web_editor: edit font awesome icon with zoom
In case of font-awesome icon when the browser is being zoomed, we can
get a decimal font-size.

There is a system that transform font-awesome in image links so they are
readable in any email client (supporting image) but it did not take into
account decimal font-size.

With this changeset, we only send a integer font size: we do not try to
get the original value because styling is relative on elements, a 90%
zoom ratio could lead to a 98% font-awesome icon ratio.

Also improve edition of font-awesome icon edition after first save by
reverting the transformation to image on edit. Thanks to that, the
original size will also be reinstated and will not depend on zoom on
previous save.

opw-2156069
closes #43949

closes odoo/odoo#44033

X-original-commit: fe72bf01b67ea20ddb74a5b05464c63cc77090ef
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-01-27 16:03:38 +00:00
Benjamin Vray 48f9060a46 [FIX] web_editor: adapt drop zone direction in oe_structure
Adapt drop zone direction when a snippet is dropped in an oe_structure
within a snippet.

Before that, the first and the last drop zone preview (when dropping a
snippet in an oe_structure inside an other snippet) was vertical if the
oe_structure width was smaller than his parent.

Part of https://github.com/odoo/odoo/pull/40690
task-2118980
2020-01-30 16:56:56 +00:00
Romain Derie 506d293714 [FIX] web_editor, *: correctly find o_snippet_invisible
*: website

This commit is a safety nest to ensure `o_snippet_invisible` will be
found, even if somehow they appear as one of the editable area elements.

It might be the case with some refactoring, as it was the case between
404fa8164 and 83d99941c, in which case, the step to reproduce were:
  - Add s_popup snippet into the page
  - In the options, select 'Show On All pages' -> It moves to footer
  - Now save and enter Edit mode again
  - The invisible element (popup in this case) is in the DOM, the widget
    is working fine but it is not retrieved as an invisible element,
    thus not possible to edit it

+ lint/dead code

Part of https://github.com/odoo/odoo/pull/41294
task-2087003
2020-01-29 14:52:23 +00:00
Antoine Prieels b3661017d0 [FIX] web_editor: properly copy link URL
Avoid display errors with special characters when copying the href attribute
of links in the web editor.

opw-2078313

closes odoo/odoo#44176

X-original-commit: 19ebcdd20426406250174eb473b081a9e488e542
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-29 10:55:53 +00:00
qsm-odoo ab7016c8e1 [IMP] web_editor, *: make all editor left panel items inline
* website, website_sale

The design will be deeply reviewed in a future update. This commit is
just about unifying it and making sure no element is cut/overflowing.

-> All items are now inline automatically
-> If there is no enough space, it becomes full-width over two lines
   automatically (this can be forced with the o_we_fw class)
-> Force to stay on one line with the o_we_force_inline class

closes odoo/odoo#44142

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-29 10:30:38 +00:00
qsm-odoo d1a867553d [FIX] web_editor, *: remove automatic content on undo/redo
* 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>
2020-01-27 15:17:02 +00:00
fja-odoo 876a7aad0b [FIX] web_editor: fix move snippet hiding
The move snippet arrows where not hiding properly when the target was
not movable.

closes odoo/odoo#43864

X-original-commit: ab32882ff0ecaf9995e52b062b880cd8ea0b6efa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-23 16:09:30 +00:00
qsm-odoo e927d1e89b [REF] web_editor: review left-panel unknown dependency behavior
Left panel widgets can define the widgets they depend on to be visible.
Up to now, if such a dependency was defined but that the related widget
was not found, the dependency was considered as not met. Now, it acts
as if that particular dependency was not defined at all.

This is useful for controlling the visibility of a generic option in the
case of a specific snippet without having to duplicate and restrict that
generic option.

E.g. There is a generic "color" option on all snippets. For my snippet
"hello" I only want that generic "color" option to be visible if my
"world" option is enabled. I then add `data-dependencies="world"` on the
generic "color" option. In the case, any other snippet than "hello" is
used, since the "world" option does not exist there, the "color" option
acts as if it had no dependency.

closes odoo/odoo#43511

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-20 09:50:16 +00:00
fja-odooandqsm-odoo 218e1cad61 [IMP] web_editor, *: allow saving of snippets
* website, mass_mailing, website_event, website_form,
  website_mass_mailing, website_sale

Now the user can save snippets to use them on other pages.

task-2120409

closes odoo/odoo#40408

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2020-01-16 14:29:04 +00:00
fja-odoo 47441a9228 [FIX] web_editor: save all child text nodes of oe_structure elements
When saving the content of an oe_structure, the starting text nodes
were lost because only the internal *elements* were considered. Ending
text nodes were kept since they are considered as the last element's
tail by the etree library.

task-2040764

closes odoo/odoo#43375

X-original-commit: eb71d25ce965ecdb20c26517627aed5b43f8b990
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-15 17:46:02 +00:00
fja-odoo ac930249ba [IMP] web_editor: update left panel UI *after* onFocus method call
Call the `onFocus` method before the `updateUI` one so that we can
make changes before we update/render the UI (so that `updateUI` may
be influenced by something done in `onFocus`).

Needed for upcoming task: https://github.com/odoo/odoo/pull/42189

closes odoo/odoo#43334

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-15 12:02:50 +00:00
Romain Derie 5476a4c0ed [FIX] web_editor: restore 'title' attribute on 'we' element
Since a refactoring (it was working at some point), `title` attribute on `we`
elements would be lost when rendering actual DOM elements.

We had 2 occurences of `title` on `we` elements:
1. s_countdown > What Should Happ.. > Show Message > fa-eye icon has a title
   (in next version 13.2)
2. data-js `BackgroundPosition` (section) > fa-arrows has a title

Also, incoming Cookies Bar task/PR will add a title on 'Hide For' option.

closes odoo/odoo#43199

X-original-commit: 230a84edcea139bc7df44a4d1a27761e74038257
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-13 12:05:27 +00:00
qsm-odoo bc086e4c79 [FIX] web_editor: allow to simulate a preview of a colorpicker reset
This is important so that trigger-value works
(see https://github.com/odoo/odoo/commit/e590609ebb429c6254766aa1fd8cab3ce3fd4c74)

closes odoo/odoo#43182

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-13 10:26:26 +00:00
qsm-odoo e590609ebb [IMP] web_editor: allow to enable option widgets by enabling another
With this commit, we can now say "on preview/selection of a widget,
also preview/selection these other widgets". For this, add a
`data-trigger` with comma-separated widget names.

A `data-trigger-value` can also be used to indicate the values these
other widgets should have during preview/selection... but this currently
only works for colorpicker widgets thanks to a big big hack that should
be improved later.

Part of https://github.com/odoo/odoo/pull/42986

closes odoo/odoo#42986

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-01-09 13:09:50 +00:00
qsm-odoo 03ee121d6a [REF] web_editor, *: use _onUserValueXXX methods instead of notification
* website

This commit is simply about factorizing the code some more and making
sure the user value widgets always trigger a meaningful 'previewMode'
value.

Part of https://github.com/odoo/odoo/pull/42986
2020-01-09 13:09:38 +00:00
qsm-odoo d3ac066ee5 [REF] web_editor, *: allow to simulate notification of a widget
* website

This commit is simply about making the related method public instead of
private (allow to better see the diff in upcoming improvement commits).

Part of https://github.com/odoo/odoo/pull/42986
2020-01-09 13:07:03 +00:00
qsm-odoo 710d9c2226 [REF] web_editor: factorize user value widget notification code
Instead of triggering three different events 'user_value_change',
'user_value_preview' and 'user_value_reset', user value widgets in the
left panel now trigger only one event: 'user_value_update' with a
'previewMode' parameter being false, true or 'reset'.

This allows to simplify the code.

Part of https://github.com/odoo/odoo/pull/42986
2020-01-09 12:50:22 +00:00
qsm-odoo c197d3f8bf [FIX] web_editor: properly combine we-colorpicker Class attributes
Part of https://github.com/odoo/odoo/pull/42986
2020-01-09 12:50:10 +00:00