diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index cda84a6a0ea..af2973cede1 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -2013,9 +2013,7 @@ const RangeUserValueWidget = UnitUserValueWidget.extend({ [min, max] = [max, min]; this.input.classList.add('o_we_inverted_range'); } - this.input.setAttribute('min', min); - this.input.setAttribute('max', max); - this.input.setAttribute('step', step); + this._setInputAttributes(min, max, step); this.containerEl.appendChild(this.input); }, @@ -2023,12 +2021,34 @@ const RangeUserValueWidget = UnitUserValueWidget.extend({ // Public //-------------------------------------------------------------------------- + /** + * @override + */ + loadMethodsData(validMethodNames) { + this._super(...arguments); + for (const methodName of this._methodsNames) { + const possibleValues = this._methodsParams.optionsPossibleValues[methodName]; + if (possibleValues.length > 1) { + this._setInputAttributes(0, possibleValues.length - 1, 1); + break; + } + } + }, /** * @override */ async setValue(value, methodName) { await this._super(...arguments); - this.input.value = this._value; + const possibleValues = this._methodsParams.optionsPossibleValues[methodName]; + this.input.value = possibleValues.length > 1 ? possibleValues.indexOf(value) : this._value; + }, + /** + * @override + */ + getValue(methodName) { + const value = this._super(...arguments); + const possibleValues = this._methodsParams.optionsPossibleValues[methodName]; + return possibleValues.length > 1 ? possibleValues[+value] : value; }, //-------------------------------------------------------------------------- @@ -2042,6 +2062,14 @@ const RangeUserValueWidget = UnitUserValueWidget.extend({ this._value = ev.target.value; this._onUserValueChange(ev); }, + /** + * @private + */ + _setInputAttributes(min, max, step) { + this.input.setAttribute('min', min); + this.input.setAttribute('max', max); + this.input.setAttribute('step', step); + }, }); const SelectPagerUserValueWidget = SelectUserValueWidget.extend({ diff --git a/addons/website/views/snippets/s_image_gallery.xml b/addons/website/views/snippets/s_image_gallery.xml index 1cf19d560f1..8e8b27fd50b 100644 --- a/addons/website/views/snippets/s_image_gallery.xml +++ b/addons/website/views/snippets/s_image_gallery.xml @@ -97,12 +97,9 @@ 6 12 - - None - Small - Medium - Big - + Standard Thumbnails