blob: 8b5c613ea4103916e3fdb4c712e3dc9c50e0b335 [file] [log] [blame]
Scott Bakerc1e681e2014-11-03 09:43:23 -08001<!-- Error and Success templates -->
2
Scott Baker8560fd12014-11-24 23:26:12 -08003<script type="text/template" id="xos-error-response">
4 <h5>Error</h5>
5 <table>
6 <tr><td>error:</td><td><%= error %></td></tr>
7 <tr><td>check:</td><td><%= specific_error %></td></tr>
8 </table>
9 <h5>Details:</h5>
10 <table>
11 <tbody>
12 <% _.each(reasons, function(element, index) { %>
13 <tr><td><%= index %></td><td><%= element %></td></tr>
14 <% }); %>
15 </tbody>
16 </table>
17</script>
18
Scott Bakerf8641732014-12-01 17:06:31 -080019<script type="text/template" id="xos-error-rawresponse">
20 <h5>Error</h5>
21 <pre>The server returned:
22"<%= responseText %>"</pre>
23</script>
24
Scott Baker28a65442014-11-03 23:54:59 -080025<script type="text/template" id="xos-error-template">
Scott Bakerc1e681e2014-11-03 09:43:23 -080026 <button id="close-error-box">Close Error Message</button>
27 <h3>An error has occurred.</h3>
28 <table class="test-error-table">
29 <tr><td>Code:</td><td><%= status %></td></tr>
30 <tr><td>Message:</td><td><%= statusText %></td></tr>
31 </table>
32</script>
33
Scott Baker28a65442014-11-03 23:54:59 -080034<script type="text/template" id="xos-success-template">
Scott Bakerc1e681e2014-11-03 09:43:23 -080035 <button id="close-success-box">Close Success Message</button>
36 <h3>Success!</h3>
37 <table class="test-success-table">
38 <tr><td>Code:</td><td><%= status %></td></tr>
39 <tr><td>Message:</td><td><%= statusText %></td></tr>
40 </table>
41</script>
42
Scott Baker100b0a32014-11-04 09:34:17 -080043<script type="text/template" id="xos-navbutton-old">
Scott Baker28a65442014-11-03 23:54:59 -080044 <button class="btn btn-default btn-xosnav" onclick="<%= router %>.navigate('<%= routeUrl %>', {trigger: true})"><%= name %></button><br>
45</script>
46
Scott Baker17390d22014-11-05 21:11:50 -080047<script type="text/template" id="xos-status-template">
Scott Baker1c5d4ee2014-11-14 16:13:43 -080048 <div class="xos-status xos-<%= statusclass %>"><%= what %>: <%= statusText %> (<%= status %>)</div>
Scott Baker17390d22014-11-05 21:11:50 -080049</script>
50
Scott Baker76d7b622014-11-04 23:20:48 -080051<script type="text/template" id="xos-tabs-template">
52 <ul class="xos-nav-list">
53 <% _.each(tabs, function(tab) { %>
54 <li class="xos-nav-item" id="xos-nav-<%= tab["region"] %>"><%= tab["name"] %></li>
55 <% }); %>
56 </ul>
57</script>
58
59<script type="text/template" id="xos-title-list">
Scott Baker95a57b82014-11-18 17:02:07 -080060 <h3><img src="/static/img/brokencircle.gif" height=16 width=16 id="xos-list-title-spinner"> <%= title %></h3>
Scott Baker76d7b622014-11-04 23:20:48 -080061</script>
62
63<script type="text/template" id="xos-title-detail">
64 <h3><%= title %></h3>
65</script>
66
Scott Baker100b0a32014-11-04 09:34:17 -080067<script type="text/template" id="xos-navbutton">
68 <li>
69 <a href="<%= routeUrl %>">
70 <i class="<%= iconClass %>"></i>
71 <%= name %>
72 </a>
Scott Baker50282372014-11-04 15:41:47 -080073 </li>
Scott Baker100b0a32014-11-04 09:34:17 -080074</script>
75
Scott Baker09ed3e02014-11-07 13:01:43 -080076<script type="text/template" id="xos-inline-detail-buttons-template">
77 <tr>
78 <td colspan=2><button class="btn js-submit btn-xos-detail btn-xos-save-leave">Save</button>
79 <button class="btn js-submit btn-xos-detail btn-xos-save-continue">Save and Continue Editing</button>
80 <button class="btn js-submit btn-xos-detail btn-xos-save-another">Save and Add Another</button>
Scott Baker95a57b82014-11-18 17:02:07 -080081 <button class="btn js-submit btn-xos-detail btn-xos-delete">Delete</button>
Scott Baker09ed3e02014-11-07 13:01:43 -080082 </td>
83 </tr>
84</script>
85
Scott Bakera5150072014-12-12 14:26:21 -080086<script type="text/template" id="xos-backend-status-icon-template">
87 <% if ((enacted) && (enacted >= updated)) { %>
88 <span style="min-width:16px;"><img src="/static/admin/img/icon_success.gif"></span>
89 <% } else { %>
90 <% if ((backend_status == "Provisioning in progress") || (!backend_status)) { %>
91 <span style="min-width:16px;" title="<%= _.escape(backend_status) %>"><img src="/static/admin/img/icon_clock.gif"></span>
92 <% } else { %>
93 <span style="min-width:16px;" title="<%= _.escape(backend_status) %>"><img src="/static/admin/img/icon_error.gif"></span>
94 <% } %>
95 <% } %>
96</script>
97
Scott Baker2c974852014-12-04 17:23:27 -080098<script type="text/template" id="xos-list-header-template">
99 <button class="btn js-submit btn-xos-list btn-xos-add">Add</button>
100 <button class="btn js-submit btn-xos-list btn-xos-refresh">Refresh</button>
101</script>
102
103<script type="text/template" id="xos-list-footer-template">
Scott Bakera322dba2014-12-08 23:54:18 -0800104 <% if (addChildHash) { %>
105 <a href="<%= addChildHash %>">Add...</a>
106 <% } %>
Scott Bakerc9d0dcb2014-11-07 16:40:30 -0800107</script>
108
Scott Bakerb1e63332014-12-02 10:49:04 -0800109<script type="text/template" id="xos-delete-button-template">
Scott Baker6694f8f2014-12-02 17:59:02 -0800110 <a href="#delete<%= firstCharUpper(modelName) %>/<%= id %>">delete</a>
Scott Bakerb1e63332014-12-02 10:49:04 -0800111</script>
112
113<script type="text/template" id="xos-detail-link-template">
114 <a href="#<%= collectionName %>/<%= id %>"><%= text %></a>
115</script>
116
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800117<script type="text/template" id="xos-add-template">
118 <h3 class="xos-detail-title">Add Object: <%= modelName %></h3>
119 <form>
120 <table>
121 <% _.each(addFields, function(fieldName) { %>
Scott Bakerc06c0c82014-12-07 22:31:18 -0800122 <tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
Scott Baker31621222014-12-09 16:59:08 -0800123 <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; %>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800124 <% if (fieldName in foreignFields) { %>
Scott Bakera322dba2014-12-08 23:54:18 -0800125 <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800126 <% } else if (inputType[fieldName] == "checkbox") { %>
Scott Bakera322dba2014-12-08 23:54:18 -0800127 <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800128 <% } else { %>
Scott Bakera322dba2014-12-08 23:54:18 -0800129 <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800130 <% } %>
131 </tr>
132 <% }); %>
133 <%= xosInlineDetailButtonsTemplate() %>
134 </table>
135 </form>
136</script>
137
138<script type="text/template" id="xos-detail-template">
Scott Bakera322dba2014-12-08 23:54:18 -0800139 <h3 class="xos-detail-title">Edit Object: <%= modelName %></h3>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800140 <form>
141 <table>
142 <% console.log(model); _.each(detailFields, function(fieldName) { %>
Scott Bakerc06c0c82014-12-07 22:31:18 -0800143 <tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
Scott Baker31621222014-12-09 16:59:08 -0800144 <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; console.log(fieldName + " " + readOnly); console.log(model.readOnlyFields); %>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800145 <% if (fieldName in foreignFields) { %>
Scott Baker31621222014-12-09 16:59:08 -0800146 <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800147 <% } else if (inputType[fieldName] == "checkbox") { %>
Scott Baker31621222014-12-09 16:59:08 -0800148 <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800149 <% } else { %>
Scott Baker31621222014-12-09 16:59:08 -0800150 <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
Scott Bakerfa2c4b52014-12-07 22:27:09 -0800151 <% } %>
152 </tr>
153 <% }); %>
154 <%= xosInlineDetailButtonsTemplate() %>
155 </table>
156 </form>
157</script>
158
Scott Baker31621222014-12-09 16:59:08 -0800159<script type="text/template" id="xos-list-template">
Scott Baker76d7b622014-11-04 23:20:48 -0800160 <h3 class="xos-list-title"><%= title %></h3>
Scott Baker2c974852014-12-04 17:23:27 -0800161 <%= xosListHeaderTemplate() %>
Scott Baker7e0e6b92014-10-30 16:10:16 -0700162 <table class="test-table">
Scott Baker31621222014-12-09 16:59:08 -0800163 <thead>
164 <tr>
165 <% _.each(listFields, function(fieldName) { %>
166 <th><%= fieldNameToHumanReadable(fieldName) %></th>
167 <% }); %>
168 <th>delete</th>
Scott Baker7e0e6b92014-10-30 16:10:16 -0700169 </tr></thead>
170 <tbody></tbody>
171 </table>
Scott Baker1d651ce2014-12-08 11:13:43 -0800172 <%= xosListFooterTemplate({addChildHash: addChildHash}) %>
Scott Baker7e0e6b92014-10-30 16:10:16 -0700173</script>
174
Scott Baker31621222014-12-09 16:59:08 -0800175<script type="text/template" id="xos-listitem-template">
176 <% _.each(listFields, function(fieldName) { %>
177 <% if ($.inArray(fieldName, model.detailLinkFields)>=0) { %>
178 <td><%= xosDetailLinkTemplate({collectionName: collectionName, id: id, text: model.attributes[fieldName]}) %></td>
179 <% } else if (fieldName in foreignFields) { %>
180 <td><%= idToName(model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td>
181 <% } else { %>
182 <td><%= model.attributes[fieldName] %></td>
183 <% } %>
184 <% }); %>
Scott Baker3f9fa002014-12-02 18:04:50 -0800185 <td><%= xosDeleteButtonTemplate({modelName: modelName, id: id}) %></td>
Scott Baker84e01fe2014-10-31 00:18:24 -0700186</script>
187
Scott Baker30092042014-12-09 18:38:13 -0800188<script type="text/template" id="xos-savebuttons-template">
189 <div class="box save-box">
190 <button class="btn btn-high btn-info btn-xos-contentButtonPanel btn-xos-save-leave">Save</button>
191 <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-continue">Save and continue editing</button>
192 <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-another">Save and add another</button>
193 <button class="btn btn-danger btn-xos-contentButtonPanel btn-xos-delete">Delete</button>
194 </div>
195</script>
196
197<script type="text/template" id="xos-listbuttons-template">
198 <div class="box save-box">
199 <button class="btn btn-high btn-primary btn-xos-contentButtonPanel btn-xos-refresh">Refresh</button>
200 <button class="btn btn-high btn-success btn-xos-contentButtonPanel btn-xos-add">Add</button>
201 </div>
202</script>
203
Scott Baker09ed3e02014-11-07 13:01:43 -0800204<script>
205xosInlineDetailButtonsTemplate = _.template($("#xos-inline-detail-buttons-template").html());
Scott Baker2c974852014-12-04 17:23:27 -0800206xosListHeaderTemplate = _.template($("#xos-list-header-template").html());
207xosListFooterTemplate = _.template($("#xos-list-footer-template").html());
Scott Bakerb1e63332014-12-02 10:49:04 -0800208xosDeleteButtonTemplate = _.template($("#xos-delete-button-template").html());
209xosDetailLinkTemplate = _.template($("#xos-detail-link-template").html());
Scott Bakera5150072014-12-12 14:26:21 -0800210xosBackendStatusIconTemplate = _.template($("#xos-backend-status-icon-template").html());
Scott Baker09ed3e02014-11-07 13:01:43 -0800211</script>
Scott Bakera322dba2014-12-08 23:54:18 -0800212