Moved to build in confirm dialog.
This commit is contained in:
parent
8a4c3388e4
commit
374b4315f0
2 changed files with 26 additions and 3 deletions
|
@ -167,7 +167,9 @@ class App.ControllerGenericIndex extends App.ControllerContent
|
||||||
|
|
||||||
destroy: (e) ->
|
destroy: (e) ->
|
||||||
item = $(e.target).item( App[ @genericObject ] )
|
item = $(e.target).item( App[ @genericObject ] )
|
||||||
item.destroy() if confirm('Sure?')
|
new DestroyConfirm(
|
||||||
|
item: item
|
||||||
|
)
|
||||||
|
|
||||||
new: (e) ->
|
new: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -176,6 +178,27 @@ class App.ControllerGenericIndex extends App.ControllerContent
|
||||||
genericObject: @genericObject
|
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
|
class App.ControllerLevel2 extends App.ControllerContent
|
||||||
events:
|
events:
|
||||||
'click [data-toggle="tabnav"]': 'toggle',
|
'click [data-toggle="tabnav"]': 'toggle',
|
||||||
|
|
|
@ -184,8 +184,8 @@ class ManageTest < TestCase
|
||||||
:value => 2,
|
:value => 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'accept',
|
:execute => 'click',
|
||||||
:element => :alert,
|
:css => '.modal .submit',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
|
|
Loading…
Reference in a new issue