diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index aa254c6e3..e017c7f82 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -206,22 +206,13 @@ class App.TicketOverview extends App.Controller article: article ) ticket.article = article - ticket.ajax().update( - ticket.attributes() - # this option will prevent callbacks and invalid data states in case of an error - failResponseNoTrigger: true + ticket.save( done: (r) => @batchCountIndex++ # refresh view after all tickets are proceeded if @batchCountIndex == @batchCount App.Event.trigger('overview:fetch') - fail: (record, settings, details) -> - console.log('record, settings, details', record, settings, details) - App.Event.trigger('notify', { - type: 'error' - msg: App.i18n.translateContent('Bulk action stopped %s!', error) - }) ) return @@ -234,21 +225,13 @@ class App.TicketOverview extends App.Controller ticket.owner_id = id if !_.isEmpty(groupId) ticket.group_id = groupId - ticket.ajax().update( - ticket.attributes() - # this option will prevent callbacks and invalid data states in case of an error - failResponseNoTrigger: true + ticket.save( done: (r) => @batchCountIndex++ # refresh view after all tickets are proceeded if @batchCountIndex == @batchCount App.Event.trigger('overview:fetch') - fail: (record, settings, details) -> - App.Event.trigger('notify', { - type: 'error' - msg: App.i18n.translateContent('Bulk action stopped %s!', settings.error) - }) ) return @@ -259,21 +242,13 @@ class App.TicketOverview extends App.Controller #console.log "perform action #{action} with id #{id} on ", $(item).val() ticket = App.Ticket.find($(item).val()) ticket.group_id = id - ticket.ajax().update( - ticket.attributes() - # this option will prevent callbacks and invalid data states in case of an error - failResponseNoTrigger: true + ticket.save( done: (r) => @batchCountIndex++ # refresh view after all tickets are proceeded if @batchCountIndex == @batchCount App.Event.trigger('overview:fetch') - fail: (record, settings, details) -> - App.Event.trigger('notify', { - type: 'error' - msg: App.i18n.translateContent('Bulk action stopped %s!', error) - }) ) return diff --git a/app/assets/javascripts/app/lib/spine/ajax.coffee b/app/assets/javascripts/app/lib/spine/ajax.coffee index f04409b71..491bea7ea 100644 --- a/app/assets/javascripts/app/lib/spine/ajax.coffee +++ b/app/assets/javascripts/app/lib/spine/ajax.coffee @@ -234,12 +234,11 @@ class Singleton extends Base failResponse: (options) => (xhr, statusText, error, settings) => - if options.failResponseNoTrigger isnt true - switch settings.type - when 'POST' then @createFailed() - when 'DELETE' then @destroyFailed() - # add errors to calllback - @record.trigger('ajaxError', @record, xhr, statusText, error, settings) + switch settings.type + when 'POST' then @createFailed() + when 'DELETE' then @destroyFailed() + # add errors to calllback + @record.trigger('ajaxError', @record, xhr, statusText, error, settings) #options.fail?.call(@record, settings) detailsRaw = xhr.responseText @@ -247,8 +246,7 @@ class Singleton extends Base details = JSON.parse(detailsRaw) options.fail?.call(@record, settings, details) - if options.failResponseNoTrigger isnt true - @record.trigger('destroy', @record) + @record.trigger('destroy', @record) # /add errors to calllback createFailed: ->