readonly fields, wip
diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html
index a222889..3848fc0 100644
--- a/planetstack/core/xoslib/templates/xosAdmin.html
+++ b/planetstack/core/xoslib/templates/xosAdmin.html
@@ -89,7 +89,9 @@
</script>
<script type="text/template" id="xos-list-footer-template">
- <a href="<%= addChildHash %>">Add...</a>
+ <% if (addChildHash) { %>
+ <a href="<%= addChildHash %>">Add...</a>
+ <% } %>
</script>
<script type="text/template" id="xos-delete-button-template">
@@ -106,12 +108,13 @@
<table>
<% _.each(addFields, function(fieldName) { %>
<tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
+ <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; console.log(fieldName + " " + readOnly); console.log(model.readOnlyFields); %>
<% if (fieldName in foreignFields) { %>
- <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
+ <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
<% } else if (inputType[fieldName] == "checkbox") { %>
- <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %>></td>
+ <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
<% } else { %>
- <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"></td>
+ <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
<% } %>
</tr>
<% }); %>
@@ -121,7 +124,7 @@
</script>
<script type="text/template" id="xos-detail-template">
- <h3 class="xos-detail-title">Add Object: <%= modelName %></h3>
+ <h3 class="xos-detail-title">Edit Object: <%= modelName %></h3>
<form>
<table>
<% console.log(model); _.each(detailFields, function(fieldName) { %>
@@ -622,3 +625,4 @@
xosDeleteButtonTemplate = _.template($("#xos-delete-button-template").html());
xosDetailLinkTemplate = _.template($("#xos-detail-link-template").html());
</script>
+