Moved to build in confirm dialog.

This commit is contained in:
Martin Edenhofer 2013-09-02 21:00:08 +02:00
parent 8a4c3388e4
commit 374b4315f0
2 changed files with 26 additions and 3 deletions

View file

@ -167,7 +167,9 @@ class App.ControllerGenericIndex extends App.ControllerContent
destroy: (e) ->
item = $(e.target).item( App[ @genericObject ] )
item.destroy() if confirm('Sure?')
new DestroyConfirm(
item: item
)
new: (e) ->
e.preventDefault()
@ -176,6 +178,27 @@ class App.ControllerGenericIndex extends App.ControllerContent
genericObject: @genericObject
)
class DestroyConfirm extends App.ControllerModal
constructor: ->
super
@render()
render: ->
@html App.view('modal')(
title: 'Confirm'
message: 'Sure to delete this object?'
cancel: true
button: 'Yes'
)
@modalShow(
backdrop: true,
keyboard: true,
)
submit: (e) =>
@modalHide()
@item.destroy()
class App.ControllerLevel2 extends App.ControllerContent
events:
'click [data-toggle="tabnav"]': 'toggle',

View file

@ -184,8 +184,8 @@ class ManageTest < TestCase
:value => 2,
},
{
:execute => 'accept',
:element => :alert,
:execute => 'click',
:css => '.modal .submit',
},
{
:execute => 'wait',