Updated js files to use results returned from JsonErrorView; factored out markup into modal definition.

pull/306/merge
Amanda Anganes 2013-03-29 12:46:33 -04:00
parent 2265a3f8c3
commit 0f327a772b
6 changed files with 22 additions and 19 deletions

View File

@ -109,7 +109,10 @@
<body> <body>
<div id="modalAlert" class="modal hide fade"> <div id="modalAlert" class="modal hide fade">
<div class="modal-body"></div> <div class="alert alert-error">
<strong>Warning!</strong>
<div class="modal-body"></div>
</div>
<div class="modal-footer"><button class="btn primary" type="button" onclick="$('#modalAlert').modal('hide');">OK</button></div> <div class="modal-footer"><button class="btn primary" type="button" onclick="$('#modalAlert').modal('hide');">OK</button></div>
</div> </div>

View File

@ -38,10 +38,10 @@ var ListWidgetChildView = Backbone.View.extend({
console.log("An error occurred when deleting from a list widget"); console.log("An error occurred when deleting from a list widget");
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",
@ -271,10 +271,10 @@ var BlackListWidgetView = ListWidgetView.extend({
}, },
error:function(error, response) { error:function(error, response) {
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",

View File

@ -165,10 +165,10 @@ var ClientView = Backbone.View.extend({
console.log("An error occurred when deleting a client"); console.log("An error occurred when deleting a client");
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",
@ -502,10 +502,10 @@ var ClientFormView = Backbone.View.extend({
console.log("An error occurred when deleting from a list widget"); console.log("An error occurred when deleting from a list widget");
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",

View File

@ -133,10 +133,10 @@ var ApprovedSiteView = Backbone.View.extend({
error:function (error, response) { error:function (error, response) {
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",

View File

@ -87,10 +87,10 @@ var SystemScopeView = Backbone.View.extend({
error:function (error, response) { error:function (error, response) {
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",
@ -241,7 +241,7 @@ var SystemScopeFormView = Backbone.View.extend({
error:function(error, response) { error:function(error, response) {
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
if (response.status == 409) { if (response.status == 409) {
//Conflict, scope already exists //Conflict, scope already exists
@ -256,7 +256,7 @@ var SystemScopeFormView = Backbone.View.extend({
} }
else { else {
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",

View File

@ -134,10 +134,10 @@ var WhiteListView = Backbone.View.extend({
console.log("An error occurred when deleting a whitelist entry"); console.log("An error occurred when deleting a whitelist entry");
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",
@ -201,10 +201,10 @@ var WhiteListFormView = Backbone.View.extend({
console.log("An error occurred when deleting from a list widget"); console.log("An error occurred when deleting from a list widget");
//Pull out the response text. //Pull out the response text.
var responseText = JSON.parse(response.responseText); var responseJson = JSON.parse(response.responseText);
//Display an alert with an error message //Display an alert with an error message
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong>" + responseText + "</div>"); $('#modalAlert div.modal-body').html(responseJson.errorMessage);
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog $("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
"backdrop" : "static", "backdrop" : "static",