diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee
index 9afbad5a1..1a8841d32 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee
@@ -443,6 +443,8 @@ class App.ControllerForm extends App.Controller
if item.type is 'boolean'
if value is ''
value = undefined
+ else if value is undefined
+ value = false
else if value is 'true'
value = true
else if value is 'false'
@@ -463,21 +465,31 @@ class App.ControllerForm extends App.Controller
# verify if we have not checked checkboxes
uncheckParam = {}
lookupForm.find('input[type=checkbox]').each( (index) ->
+ type = $(@).data('field-type')
checked = $(@).attr('checked')
name = $(@).attr('name')
if name && !checked && (!(name of param) || param[name] is '')
if !(name of uncheckParam)
- uncheckParam[name] = undefined
+ if type is 'boolean'
+ uncheckParam[name] = false
+ else
+ uncheckParam[name] = undefined
else
uncheckParam[name] = []
+ true
)
# verify if we have not checked radios
lookupForm.find('input[type=radio]').each( (index) ->
+ type = $(@).data('field-type')
checked = $(@).attr('checked')
name = $(@).attr('name')
if name && !checked && !(name of param)
- uncheckParam[name] = undefined
+ if type is 'boolean'
+ uncheckParam[name] = false
+ else
+ uncheckParam[name] = undefined
+ true
)
# apply empty checkboxes & radio values to params
diff --git a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee
index 80d61840b..271ad8cd7 100644
--- a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee
+++ b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee
@@ -134,6 +134,17 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
init = false
if params && !params.id
init = true
+
+ data = objects[object]
+ if init
+ for role, screenOptions of data
+ for screen, options of screenOptions
+ for key, defaultValue of options
+ params.screens ||= {}
+ params.screens[screen] ||= {}
+ params.screens[screen][role] ||= {}
+ params.screens[screen][role][key] = defaultValue
+
item = $(App.view('object_manager/screens')(
attribute: attribute
data: objects[object]
diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee
index b0f1315db..141cb5ae1 100644
--- a/app/assets/javascripts/app/models/_application_model.coffee
+++ b/app/assets/javascripts/app/models/_application_model.coffee
@@ -237,8 +237,8 @@ set new attributes of model (remove already available attributes)
attributesNew = {}
if screen
for attribute in attributes
- if attribute && attribute.screen && attribute.screen[ screen ] && !_.isEmpty(attribute.screen[ screen ])
- for item, value of attribute.screen[ screen ]
+ if attribute && attribute.screen && attribute.screen[screen] && (!_.isEmpty(attribute.screen[screen]) && (attribute.screen[screen].shown is true || attribute.screen[screen].shown is undefined))
+ for item, value of attribute.screen[screen]
attribute[item] = value
attributesNew[ attribute.name ] = attribute
diff --git a/app/assets/javascripts/app/views/object_manager/screens.jst.eco b/app/assets/javascripts/app/views/object_manager/screens.jst.eco
index 1c9337972..ebf8f3dbd 100644
--- a/app/assets/javascripts/app/views/object_manager/screens.jst.eco
+++ b/app/assets/javascripts/app/views/object_manager/screens.jst.eco
@@ -20,7 +20,7 @@
<%= screen %>