[FIX] website_form, *: remove "Shown on mobile" opt for hidden fields
*: website Part of https://github.com/odoo/odoo/pull/47949 task-2011583
This commit is contained in:
@@ -2587,6 +2587,21 @@ options.registry.ScrollButton = options.Class.extend({
|
||||
},
|
||||
});
|
||||
|
||||
options.registry.MobileVisibility = options.Class.extend({
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async _computeVisibility() {
|
||||
// Same as default but overridden by other apps
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
UrlPickerUserValueWidget: UrlPickerUserValueWidget,
|
||||
FontFamilyPickerUserValueWidget: FontFamilyPickerUserValueWidget,
|
||||
|
||||
@@ -481,7 +481,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Mobile display options -->
|
||||
<div data-js="MobileVisibility" data-option-name="showMobile" data-selector="section .row > div"
|
||||
<div data-js="MobileVisibility" data-selector="section .row > div"
|
||||
data-exclude=".s_col_no_resize.row > div">
|
||||
<we-checkbox string="Shown On Mobile" data-show-on-mobile="true" data-no-preview="true"/>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ odoo.define('website_form_editor', function (require) {
|
||||
const core = require('web.core');
|
||||
const FormEditorRegistry = require('website_form.form_editor_registry');
|
||||
const options = require('web_editor.snippets.options');
|
||||
require('website.editor.snippets.options');
|
||||
|
||||
const qweb = core.qweb;
|
||||
const _t = core._t;
|
||||
@@ -1149,4 +1150,21 @@ options.registry.WebsiteFormSubmitRequired = DisableOverlayButtonOption.extend({
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
|
||||
// Disable "Shown on Mobile" option if for an hidden field
|
||||
options.registry.MobileVisibility.include({
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async _computeVisibility() {
|
||||
// Same as default but overridden by other apps
|
||||
return await this._super(...arguments)
|
||||
&& !this.$target.hasClass('s_website_form_field_hidden');
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user