<button class="btn btn-high btn-xos-contentButtonPanel" onclick="$('button.btn-xos-save-another').click()">Save and add another</button>
</div>
<div class="box save-box" id="xos-listview-button-box">
-<button class="btn btn-high btn-success btn-xos-contentButtonPanel" onclick="">Add</button>
+<button class="btn btn-high btn-success btn-xos-contentButtonPanel" onclick="$('button.btn-xos-add').click()">Add</button>
</div>
</div> <!-- end contentButtonPanel -->
<div id="contentInner">
display: none;
}
+.btn-xos-list {
+ display: none;
+}
+
#logPanel {
display: none;
}
name = OBJS[index];\r
collection_name = name + "s";\r
nav_url = collection_name;\r
- api_command = "list" + collection_name.charAt(0).toUpperCase() + collection_name.slice(1);\r
+ api_command = "list" + firstCharUpper(collection_name);\r
listViewName = collection_name + "ListView";\r
detailViewName = collection_name + "DetailView";\r
\r
routes[nav_url] = api_command;\r
\r
nav_url = collection_name + "/:id";\r
- api_command = "detail" + collection_name.charAt(0).toUpperCase() + collection_name.slice(1);\r
+ api_command = "detail" + firstCharUpper(collection_name);\r
\r
api[api_command] = XOSAdminApp.detailShower(detailViewName, collection_name, "detail", name);\r
routes[nav_url] = api_command;\r
+\r
+ nav_url = "add" + firstCharUpper(name);\r
+ api_command = "add" + firstCharUpper(name);\r
+ api[api_command] = XOSAdminApp.addShower(detailViewName, collection_name, "detail", name);\r
+ routes[nav_url] = api_command;\r
};\r
\r
XOSAdminApp.Router = new router({ appRoutes: routes, controller: api });\r
return _.template($(id).html());
}
+function firstCharUpper(s) {
+ return s.charAt(0).toUpperCase() + s.slice(1);
+}
+
HTMLView = Marionette.ItemView.extend({
render: function() {
this.$el.append(this.options.html);
}\r
},\r
\r
+ addShower: function(detailName, collection_name, regionName, title) {\r
+ var app=this;\r
+ return function() {\r
+ detailViewClass = app[detailName];\r
+ detailView = new detailViewClass();\r
+ app[regionName].show(detailView);\r
+ }\r
+ },\r
+\r
detailShower: function(detailName, collection_name, regionName, title) {\r
var app=this;\r
showModelId = function(model_id) {\r
XOSListView = Marionette.CompositeView.extend({
childViewContainer: 'tbody',\r
\r
+ events: {"click button.btn-xos-add": "addClicked",\r
+ },
+
+ addClicked: function(e) {
+ console.log("add");
+ e.preventDefault();
+ this.app.Router.navigate("add" + firstCharUpper(this.collection.modelName));
+ },
+\r
initialize: function() {\r
this.listenTo(this.collection, 'change', this._renderChildren)
</tr>
</script>
+<script type="text/template" id="xos-inline-list-buttons-template">
+ <button class="btn js-submit btn-xos-list btn-xos-add">Add</button>
+ </td>
+ </tr>
+</script>
+
<!-- Deployment -->
<script type="text/template" id="xosAdmin-deployment-list-template">
<h3 class="xos-list-title"><%= title %></h3>
+ <%= xosInlineListButtonsTemplate() %>
<table class="test-table">
<thead><tr>
<th>id</th>
<script>
xosInlineDetailButtonsTemplate = _.template($("#xos-inline-detail-buttons-template").html());
+xosInlineListButtonsTemplate = _.template($("#xos-inline-list-buttons-template").html());
</script>