Skip to content

Commit

Permalink
forcedialog: integrate children of nested fields
Browse files Browse the repository at this point in the history
The current implementation gather the fields of ui elements
that are of type nested (NestedParameter).
However, some UI elements might inherit from NestedParameter, but still
have another type. This commit permits to handle such, but
ducktyping nested ui fields, on the presence of the
attribute fields.
  • Loading branch information
Ion Alberdi committed May 21, 2015
1 parent a63dc6c commit f3ea668
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class forceDialog extends Controller
# prepare default values
prepareFields = (fields) ->
for field in fields
if field.type == 'nested'
if field.fields?
prepareFields(field.fields)
else
field.value = field.default
Expand All @@ -22,7 +22,7 @@ class forceDialog extends Controller
gatherFields = (fields) ->
for field in fields
field.errors = ''
if field.type == 'nested'
if field.fields?
gatherFields(field.fields)
else
params[field.fullName] = field.value
Expand All @@ -39,4 +39,4 @@ class forceDialog extends Controller
$rootScope.$apply()

cancel: ->
modal.modal.dismiss()
modal.modal.dismiss()

0 comments on commit f3ea668

Please sign in to comment.