From: Scott Baker Date: Fri, 7 Nov 2014 21:01:43 +0000 (-0800) Subject: templateize detail inline button panel, add save/continue and save/another buttons... X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3a820aa6e0ae67f06f163e05595d399e07dfed53;p=plstackapi.git templateize detail inline button panel, add save/continue and save/another buttons, add insert button --- diff --git a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html index b3dca1a..f70f188 100644 --- a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html +++ b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html @@ -20,8 +20,15 @@ handler for this Save button tells the save button inside the detail form to click itself. --> - +
+ + +
+
+ +
+
@@ -30,8 +37,8 @@
-
- + +
diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js index 1dc3bf5..4a408e1 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js +++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js @@ -113,7 +113,9 @@ XOSApplication = Marionette.Application.extend({ app.hideLinkedItems(); $("#contentTitle").html(templateFromId("#xos-title-list")({"title": title})); $("#detail").show(); + $("#xos-listview-button-box").show(); $("#tabs").hide(); + $("#xos-detail-button-box").hide(); } }, @@ -125,6 +127,8 @@ XOSApplication = Marionette.Application.extend({ detailView = new detailViewClass({model: model}); app[regionName].show(detailView); detailView.showLinkedItems(); + $("#xos-detail-button-box").show(); + $("#xos-listview-button-box").hide(); } $("#contentTitle").html(templateFromId("#xos-title-detail")({"title": title})); @@ -167,7 +171,9 @@ XOSApplication = Marionette.Application.extend({ XOSDetailView = Marionette.ItemView.extend({ tagName: "div", - events: {"click button.js-submit": "submitClicked", + events: {"click button.btn-xos-save-continue": "submitContinueClicked", + "click button.btn-xos-save-leave": "submitLeaveClicked", + "click button.btn-xos-save-another": "submitAddAnotherClicked", "change input": "inputChanged"}, /* inputChanged is watching the onChange events of the input controls. We @@ -192,10 +198,26 @@ XOSDetailView = Marionette.ItemView.extend({ this.app.showSuccess(result); }, - submitClicked: function(e) { - console.log("submit clicked"); - this.app.hideError(); - e.preventDefault(); + submitContinueClicked: function(e) { + console.log("saveContinue"); + e.preventDefault(); + this.save(); + }, + + submitLeaveClicked: function(e) { + console.log("saveLeave"); + e.preventDefault(); + this.save(); + }, + + submitAddAnotherClicked: function(e) { + console.log("saveAnother"); + e.preventDefault(); + this.save(); + }, + + save: function() { + this.app.hideError(); var infoMsgId = this.app.showInformational( {what: "save " + this.model.__proto__.modelName, status: "", statusText: "in progress..."} ); var data = Backbone.Syphon.serialize(this); var that = this; diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html index 8e79904..94fb0f8 100644 --- a/planetstack/core/xoslib/templates/xosAdmin.html +++ b/planetstack/core/xoslib/templates/xosAdmin.html @@ -51,7 +51,6 @@

<%= title %>

- + + @@ -129,7 +137,7 @@ - + <%= xosInlineDetailButtonsTemplate() %>
Name:
Disk Format:
Container Format:
@@ -173,7 +181,7 @@ Translation: Shared Network Name: Shared Network Id: - + <%= xosInlineDetailButtonsTemplate() %> @@ -213,7 +221,7 @@ Ports: Labels: Owner:<%= idToSelect("owner",owner,"slices","name") %> - + <%= xosInlineDetailButtonsTemplate() %> @@ -250,7 +258,7 @@ Sliver: Ip: Port_id: - + <%= xosInlineDetailButtonsTemplate() %> @@ -284,7 +292,7 @@ Network: Sliver: Ip: - + <%= xosInlineDetailButtonsTemplate() %> @@ -319,7 +327,7 @@ Name: Site:<%= idToSelect("site",site,"sites","name") %> Deployment:<%= idToSelect("deployment",deployment,"deployments","name") %> - + <%= xosInlineDetailButtonsTemplate() %> @@ -348,7 +356,7 @@
- + <%= xosInlineDetailButtonsTemplate() %>
Role:
@@ -387,7 +395,7 @@ Name: description: Version Number: - + <%= xosInlineDetailButtonsTemplate() %> @@ -430,7 +438,7 @@ Enabled:> Is Public:> login_base: - + <%= xosInlineDetailButtonsTemplate() %> @@ -476,7 +484,7 @@ Description: Url: Max Slivers: - + <%= xosInlineDetailButtonsTemplate() %> @@ -510,7 +518,7 @@ Slice: Deployment: Tenant Id: - + <%= xosInlineDetailButtonsTemplate() %> @@ -544,7 +552,7 @@ User: Slice: Role: - + <%= xosInlineDetailButtonsTemplate() %> @@ -597,7 +605,7 @@ Creator:<%= idToSelect("creator",creator,"users","username") %> Slice:<%= idToSelect("slice",slice,"slices","name") %> Deployment:<%= idToSelect("deploymentNetwork",deploymentNetwork,"deployments","name") %> - + <%= xosInlineDetailButtonsTemplate() %> @@ -641,7 +649,7 @@ Phone: Url: Site:<%= idToSelect("site",site,"sites","name") %> - + <%= xosInlineDetailButtonsTemplate() %> @@ -661,7 +669,6 @@ - + +