Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Created January 21, 2014 22:19
Show Gist options
  • Save jakecraige/8549653 to your computer and use it in GitHub Desktop.
Save jakecraige/8549653 to your computer and use it in GitHub Desktop.
EventAssist.EventsController = Em.ArrayController.extend Ea.ErrorFormatter,
actions:
createEvent: ->
event = @get('newEvent')
success = (savedEvent)=>
@transitionToRoute('event.overview', savedEvent)
Ea.get('flash').randAuccess 'success.created.event'
event.save().then success, (response)=>
@setErrors(response)
destroy: (model)->
xhr = model.destroyRecord()
success = (resModel)=>
#debugger
@get('model').removeObject(resModel) if @get('model').contains resModel
Ea.get('flash').randSuccess 'success.deleted'
xhr.then success, ->
Ea.get('flash').randAlert 'error.general'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment