Disabled CocoModel noty errors for form submissions that handle these errors.

This commit is contained in:
Scott Erickson 2014-05-22 11:22:52 -07:00
parent 8604a0ed3c
commit 104deb2ab8
2 changed files with 3 additions and 0 deletions

View file

@ -15,6 +15,7 @@ init = ->
module.exports.createUser = (userObject, failure=backboneFailure, nextURL=null) ->
user = new User(userObject)
user.notyErrors = false
user.save({}, {
error: (model,jqxhr,options) ->
error = parseServerError(jqxhr.responseText)

View file

@ -6,6 +6,7 @@ class CocoModel extends Backbone.Model
loaded: false
loading: false
saveBackups: false
notyErrors: true
@schema: null
getMe: -> @me or @me = require('lib/auth').me
@ -77,6 +78,7 @@ class CocoModel extends Backbone.Model
@clearBackup()
options.error = (model, res) =>
error(@, res) if error
return unless @notyErrors
errorMessage = "Error saving #{@get('name') ? @type()}"
console.error errorMessage, res.responseJSON
noty text: "#{errorMessage}: #{res.status} #{res.statusText}", layout: 'topCenter', type: 'error', killer: false, timeout: 10000