Fixed multi form values.

This commit is contained in:
Martin Edenhofer 2013-02-22 00:07:12 +01:00
parent aa9a8d2d69
commit 093f1df438

View file

@ -28,13 +28,16 @@ class App.SettingsAreaItem extends App.Controller
@render() @render()
render: => render: =>
# defaults # defaults
directValue = 0 directValue = 0
directData = undefined
for item in @setting.options['form'] for item in @setting.options['form']
directValue = +1 directValue = +1
directData = @setting.state.value[item.name]
if directValue > 1 if directValue > 1
item['default'] = @setting.state.value[item.name] item['default'] = directData
else else
item['default'] = @setting.state.value item['default'] = @setting.state.value
@ -55,10 +58,12 @@ class App.SettingsAreaItem extends App.Controller
update: (e) => update: (e) =>
e.preventDefault() e.preventDefault()
params = @formParam(e.target) params = @formParam(e.target)
@log 'submit', @setting, params, e.target, typeof @setting.state.value
directValue = 0 directValue = 0
directData = undefined
for item in @setting.options['form'] for item in @setting.options['form']
directValue = +1 directValue = +1
directData = params[item.name]
if directValue > 1 if directValue > 1
state = { state = {
@ -66,7 +71,7 @@ class App.SettingsAreaItem extends App.Controller
} }
else else
state = { state = {
value: params[@setting.name] value: directData
} }
@setting['state'] = state @setting['state'] = state