Skip to content

Commit

Permalink
[skip] Extracted endEdit from cancelEdit so that the two actions …
Browse files Browse the repository at this point in the history
…can be differentiated (4m)
  • Loading branch information
boblail committed Feb 8, 2016
1 parent dd4644d commit 384a2e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vendor/assets/javascripts/neat/model_editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class window.Neat.ModelEditor extends Backbone.View
template: -> if @inEdit() then @editTemplate else @showTemplate

cancelEdit: (e)->
e?.preventDefault()
e?.stopImmediatePropagation()
@endEdit()

endEdit: (e)->
e?.preventDefault()
e?.stopImmediatePropagation()
if @inEdit()
Expand Down Expand Up @@ -84,7 +89,7 @@ class window.Neat.ModelEditor extends Backbone.View
@onSaveSuccess()
error: _.bind(@onSaveError, @)

@cancelEdit()
@endEdit()

okToSave: (attributes)->
true
Expand Down Expand Up @@ -120,7 +125,7 @@ class window.Neat.ModelEditor extends Backbone.View
wait: true
success: => @onDestroySuccess
error: _.bind(@onSaveError, @)
@cancelEdit()
@endEdit()

confirmDestroy: (resource, callback)->
if confirm("Delete this #{resource}?")
Expand Down

0 comments on commit 384a2e6

Please sign in to comment.