diff --git a/__openerp__.py b/__openerp__.py
index 227bcfd97b4..ed2052aa2ab 100644
--- a/__openerp__.py
+++ b/__openerp__.py
@@ -1,5 +1,5 @@
{
- 'name': 'Website Form Editor',
+ 'name': 'Website Form Builder',
'category': 'Website',
'summary': 'Build custom web forms using the website builder',
'version': '1.0',
diff --git a/static/src/js/website_form_editor.js b/static/src/js/website_form_editor.js
index bbb2f646625..9412bb84df7 100644
--- a/static/src/js/website_form_editor.js
+++ b/static/src/js/website_form_editor.js
@@ -27,9 +27,19 @@ odoo.define('website_form_editor', function (require) {
self.$modal.appendTo('body');
// Process the modal on_save then hide it
- self.$modal.find("#modal-save").on('click', function(){
- on_save();
- self.$modal.modal('hide');
+ self.$modal.find("#modal-save").on('click', function(e){
+ if (self.$modal.find("form")[0].checkValidity()) {
+ on_save();
+ self.$modal.modal('hide');
+ } else {
+ _.each(self.$modal.find('input'), function(input) {
+ var $field = $(input).closest('.form-field');
+ $field.removeClass('has-error');
+ if (!input.checkValidity()) {
+ $field.addClass('has-error');
+ }
+ });
+ }
});
// Destroy the modal when it is closed, as we will use many of them
@@ -122,7 +132,7 @@ odoo.define('website_form_editor', function (require) {
var success_page = qweb.render("website_form_editor.field_char", {
field: {
name: 'success_page',
- string: 'Success Page',
+ string: 'Thank You Page',
value: self.$target.attr('data-success_page')
}
});
@@ -151,6 +161,15 @@ odoo.define('website_form_editor', function (require) {
self.$modal.find("[name='model_selection']").on('change', function() {
self.toggle_email_to();
});
+
+ // On modal close, if there is no data-model, it means
+ // that the user refused to configure the form on the
+ // first modal, so we remove the snippet.
+ self.$modal.on('hidden.bs.modal', function (e) {
+ if (!self.$target.attr('data-model_name')){
+ self.$target.remove();
+ }
+ });
})
},
@@ -186,10 +205,6 @@ odoo.define('website_form_editor', function (require) {
self.append_field(selected_field);
}
);
-
- self.$modal.find("[name='field_selection']").on('change', function() {
- console.log('changed');
- });
});
},
@@ -290,7 +305,7 @@ odoo.define('website_form_editor', function (require) {
model: field.relation,
method: 'search_read',
args: [
- field.domain,
+ // field.domain, TODO: Handle field domains
['display_name']
],
kwargs:{"context": base.get_context()}
diff --git a/static/src/js/website_form_editor_tour.js b/static/src/js/website_form_editor_tour.js
index 6e22cb65345..56934cddf5b 100644
--- a/static/src/js/website_form_editor_tour.js
+++ b/static/src/js/website_form_editor_tour.js
@@ -51,7 +51,7 @@ odoo.define('website_form_editor.tour', function(require) {
title: "Click on Save",
element: ".modal-footer #modal-save"
},
- // Add the display_name field
+ // Add the subject field
{
title: "Click on Form snippet",
element: ".s_website_form[data-model_name]"
@@ -65,19 +65,19 @@ odoo.define('website_form_editor.tour', function(require) {
element: ".oe_overlay_options:visible li[data-website_form_field_modal] a"
},
{
- title: "Select the display_name field",
+ title: "Select the subject field",
element: "select[name='field_selection']",
- sampleText: "display_name"
+ sampleText: "subject"
},
{
title: "Click on Save",
element: ".modal-footer #modal-save"
},
- // Customize display_name field
+ // Customize subject field
{
title: "Change the label",
- element: ".control-label[for='display_name']",
+ element: ".control-label[for='subject']",
sampleText: "Name"
},
{
@@ -91,7 +91,7 @@ odoo.define('website_form_editor.tour', function(require) {
{
title: "Check the resulting field",
waitFor: ".form-field.o_website_form_required_custom" +
- ":has(input[type=text][name=display_name][required])" +
+ ":has(input[type=text][name=subject][required])" +
":has(label:contains('Name'))"
},
@@ -109,7 +109,7 @@ odoo.define('website_form_editor.tour', function(require) {
element: ".oe_overlay_options:visible li[data-website_form_field_modal] a"
},
{
- title: "Select the display_name field",
+ title: "Select the subject field",
element: "select[name='field_selection']",
sampleText: "record_name"
},
@@ -154,7 +154,7 @@ odoo.define('website_form_editor.tour', function(require) {
element: ".oe_overlay_options:visible li[data-website_form_field_modal] a"
},
{
- title: "Select the display_name field",
+ title: "Select the subject field",
element: "select[name='field_selection']",
sampleText: "body_html"
},
@@ -163,7 +163,7 @@ odoo.define('website_form_editor.tour', function(require) {
element: ".modal-footer #modal-save"
},
- // Customize display_name field
+ // Customize subject field
{
title: "Change the label",
element: ".control-label[for='body_html']",
@@ -434,7 +434,7 @@ odoo.define('website_form_editor.tour', function(require) {
element: ".oe_overlay_options:visible li[data-website_form_field_modal] a"
},
{
- title: "Select the display_name field",
+ title: "Select the subject field",
element: "select[name='field_selection']",
sampleText: "attachment_ids"
},
@@ -486,7 +486,7 @@ odoo.define('website_form_editor.tour', function(require) {
title: "Try to send empty form",
waitFor: "form[data-model_name='mail.mail']" +
"[data-success_page='']" +
- ":has(.form-field:has(label:contains('Name')):has(input[type='text'][name='display_name'][required]))" +
+ ":has(.form-field:has(label:contains('Name')):has(input[type='text'][name='subject'][required]))" +
":has(.form-field:has(label:contains('Awesome Label')):hidden)" +
":has(.form-field:has(label:contains('Your Message')):has(textarea[name='body_html'][required]))" +
":has(.form-field:has(label:contains('Products')):has(input[type='checkbox'][name='Products'][value='Iphone'][required]))" +
@@ -513,7 +513,7 @@ odoo.define('website_form_editor.tour', function(require) {
":has(.form-field:has(label:contains('Service')):not(.has-error))" +
":has(.form-field:has(label:contains('State')):not(.has-error))" +
":has(.form-field:has(label:contains('Invoice Scan')):not(.has-error))",
- element: "input[name=display_name]",
+ element: "input[name=subject]",
sampleText: "Jane Smith"
},
{
diff --git a/static/src/xml/website_form_editor.xml b/static/src/xml/website_form_editor.xml
index ebea1000ad9..1d6ba3453aa 100644
--- a/static/src/xml/website_form_editor.xml
+++ b/static/src/xml/website_form_editor.xml
@@ -99,6 +99,18 @@
+
+
+
+
+
+
+
diff --git a/views/snippet_options.xml b/views/snippet_options.xml
index e46ee32375c..c2c5ad40e7e 100644
--- a/views/snippet_options.xml
+++ b/views/snippet_options.xml
@@ -22,6 +22,8 @@
Radio Buttons
Selection
Multiple Checkboxes
+ Date
+ Date & Time
File Upload
@@ -68,6 +70,9 @@
+
+
+