updated scopes to use error handler

pull/1108/head
Justin Richer 2016-07-18 16:57:35 -04:00
parent 838fcb6789
commit 1366db3b48
1 changed files with 5 additions and 33 deletions

View File

@ -123,21 +123,7 @@ var SystemScopeView = Backbone.View.extend({
}); });
}); });
}, },
error:function (error, response) { error:app.errorHandlerView.handleError()
//Pull out the response text.
var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message
$('#modalAlert div.modal-header').html(responseJson.error);
$('#modalAlert div.modal-body').html(responseJson.error_description);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static",
"keyboard" : true,
"show" : true // ensure the modal is shown immediately
});
}
}); });
_self.parentView.delegateEvents(); _self.parentView.delegateEvents();
@ -170,7 +156,7 @@ var SystemScopeListView = Backbone.View.extend({
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ' '<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
); );
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}})) $.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
.done(function() { .done(function() {
$('#loadingbox').sheet('hide'); $('#loadingbox').sheet('hide');
callback(); callback();
@ -194,7 +180,7 @@ var SystemScopeListView = Backbone.View.extend({
'<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> ' '<span class="label" id="loading-scopes">' + $.t('common.scopes') + '</span> '
); );
$.when(this.model.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}})) $.when(this.model.fetch({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
.done(function() { .done(function() {
$('#loadingbox').sheet('hide'); $('#loadingbox').sheet('hide');
_self.render(); _self.render();
@ -296,7 +282,7 @@ var SystemScopeFormView = Backbone.View.extend({
'<span class="label" id="loading-scopes">' + $.t("common.scopes") + '</span> ' '<span class="label" id="loading-scopes">' + $.t("common.scopes") + '</span> '
); );
$.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}})) $.when(this.model.fetchIfNeeded({success:function(e) {$('#loading-scopes').addClass('label-success');}, error:app.errorHandlerView.handleError()}))
.done(function() { .done(function() {
$('#loadingbox').sheet('hide'); $('#loadingbox').sheet('hide');
callback(); callback();
@ -340,21 +326,7 @@ var SystemScopeFormView = Backbone.View.extend({
app.systemScopeList.add(_self.model); app.systemScopeList.add(_self.model);
app.navigate('admin/scope', {trigger: true}); app.navigate('admin/scope', {trigger: true});
}, },
error:function(error, response) { error:app.errorHandlerView.handleError()
//Pull out the response text.
var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message
$('#modalAlert div.modal-header').html(responseJson.error);
$('#modalAlert div.modal-body').html(responseJson.error_description);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static",
"keyboard" : true,
"show" : true // ensure the modal is shown immediately
});
}
}); });
} }