summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/website_form/static/src/snippets/s_website_form/001.scss4
-rw-r--r--addons/website_form/static/src/snippets/s_website_form/options.js11
-rw-r--r--addons/website_form/static/src/xml/website_form_editor.xml2
-rw-r--r--addons/website_form/views/snippets/s_website_form.xml5
-rw-r--r--addons/website_form/views/website_form_templates.xml2
-rw-r--r--addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml4
6 files changed, 17 insertions, 11 deletions
diff --git a/addons/website_form/static/src/snippets/s_website_form/001.scss b/addons/website_form/static/src/snippets/s_website_form/001.scss
index cb0ad2e2c2b..acfaae6f5a1 100644
--- a/addons/website_form/static/src/snippets/s_website_form/001.scss
+++ b/addons/website_form/static/src/snippets/s_website_form/001.scss
@@ -31,6 +31,10 @@
font-weight: 400;
}
+ .s_website_form_dnone {
+ display: none;
+ }
+
// The snippet editor uses padding and not margin.
// This will include bootstrap margin in the dragable y axes
.s_website_form_rows > .form-group {
diff --git a/addons/website_form/static/src/snippets/s_website_form/options.js b/addons/website_form/static/src/snippets/s_website_form/options.js
index d1eb41c14be..44c66f9fe24 100644
--- a/addons/website_form/static/src/snippets/s_website_form/options.js
+++ b/addons/website_form/static/src/snippets/s_website_form/options.js
@@ -433,7 +433,7 @@ options.registry.WebsiteFormEditor = FormEditor.extend({
if (params.isSelect === 'true') {
value = parseInt(value);
}
- this.addHiddenField(value, fieldName);
+ this._addHiddenField(value, fieldName);
},
/**
* Changes the onSuccess event.
@@ -489,7 +489,7 @@ options.registry.WebsiteFormEditor = FormEditor.extend({
case 'selectAction':
return this.activeForm.id;
case 'addActionField': {
- const value = this.$target.find(`.s_website_form_field.d-none input[name="${params.fieldName}"]`).val();
+ const value = this.$target.find(`.s_website_form_dnone input[name="${params.fieldName}"]`).val();
if (value) {
return value;
} else {
@@ -535,7 +535,7 @@ options.registry.WebsiteFormEditor = FormEditor.extend({
if (field.required) {
// Get default value or for many2one fields the first option.
const defaultValue = field.defaultValue || field.records[0].id;
- this.addHiddenField(defaultValue, field.name);
+ this._addHiddenField(defaultValue, field.name);
}
uiFragment.insertBefore(option, firstOption);
});
@@ -544,11 +544,12 @@ options.registry.WebsiteFormEditor = FormEditor.extend({
/**
* Add a hidden field to the form
*
+ * @private
* @param {string} value
* @param {string} fieldName
*/
- addHiddenField: function (value, fieldName) {
- this.$target.find(`.s_website_form_field.d-none:has(input[name="${fieldName}"])`).remove();
+ _addHiddenField: function (value, fieldName) {
+ this.$target.find(`.s_website_form_dnone:has(input[name="${fieldName}"])`).remove();
if (value) {
const hiddenField = qweb.render('website_form.field_hidden', {
field: {
diff --git a/addons/website_form/static/src/xml/website_form_editor.xml b/addons/website_form/static/src/xml/website_form_editor.xml
index f191edc8f39..0d718178300 100644
--- a/addons/website_form/static/src/xml/website_form_editor.xml
+++ b/addons/website_form/static/src/xml/website_form_editor.xml
@@ -24,7 +24,7 @@
<!-- Generic Field Layout -->
<!-- Changes made here needs to be reflected in the different Form view (Contact Us, Jobs, ...) -->
<t t-name="website_form.field">
- <div t-attf-class="form-group s_website_form_field #{field.formatInfo.col or 'col-12'} #{field.custom and 's_website_form_custom' or ''} #{(field.required and 's_website_form_required' or '') or (field.modelRequired and 's_website_form_model_required' or '')} #{field.hidden and 's_website_form_field_hidden' or ''} #{field.dnone and 'd-none' or ''}"
+ <div t-attf-class="form-group s_website_form_field #{field.formatInfo.col or 'col-12'} #{field.custom and 's_website_form_custom' or ''} #{(field.required and 's_website_form_required' or '') or (field.modelRequired and 's_website_form_model_required' or '')} #{field.hidden and 's_website_form_field_hidden' or ''} #{field.dnone and 's_website_form_dnone' or ''}"
t-att-data-type="field.type"
data-name="Field">
<div t-if="field.formatInfo.labelPosition != 'none' and field.formatInfo.labelPosition != 'top'" class="row s_col_no_resize s_col_no_bgcolor">
diff --git a/addons/website_form/views/snippets/s_website_form.xml b/addons/website_form/views/snippets/s_website_form.xml
index 0ab817313ae..4a40732ad6f 100644
--- a/addons/website_form/views/snippets/s_website_form.xml
+++ b/addons/website_form/views/snippets/s_website_form.xml
@@ -50,7 +50,7 @@
</div>
<!-- Add Field -->
- <div data-js="AddField" data-selector=".s_website_form_field">
+ <div data-js="AddField" data-selector=".s_website_form_field" data-exclude=".s_website_form_dnone">
<we-button class="fa fa-fw fa-plus"
title="Add a new field after this one"
data-add-field=""
@@ -58,7 +58,8 @@
</div>
<!-- Field -->
- <div data-js='WebsiteFieldEditor' data-selector=".s_website_form_field" data-drop-near=".s_website_form_field">
+ <div data-js='WebsiteFieldEditor' data-selector=".s_website_form_field"
+ data-exclude=".s_website_form_dnone" data-drop-near=".s_website_form_field">
<we-select data-name="type_opt" string="Type" data-no-preview="true">
<we-title>Custom field</we-title>
<we-button data-custom-field="char">Text</we-button>
diff --git a/addons/website_form/views/website_form_templates.xml b/addons/website_form/views/website_form_templates.xml
index f919f697fd7..4c5c73745a2 100644
--- a/addons/website_form/views/website_form_templates.xml
+++ b/addons/website_form/views/website_form_templates.xml
@@ -57,7 +57,7 @@
</div>
</div>
</div>
- <div class="form-group col-12 s_website_form_field d-none">
+ <div class="form-group col-12 s_website_form_field s_website_form_dnone">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="contact7">Email To</label>
<div class="col-sm">
diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
index b7367dfd77f..94f479b488a 100644
--- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
+++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
@@ -180,7 +180,7 @@
</div>
</div>
</div>
- <div class="form-group col-12 s_website_form_field d-none">
+ <div class="form-group col-12 s_website_form_field s_website_form_dnone">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="recruitment6">Job</label>
<div class="col-sm">
@@ -188,7 +188,7 @@
</div>
</div>
</div>
- <div class="form-group col-12 s_website_form_field d-none">
+ <div class="form-group col-12 s_website_form_field s_website_form_dnone">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="recruitment7">Department</label>
<div class="col-sm">