[FIX] web_editor: re-allow hiding column count widget if specified class
When the `s_nb_column_fixed` class is present on the row, it should not be possible to change the number of columns in the "Columns" option (the option is supposed to be hidden). However, since commit [1], this behavior is broken. It happened because the "Columns" option needs to always be displayed in order to display correctly the "Grid" option and this class was therefore ignored. This commit restores this class behavior by hiding only the widget changing the number of columns and not the complete "Columns" option, in order to still be able to toggle between the grid and the normal modes. [1]: https://github.com/odoo/odoo/commit/84d684d8bdf43d3db11defd8174dee44775085c2 task-3369847 closes odoo/odoo#127144 X-original-commit: 8148521f052268877f36947e0533843a25d17b83 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -5266,6 +5266,10 @@ registry.layout_column = SnippetOptionWidget.extend({
|
||||
// were marked as such as they were allowed to have bare content in
|
||||
// the first place.
|
||||
return this.$target.is('.s_allow_columns');
|
||||
} else if (widgetName === "column_count_opt") {
|
||||
// Hide the selectCount widget if the `s_nb_column_fixed` class is
|
||||
// on the row.
|
||||
return !this.$target[0].querySelector(":scope > .row.s_nb_column_fixed");
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
|
||||
@@ -492,7 +492,7 @@
|
||||
<div data-js="layout_column"
|
||||
data-selector="section.s_features_grid, section.s_process_steps"
|
||||
data-target="> *:has(> .row), > .s_allow_columns">
|
||||
<we-select string="Columns" data-no-preview="true">
|
||||
<we-select string="Columns" data-no-preview="true" data-name="column_count_opt">
|
||||
<we-button data-select-count="0" data-name="zero_cols_opt">None</we-button>
|
||||
<we-button data-select-count="1">1</we-button>
|
||||
<we-button data-select-count="2">2</we-button>
|
||||
@@ -528,7 +528,7 @@
|
||||
<we-button data-select-layout="grid" data-name="grid_mode">Grid</we-button>
|
||||
<we-button data-select-layout="normal" data-name="normal_mode">Cols</we-button>
|
||||
</we-button-group>
|
||||
<we-select class="o_grid" data-no-preview="true" data-dependencies="normal_mode">
|
||||
<we-select class="o_grid" data-no-preview="true" data-name="column_count_opt" data-dependencies="normal_mode">
|
||||
<we-button data-select-count="0" data-name="zero_cols_opt">None</we-button>
|
||||
<we-button data-select-count="1">1</we-button>
|
||||
<we-button data-select-count="2">2</we-button>
|
||||
|
||||
Reference in New Issue
Block a user