afterDelete working in tenant view
authorScott Baker <smbaker@gmail.com>
Mon, 12 Jan 2015 20:56:25 +0000 (12:56 -0800)
committerScott Baker <smbaker@gmail.com>
Mon, 12 Jan 2015 20:56:25 +0000 (12:56 -0800)
planetstack/core/xoslib/static/js/xosTenant.js
planetstack/core/xoslib/static/js/xoslib/xosHelper.js
planetstack/core/xoslib/templates/xosAdmin.html

index 6f73046..5a548ed 100644 (file)
@@ -42,7 +42,7 @@ XOSTenantButtonView = Marionette.ItemView.extend({
                      },
 
             deleteClicked: function(e) {
-                     this.options.linkedView.deleteClicked.call(this.options.linkedView, e);
+                     XOSTenantApp.deleteSlice(this.options.linkedView.model);
                      },
 
             addUserClicked: function(e) {
@@ -156,6 +156,11 @@ XOSTenantApp.addSlice = function() {
     $("#tenant-addslice-dialog").dialog("open");\r
 };\r
 \r
+XOSTenantApp.deleteSlice = function(model) {\r
+    var app=this;\r
+    app.deleteDialog(model, function() { console.log("afterDelete"); app.viewSlice(undefined); });\r
+};\r
+\r
 XOSTenantApp.viewSlice = function(model) {\r
     if (!model && xos.slicesPlus.models.length > 0) {\r
         model = xos.slicesPlus.models[0];\r
index 4ec75a6..9f9964c 100644 (file)
@@ -400,6 +400,8 @@ XOSApplication = Marionette.Application.extend({
             that.destroyModel(model);
             if (afterDelete=="list") {
                 that.navigate("list", modelName);
+            } else if (afterDelete) {
+                afterDelete();
             }
         });
     },
index ac90e94..53b9fe6 100644 (file)
   </div>
 </script>
 
-<script type="text/template" id="xos-datatable-spinner-template">
+<script type="text/template" id="xos-datatable-spinner-template-old">
     <!-- arguments: value, id, collectionName, fieldName -->
     <%= value %> <a href='#increase/<%= collectionName %>/<%= id %>/<%= fieldName %>'>more</a> <a href='#decrease/<%= collectionName %>/<%= id %>/<%= fieldName %>'>less</a>
 </script>
 
+<script type="text/template" id="xos-datatable-spinner-template">
+    <!-- arguments: value, id, collectionName, fieldName -->
+    <%= value %> <a href="javascript:undefined" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", 1)'> more </a>
+                 <a href="javascript:undefined" onclick='<%= app.varName %>.adjustCollectionField("<%= collectionName %>", <%= id %>, "<%= fieldName %>", -1)'> less </a>
+</script>
+
 <script type="text/template" id="xos-spinner-template">
     <!-- arguments: fieldName, id, value -->
     <input name="<%= fieldName %>" class="xos-spinner" id="<%= id %>">