<div id="sliverList">
</div>
+<div id="rightSide">
+<div id="errorBox">
+</div>
+
<div id="detailBox">
<button id="close-detail-view">Close Detail View</button>
<div id="detail"></div>\r
<div id="linkedObjs1"></div>
<div id="linkedObjs2"></div>
</div>
+</div>
+
+<script type="text/template" id="test-error-template">
+ <button id="close-error-box">Close Error Message</button>
+ <h3>An error has occurred.</h3>
+ <table class="test-error-table">
+ <tr><td>Code:</td><td><%= status %></td></tr>
+ <tr><td>Message:</td><td><%= statusText %></td></tr>
+ </table>
+</script>
<!-- Deployment -->
},
});
+TestApp.hideError = function(result) {
+ $("#errorBox").hide();
+};
+
+TestApp.showError = function(result) {
+ $("#errorBox").show();
+ $("#errorBox").html(_.template($("#test-error-template").html())(result));
+ $('#close-error-box').unbind().bind('click', function() {
+ $('#errorBox').hide();
+ });
+};
+
TestApp.on("start", function() {
var objs = ['deployment', 'image', 'networkTemplate', 'network', 'node', 'service', 'site', 'slice', 'sliver'];
this.dirty = true;\r
},\r
\r
+ saveError: function(model, result, xhr) {\r
+ TestApp.showError(result);\r
+ },\r
+\r
submitClicked: function(e) {\r
+ TestApp.hideError();\r
e.preventDefault();\r
var data = Backbone.Syphon.serialize(this);\r
- this.model.save(data);\r
+ var thisView = this;\r
+ this.model.save(data, {error: function(model, result, xhr) { thisView.saveError(model, result, xhr); }});\r
this.dirty = false;\r
},\r
});
events: {"click": "changeItem"},
\r
changeItem: function(e) {\r
+ TestApp.hideError();\r
e.preventDefault();\r
e.stopPropagation();\r
\r
xos[collection_name].startPolling();
}
- $('#close-detail-view').bind('click', function() {
+ $('#close-detail-view').unbind().bind('click', function() {
$('#detailBox').hide();
});
- $('#detailBox').hide();
+// $('#detailBox').hide();
+// $('#errorBox').hide();
});
$(document).ready(function(){