Got bootstrap modal alert working, but not sure if it is the right approach. It looks different than the confirmation window.
parent
49863e70ae
commit
18e319379e
|
@ -63,7 +63,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.inputError {
|
.inputError {
|
||||||
border: 1px solid red !important;
|
border: 1px solid #b94a48 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.brand {
|
a.brand {
|
||||||
|
@ -107,4 +107,10 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div id="modalAlert" class="modal hide fade">
|
||||||
|
<div class="modal-body"></div>
|
||||||
|
<div class="modal-footer"><button class="btn primary" type="button" onclick="$('#modalAlert').modal('hide');">OK</button></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="wrap">
|
<div id="wrap">
|
|
@ -76,13 +76,25 @@ var SystemScopeView = Backbone.View.extend({
|
||||||
|
|
||||||
this.model.destroy({
|
this.model.destroy({
|
||||||
success:function () {
|
success:function () {
|
||||||
|
|
||||||
self.$el.fadeTo("fast", 0.00, function () { //fade
|
self.$el.fadeTo("fast", 0.00, function () { //fade
|
||||||
$(this).slideUp("fast", function () { //slide up
|
$(this).slideUp("fast", function () { //slide up
|
||||||
$(this).remove(); //then remove from the DOM
|
$(this).remove(); //then remove from the DOM
|
||||||
app.systemScopeListView.togglePlaceholder();
|
app.systemScopeListView.togglePlaceholder();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
error:function () {
|
||||||
|
|
||||||
|
//Display an alert with an error message
|
||||||
|
$('#modalAlert div.modal-body').html("<div class='alert alert-error'><strong>Warning!</strong> An error occurred when processing your request. Please refresh the page and try again.</div>");
|
||||||
|
|
||||||
|
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
|
||||||
|
"backdrop" : "static",
|
||||||
|
"keyboard" : true,
|
||||||
|
"show" : true // ensure the modal is shown immediately
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.systemScopeListView.delegateEvents();
|
app.systemScopeListView.delegateEvents();
|
||||||
|
@ -235,6 +247,11 @@ var SystemScopeFormView = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
//TODO: if there are any other known error cases, catch those by response status and display
|
||||||
|
//appropriate messages.
|
||||||
|
$('#value.control-group').before('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>A system error occurred when processing your request.</div>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue