[REF] web_editor, *: review data-js + data-option-name duplicate
*: mass_mailing, website Commit [1] introduced data-option-name allowing to name snippet options without data-js so that their automatic snippet-option-XXX class was not snippet-option-undefined. This was indeed useful to target specific options in tours. The attribute is however a complete duplicate of data-js (if you use one or the other, it does exactly the same thing). Indeed, you can define a data-js without a linked JS class (as it is already done). And if you define both expecting the class using data-option-name but the JS used from data-js that won't be the case, data-option-name is simply ignored. This removes data-option-name. This prepares refactorings that will be done in the future: - The way to define option in XML will be reviewed (probably client side definitions, probably OWL templates). - Adding data-js will probably require a JS class to exist, but all option definitions of Odoo will declare one to ease extensions and stable fixes. Those are theoretical at this point though. This commit main focus is simplifying the code. [1]: https://github.com/odoo/odoo/commit/7b0a147cd43e8e890ebe5a882292a69a5c8c90ac closes odoo/odoo#103988 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -423,7 +423,7 @@
|
||||
</we-button-group>
|
||||
</div>
|
||||
|
||||
<div data-option-name="minHeight" data-selector=".o_mail_snippet_general" data-exclude=".o_mail_snippet_general .row > div *">
|
||||
<div data-selector=".o_mail_snippet_general" data-exclude=".o_mail_snippet_general .row > div *">
|
||||
<we-button-group string="Height">
|
||||
<we-button data-name="minheight_auto_opt" data-select-class="" title="Fit content">Auto</we-button>
|
||||
<we-button data-select-class="o_height_400" title="400px">50%</we-button>
|
||||
@@ -538,7 +538,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Vertical Alignment -->
|
||||
<div data-option-name="vAlignment" id="row_valign_snippet_option" data-selector=".s_text_image, .s_image_text, .s_three_columns, s_mail_block_event" data-target=".row">
|
||||
<div id="row_valign_snippet_option" data-selector=".s_text_image, .s_image_text, .s_three_columns, s_mail_block_event" data-target=".row">
|
||||
<we-button-group string="Vert. Alignment" title="Vertical Alignment">
|
||||
<we-button title="Align Top"
|
||||
data-select-class="align-items-start"
|
||||
|
||||
@@ -2683,7 +2683,11 @@ var SnippetsMenu = Widget.extend({
|
||||
const excludeParent = $style.attr('id') === "so_content_addition" ? snippetAdditionDropIn : '';
|
||||
var target = $style.data('target');
|
||||
var noCheck = $style.data('no-check');
|
||||
var optionID = $style.data('js') || $style.data('option-name'); // used in tour js as selector
|
||||
// Note that the optionID will be used to add a class
|
||||
// `snippet-option-XXX` (XXX being the optionID) on the related
|
||||
// option DOM. This is used in JS tours. The data-js attribute can
|
||||
// be used without a corresponding JS class being defined.
|
||||
const optionID = $style.data('js');
|
||||
var option = {
|
||||
'option': optionID,
|
||||
'base_selector': selector,
|
||||
|
||||
@@ -538,7 +538,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Vertical Alignment -->
|
||||
<div data-option-name="vAlignment" id="row_valign_snippet_option" data-selector=".s_text_image, .s_image_text, .s_three_columns" data-target=".row">
|
||||
<div id="row_valign_snippet_option" data-selector=".s_text_image, .s_image_text, .s_three_columns" data-target=".row">
|
||||
<we-button-group class="o_we_sublevel_1" string="Vert. Alignment" title="Vertical Alignment" data-dependencies="normal_mode">
|
||||
<we-button title="Align Top"
|
||||
data-select-class="align-items-start"
|
||||
|
||||
Reference in New Issue
Block a user