Improved generic setting widget.

This commit is contained in:
Martin Edenhofer 2013-02-21 22:10:07 +01:00
parent a52a74a915
commit 7759cd617b

View file

@ -29,11 +29,14 @@ class App.SettingsAreaItem extends App.Controller
render: =>
# defaults
directValue = 0
for item in @setting.options['form']
if typeof @setting.state.value is 'object'
item['default'] = @setting.state.value[item.name]
else
item['default'] = @setting.state.value
directValue = +1
if directValue > 1
item['default'] = @setting.state.value[item.name]
else
item['default'] = @setting.state.value
# form
@configure_attributes = @setting.options['form']
@ -53,7 +56,11 @@ class App.SettingsAreaItem extends App.Controller
e.preventDefault()
params = @formParam(e.target)
@log 'submit', @setting, params, e.target, typeof @setting.state.value
if typeof @setting.state.value is 'object'
directValue = 0
for item in @setting.options['form']
directValue = +1
if directValue > 1
state = {
value: params
}