success box
diff --git a/planetstack/core/xoslib/static/css/test.css b/planetstack/core/xoslib/static/css/test.css
index 51b7407..e5b1b80 100644
--- a/planetstack/core/xoslib/static/css/test.css
+++ b/planetstack/core/xoslib/static/css/test.css
@@ -12,7 +12,7 @@
padding: 10px;
border: 2px solid;
background-color: #f0f0f0;
- margin-bottom:50px;
+ margin-bottom:30px;
display:none;
}
@@ -20,7 +20,15 @@
padding: 10px;
border: 2px solid;
background-color: #f00000;
- margin-bottom:50px;
+ margin-bottom:30px;
+ display:none;
+}
+
+#successBox {
+ padding: 10px;
+ border: 2px solid;
+ background-color: #00f000;
+ margin-bottom:30px;
display:none;
}
diff --git a/planetstack/core/xoslib/static/js/test.js b/planetstack/core/xoslib/static/js/test.js
index fff0df3..ff681e8 100644
--- a/planetstack/core/xoslib/static/js/test.js
+++ b/planetstack/core/xoslib/static/js/test.js
@@ -34,6 +34,15 @@
TestApp.hideError = function(result) {
$("#errorBox").hide();
+ $("#successBox").hide();
+};
+
+TestApp.showSuccess = function(result) {
+ $("#successBox").show();
+ $("#successBox").html(_.template($("#test-success-template").html())(result));
+ $('#close-success-box').unbind().bind('click', function() {
+ $('#successBox').hide();
+ });
};
TestApp.showError = function(result) {
@@ -75,12 +84,17 @@
TestApp.showError(result);
},
+ saveSuccess: function(model, result, xhr) {
+ TestApp.showSuccess({status: xhr.xhr.status, statusText: xhr.xhr.statusText});
+ },
+
submitClicked: function(e) {
TestApp.hideError();
e.preventDefault();
var data = Backbone.Syphon.serialize(this);
var thisView = this;
- this.model.save(data, {error: function(model, result, xhr) { thisView.saveError(model, result, xhr); }});
+ this.model.save(data, {error: function(model, result, xhr) { thisView.saveError(model, result, xhr); },
+ success: function(model, result, xhr) { thisView.saveSuccess(model, result, xhr); }});
this.dirty = false;
},
});
@@ -120,7 +134,7 @@
var listView = new listViewClass();
TestApp[region_name].show(listView);
- xos[collection_name].startPolling();
+ xos[collection_name].fetch(); //startPolling();
}
$('#close-detail-view').unbind().bind('click', function() {