Added required and callback also for new objects.
This commit is contained in:
parent
7685d18709
commit
d2390521aa
2 changed files with 9 additions and 6 deletions
|
@ -17,6 +17,7 @@ class App.ControllerGenericNew extends App.ControllerModal
|
|||
el: @el.find('#object_new'),
|
||||
model: @genericObject,
|
||||
params: @item,
|
||||
required: @required,
|
||||
autofocus: true,
|
||||
)
|
||||
|
||||
|
@ -46,6 +47,8 @@ class App.ControllerGenericNew extends App.ControllerModal
|
|||
# save object
|
||||
object.save(
|
||||
success: =>
|
||||
if @callback
|
||||
@callback(@item)
|
||||
@modalHide()
|
||||
error: =>
|
||||
@log 'errors'
|
||||
|
|
|
@ -263,13 +263,13 @@ class UserNew extends App.ControllerModal
|
|||
ui = @
|
||||
user.save(
|
||||
success: ->
|
||||
ui.modalHide()
|
||||
realname = @.firstname + ' ' + @.lastname
|
||||
$('#create_customer_id').val(@.id)
|
||||
$('#create_customer_id_autocompletion').val(realname)
|
||||
|
||||
realname = @displayName()
|
||||
$('#create_customer_id').val( @id )
|
||||
$('#create_customer_id_autocompletion').val( realname )
|
||||
|
||||
# start customer info controller
|
||||
ui.userInfo( user_id: @.id )
|
||||
ui.userInfo( user_id: @id )
|
||||
ui.modalHide()
|
||||
error: ->
|
||||
ui.modalHide()
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue