This commit is contained in:
Scott Erickson 2014-02-16 12:51:20 -08:00
parent 1f7cea4e54
commit bbe5399a97
3 changed files with 12 additions and 11 deletions

View file

@ -16,18 +16,18 @@ module.exports.genericFailure = (jqxhr) ->
error = module.exports.parseServerError(jqxhr.responseText)
message = error.message
message = error.property + ' ' + message if error.property
res = errorModalTemplate(
status:jqxhr.status
statusText:jqxhr.statusText
message: message
)
console.warn(jqxhr.status, jqxhr.statusText, error)
existingForm = $('.form-inline:visible:first')
existingForm = $('.form:visible:first')
if existingForm[0]
missingErrors = applyErrorsToForm(existingForm, [error])
for error in missingErrors
existingForm.append($('<div class="alert"></div>').text(error.message))
else
res = errorModalTemplate(
status:jqxhr.status
statusText:jqxhr.statusText
message: message
)
showErrorModal(res)
module.exports.backboneFailure = (model, jqxhr, options) ->

View file

@ -144,12 +144,14 @@ module.exports = class CocoView extends Backbone.View
# Loading ModalViews
enableModalInProgress: (modal) ->
$('> div', modal).hide()
$('.wait', modal).show()
el = modal.find('.modal-content')
el.find('> div', modal).hide()
el.find('.wait', modal).show()
disableModalInProgress: (modal) ->
$('> div', modal).show()
$('.wait', modal).hide()
el = modal.find('.modal-content')
el.find('> div', modal).show()
el.find('.wait', modal).hide()
# Subscriptions

View file

@ -36,7 +36,6 @@ module.exports = class LoginModalView extends View
loginAccount: (e) =>
forms.clearFormAlerts(@$el)
userObject = forms.formToObject @$el
# res = validateUser(userObject)
res = tv4.validateMultiple userObject, User.schema.attributes
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
@enableModalInProgress(@$el) # TODO: part of forms