support for statusMsg in django's base.html
authorScott Baker <smbaker@gmail.com>
Thu, 6 Nov 2014 06:13:36 +0000 (22:13 -0800)
committerScott Baker <smbaker@gmail.com>
Thu, 6 Nov 2014 06:13:36 +0000 (22:13 -0800)
planetstack/core/xoslib/static/js/xoslib/xosHelper.js

index 417f8aa..1dc3bf5 100644 (file)
@@ -33,8 +33,8 @@ XOSApplication = Marionette.Application.extend({
     },
 
     showSuccess: function(result) {
+         result["success"] = "success";
          if (this.logTableId) {
-             result["success"] = "success";
              this.appendLogWindow(result);
          } else {
              $(this.successBoxId).show();
@@ -47,8 +47,8 @@ XOSApplication = Marionette.Application.extend({
     },
 
     showError: function(result) {
+         result["success"] = "failure";
          if (this.logTableId) {
-             result["success"] = "failure";
              this.appendLogWindow(result);
          } else {
              $(this.errorBoxId).show();
@@ -61,8 +61,8 @@ XOSApplication = Marionette.Application.extend({
     },
 
     showInformational: function(result) {
+         result["success"] = "information";
          if (this.logTableId) {
-             result["success"] = "information";
              return this.appendLogWindow(result);
          } else {
              return undefined;
@@ -90,6 +90,11 @@ XOSApplication = Marionette.Application.extend({
             logTableBody = $(this.logTableId + " tbody");
             logTableBody.prepend(newRow);
         }
+
+        if (this.statusMsgId) {
+            $(this.statusMsgId).html( templateFromId("#xos-status-template")(result) );
+        }
+
         return logMessageId;
     },
 
@@ -162,9 +167,6 @@ XOSApplication = Marionette.Application.extend({
 XOSDetailView = Marionette.ItemView.extend({
             tagName: "div",
 
-            events: {"click button.js-submit": "submitClicked",
-                     "change input": "inputChanged"},
-
             events: {"click button.js-submit": "submitClicked",
                      "change input": "inputChanged"},
 
@@ -191,6 +193,7 @@ XOSDetailView = Marionette.ItemView.extend({
             },
 
             submitClicked: function(e) {
+                console.log("submit clicked");
                 this.app.hideError();\r
                 e.preventDefault();\r
                 var infoMsgId = this.app.showInformational( {what: "save " + this.model.__proto__.modelName, status: "", statusText: "in progress..."} );\r