Improved generic setting widget.
This commit is contained in:
parent
a52a74a915
commit
7759cd617b
1 changed files with 12 additions and 5 deletions
|
@ -29,8 +29,11 @@ class App.SettingsAreaItem extends App.Controller
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
# defaults
|
# defaults
|
||||||
|
directValue = 0
|
||||||
for item in @setting.options['form']
|
for item in @setting.options['form']
|
||||||
if typeof @setting.state.value is 'object'
|
directValue = +1
|
||||||
|
|
||||||
|
if directValue > 1
|
||||||
item['default'] = @setting.state.value[item.name]
|
item['default'] = @setting.state.value[item.name]
|
||||||
else
|
else
|
||||||
item['default'] = @setting.state.value
|
item['default'] = @setting.state.value
|
||||||
|
@ -53,7 +56,11 @@ class App.SettingsAreaItem extends App.Controller
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
@log 'submit', @setting, params, e.target, typeof @setting.state.value
|
@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 = {
|
state = {
|
||||||
value: params
|
value: params
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue