fix selects not having default item set properly
diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
index b0e2dee..497a418 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
@@ -121,11 +121,12 @@
return function(parent_modelName, parent_fieldName, parent_id) {
app.Router.showPreviousURL();
console.log("acs");
- console.log(modelName);
+ console.log(parent_modelName);
console.log(parent_fieldName);
console.log(parent_id);
model = new xos[collection_name].model();
model.attributes[parent_fieldName] = parent_id;
+ console.log(model);
detailViewClass = app[addChildName];
var detailView = new detailViewClass({model: model, collection:xos[collection_name]});
detailView.dialog = $("xos-addchild-dialog");
diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html
index 8ca18db..c113e04 100644
--- a/planetstack/core/xoslib/templates/xosAdmin.html
+++ b/planetstack/core/xoslib/templates/xosAdmin.html
@@ -89,7 +89,6 @@
</script>
<script type="text/template" id="xos-list-footer-template">
- <% console.log(model); %>
<a href="<%= addChildHash %>">Add...</a>
</script>
@@ -108,7 +107,7 @@
<% _.each(addFields, function(fieldName) { %>
<tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
<% if (fieldName in foreignFields) { %>
- <td><%= idToSelect(fieldName, window[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
+ <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
<% } else if (inputType[fieldName] == "checkbox") { %>
<td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %>></td>
<% } else { %>
@@ -128,7 +127,7 @@
<% console.log(model); _.each(detailFields, function(fieldName) { %>
<tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
<% if (fieldName in foreignFields) { %>
- <td><%= idToSelect(fieldName, window[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
+ <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
<% } else if (inputType[fieldName] == "checkbox") { %>
<td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %>></td>
<% } else { %>