Scott Baker | c1e681e | 2014-11-03 09:43:23 -0800 | [diff] [blame] | 1 | <!-- Error and Success templates --> |
| 2 | |
Scott Baker | 8560fd1 | 2014-11-24 23:26:12 -0800 | [diff] [blame] | 3 | <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 Baker | f864173 | 2014-12-01 17:06:31 -0800 | [diff] [blame] | 19 | <script type="text/template" id="xos-error-rawresponse"> |
| 20 | <h5>Error</h5> |
| 21 | <pre>The server returned: |
| 22 | "<%= responseText %>"</pre> |
| 23 | </script> |
| 24 | |
Scott Baker | 28a6544 | 2014-11-03 23:54:59 -0800 | [diff] [blame] | 25 | <script type="text/template" id="xos-error-template"> |
Scott Baker | c1e681e | 2014-11-03 09:43:23 -0800 | [diff] [blame] | 26 | <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 Baker | 28a6544 | 2014-11-03 23:54:59 -0800 | [diff] [blame] | 34 | <script type="text/template" id="xos-success-template"> |
Scott Baker | c1e681e | 2014-11-03 09:43:23 -0800 | [diff] [blame] | 35 | <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 Baker | 100b0a3 | 2014-11-04 09:34:17 -0800 | [diff] [blame] | 43 | <script type="text/template" id="xos-navbutton-old"> |
Scott Baker | 28a6544 | 2014-11-03 23:54:59 -0800 | [diff] [blame] | 44 | <button class="btn btn-default btn-xosnav" onclick="<%= router %>.navigate('<%= routeUrl %>', {trigger: true})"><%= name %></button><br> |
| 45 | </script> |
| 46 | |
Scott Baker | 17390d2 | 2014-11-05 21:11:50 -0800 | [diff] [blame] | 47 | <script type="text/template" id="xos-status-template"> |
Scott Baker | 1c5d4ee | 2014-11-14 16:13:43 -0800 | [diff] [blame] | 48 | <div class="xos-status xos-<%= statusclass %>"><%= what %>: <%= statusText %> (<%= status %>)</div> |
Scott Baker | 17390d2 | 2014-11-05 21:11:50 -0800 | [diff] [blame] | 49 | </script> |
| 50 | |
Scott Baker | 76d7b62 | 2014-11-04 23:20:48 -0800 | [diff] [blame] | 51 | <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 Baker | 95a57b8 | 2014-11-18 17:02:07 -0800 | [diff] [blame] | 60 | <h3><img src="/static/img/brokencircle.gif" height=16 width=16 id="xos-list-title-spinner"> <%= title %></h3> |
Scott Baker | 76d7b62 | 2014-11-04 23:20:48 -0800 | [diff] [blame] | 61 | </script> |
| 62 | |
| 63 | <script type="text/template" id="xos-title-detail"> |
| 64 | <h3><%= title %></h3> |
| 65 | </script> |
| 66 | |
Scott Baker | 100b0a3 | 2014-11-04 09:34:17 -0800 | [diff] [blame] | 67 | <script type="text/template" id="xos-navbutton"> |
| 68 | <li> |
| 69 | <a href="<%= routeUrl %>"> |
| 70 | <i class="<%= iconClass %>"></i> |
| 71 | <%= name %> |
| 72 | </a> |
Scott Baker | 5028237 | 2014-11-04 15:41:47 -0800 | [diff] [blame] | 73 | </li> |
Scott Baker | 100b0a3 | 2014-11-04 09:34:17 -0800 | [diff] [blame] | 74 | </script> |
| 75 | |
Scott Baker | 09ed3e0 | 2014-11-07 13:01:43 -0800 | [diff] [blame] | 76 | <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 Baker | 95a57b8 | 2014-11-18 17:02:07 -0800 | [diff] [blame] | 81 | <button class="btn js-submit btn-xos-detail btn-xos-delete">Delete</button> |
Scott Baker | 09ed3e0 | 2014-11-07 13:01:43 -0800 | [diff] [blame] | 82 | </td> |
| 83 | </tr> |
| 84 | </script> |
| 85 | |
Scott Baker | a515007 | 2014-12-12 14:26:21 -0800 | [diff] [blame] | 86 | <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 Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 98 | <script type="text/template" id="xos-backend-status-text-template"> |
| 99 | <%= xosBackendStatusIconTemplate.apply(this,arguments) %> |
| 100 | <% if ((enacted) && (enacted >= updated)) { %> |
| 101 | Successfully enacted |
| 102 | <% } else { %> |
| 103 | <%= _.escape(backend_status) %> |
| 104 | <% } %> |
| 105 | </script> |
| 106 | |
Scott Baker | 2c97485 | 2014-12-04 17:23:27 -0800 | [diff] [blame] | 107 | <script type="text/template" id="xos-list-header-template"> |
| 108 | <button class="btn js-submit btn-xos-list btn-xos-add">Add</button> |
| 109 | <button class="btn js-submit btn-xos-list btn-xos-refresh">Refresh</button> |
| 110 | </script> |
| 111 | |
| 112 | <script type="text/template" id="xos-list-footer-template"> |
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 113 | <% if (addChildHash) { %> |
| 114 | <a href="<%= addChildHash %>">Add...</a> |
| 115 | <% } %> |
Scott Baker | c9d0dcb | 2014-11-07 16:40:30 -0800 | [diff] [blame] | 116 | </script> |
| 117 | |
Scott Baker | b1e6333 | 2014-12-02 10:49:04 -0800 | [diff] [blame] | 118 | <script type="text/template" id="xos-delete-button-template"> |
Scott Baker | 6694f8f | 2014-12-02 17:59:02 -0800 | [diff] [blame] | 119 | <a href="#delete<%= firstCharUpper(modelName) %>/<%= id %>">delete</a> |
Scott Baker | b1e6333 | 2014-12-02 10:49:04 -0800 | [diff] [blame] | 120 | </script> |
| 121 | |
| 122 | <script type="text/template" id="xos-detail-link-template"> |
| 123 | <a href="#<%= collectionName %>/<%= id %>"><%= text %></a> |
| 124 | </script> |
| 125 | |
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 126 | <script type="text/template" id="xos-add-template"> |
| 127 | <h3 class="xos-detail-title">Add Object: <%= modelName %></h3> |
| 128 | <form> |
| 129 | <table>
|
Scott Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 130 | <% args = arguments; %>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 131 | <% _.each(addFields, function(fieldName) { %>
|
Scott Baker | c06c0c8 | 2014-12-07 22:31:18 -0800 | [diff] [blame] | 132 | <tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
|
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 133 | <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; %>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 134 | <% if (fieldName in foreignFields) { %>
|
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 135 | <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 136 | <% } else if (inputType[fieldName] == "checkbox") { %>
|
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 137 | <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
|
Scott Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 138 | <% } else if (fieldName=="backend_status") { %>
|
| 139 | <td><%= xosBackendStatusTextTemplate.apply(this, args) %></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 140 | <% } else { %>
|
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 141 | <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 142 | <% } %>
|
| 143 | </tr>
|
| 144 | <% }); %>
|
| 145 | <%= xosInlineDetailButtonsTemplate() %>
|
| 146 | </table>
|
| 147 | </form>
|
| 148 | </script> |
| 149 | |
| 150 | <script type="text/template" id="xos-detail-template"> |
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 151 | <h3 class="xos-detail-title">Edit Object: <%= modelName %></h3> |
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 152 | <form> |
| 153 | <table>
|
Scott Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 154 | <% args = arguments; %>
|
| 155 | <% _.each(detailFields, function(fieldName) { %>
|
Scott Baker | c06c0c8 | 2014-12-07 22:31:18 -0800 | [diff] [blame] | 156 | <tr><td><%= fieldNameToHumanReadable(fieldName) %>:</td>
|
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 157 | <% readOnly = $.inArray(fieldName, model.readOnlyFields)>=0 ? " readonly" : ""; console.log(fieldName + " " + readOnly); console.log(model.readOnlyFields); %>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 158 | <% if (fieldName in foreignFields) { %>
|
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 159 | <td><%= idToSelect(fieldName, model.attributes[fieldName], foreignFields[fieldName], "humanReadableName", readOnly) %></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 160 | <% } else if (inputType[fieldName] == "checkbox") { %>
|
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 161 | <td><input type="checkbox" name="<%= fieldName %>" <% if (model.attributes[fieldName]) print("checked"); %><%= readOnly %>></td>
|
Scott Baker | cde19e6 | 2014-12-16 22:49:42 -0800 | [diff] [blame] | 162 | <% } else if (inputType[fieldName] == "picker") { %>
|
| 163 | <% lookupFunc = makeIdToName(model.m2mFields[fieldName], "humanReadableName"); %>
|
Scott Baker | 6a7a17c | 2014-12-17 16:29:59 -0800 | [diff] [blame] | 164 | <td><%= xosPickerTemplate({pickedItems: model.attributes[fieldName], unpickedItems: model.getChoices(fieldName,true), id: "picker_" + fieldName, fieldName: fieldName, detailView: detailView, lookupFunc: lookupFunc}) %></td>
|
Scott Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 165 | <% } else if (fieldName=="backend_status") { %>
|
| 166 | <td><%= xosBackendStatusTextTemplate.apply(this, args) %></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 167 | <% } else { %>
|
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 168 | <td><input type="text" name="<%= fieldName %>" value="<%= model.attributes[fieldName] %>"<%= readOnly %>></td>
|
Scott Baker | fa2c4b5 | 2014-12-07 22:27:09 -0800 | [diff] [blame] | 169 | <% } %>
|
| 170 | </tr>
|
| 171 | <% }); %>
|
| 172 | <%= xosInlineDetailButtonsTemplate() %>
|
| 173 | </table>
|
| 174 | </form>
|
| 175 | </script> |
| 176 | |
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 177 | <script type="text/template" id="xos-list-template"> |
Scott Baker | 76d7b62 | 2014-11-04 23:20:48 -0800 | [diff] [blame] | 178 | <h3 class="xos-list-title"><%= title %></h3> |
Scott Baker | 2c97485 | 2014-12-04 17:23:27 -0800 | [diff] [blame] | 179 | <%= xosListHeaderTemplate() %> |
Scott Baker | 7e0e6b9 | 2014-10-30 16:10:16 -0700 | [diff] [blame] | 180 | <table class="test-table"> |
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 181 | <thead> |
| 182 | <tr> |
| 183 | <% _.each(listFields, function(fieldName) { %> |
| 184 | <th><%= fieldNameToHumanReadable(fieldName) %></th> |
| 185 | <% }); %> |
| 186 | <th>delete</th> |
Scott Baker | 7e0e6b9 | 2014-10-30 16:10:16 -0700 | [diff] [blame] | 187 | </tr></thead> |
| 188 | <tbody></tbody> |
| 189 | </table> |
Scott Baker | 1d651ce | 2014-12-08 11:13:43 -0800 | [diff] [blame] | 190 | <%= xosListFooterTemplate({addChildHash: addChildHash}) %> |
Scott Baker | 7e0e6b9 | 2014-10-30 16:10:16 -0700 | [diff] [blame] | 191 | </script> |
| 192 | |
Scott Baker | 3162122 | 2014-12-09 16:59:08 -0800 | [diff] [blame] | 193 | <script type="text/template" id="xos-listitem-template"> |
| 194 | <% _.each(listFields, function(fieldName) { %> |
| 195 | <% if ($.inArray(fieldName, model.detailLinkFields)>=0) { %> |
| 196 | <td><%= xosDetailLinkTemplate({collectionName: collectionName, id: id, text: model.attributes[fieldName]}) %></td> |
| 197 | <% } else if (fieldName in foreignFields) { %> |
| 198 | <td><%= idToName(model.attributes[fieldName], foreignFields[fieldName], "humanReadableName") %></td> |
| 199 | <% } else { %> |
| 200 | <td><%= model.attributes[fieldName] %></td> |
| 201 | <% } %> |
| 202 | <% }); %> |
Scott Baker | 3f9fa00 | 2014-12-02 18:04:50 -0800 | [diff] [blame] | 203 | <td><%= xosDeleteButtonTemplate({modelName: modelName, id: id}) %></td> |
Scott Baker | 84e01fe | 2014-10-31 00:18:24 -0700 | [diff] [blame] | 204 | </script> |
| 205 | |
Scott Baker | 3009204 | 2014-12-09 18:38:13 -0800 | [diff] [blame] | 206 | <script type="text/template" id="xos-savebuttons-template"> |
| 207 | <div class="box save-box"> |
| 208 | <button class="btn btn-high btn-info btn-xos-contentButtonPanel btn-xos-save-leave">Save</button> |
| 209 | <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-continue">Save and continue editing</button> |
| 210 | <button class="btn btn-high btn-xos-contentButtonPanel btn-xos-save-another">Save and add another</button> |
| 211 | <button class="btn btn-danger btn-xos-contentButtonPanel btn-xos-delete">Delete</button> |
| 212 | </div> |
| 213 | </script> |
| 214 | |
| 215 | <script type="text/template" id="xos-listbuttons-template"> |
| 216 | <div class="box save-box"> |
| 217 | <button class="btn btn-high btn-primary btn-xos-contentButtonPanel btn-xos-refresh">Refresh</button> |
| 218 | <button class="btn btn-high btn-success btn-xos-contentButtonPanel btn-xos-add">Add</button> |
| 219 | </div> |
| 220 | </script> |
| 221 | |
Scott Baker | cde19e6 | 2014-12-16 22:49:42 -0800 | [diff] [blame] | 222 | |
| 223 | <script type="text/template" id="xos-picker-template"> |
| 224 | <!-- arguments: unpickedItems, pickedItems --> |
| 225 | <div id="<%= id %>"> |
| 226 | <div class="picker_row"> |
| 227 | <div class="picker_column">
|
| 228 | <div>Available</div>
|
| 229 | <select name="pickerfrom" class="select-picker-from" multiple size="5">
|
| 230 | <% _.each(unpickedItems, function(item) { %>
|
| 231 | <option value="<%= item %>"><%= lookupFunc? lookupFunc(item) : item %></option> |
| 232 | <% });%>
|
| 233 | </select>
|
| 234 | </div>
|
| 235 | <div class="picker_column">
|
| 236 | <br>
|
| 237 | <div class="btn btn-success btn-picker-add">Add »</div><br><br>
|
| 238 | <div class="btn btn-success btn-picker-remove">« Remove</div>
|
| 239 | </div>
|
| 240 | <div class="picker_column">
|
| 241 | <div>Selected</div>
|
Scott Baker | 6a7a17c | 2014-12-17 16:29:59 -0800 | [diff] [blame] | 242 | <select name=<%= fieldName %> class="select-picker-to syphonall" multiple size="5">
|
Scott Baker | cde19e6 | 2014-12-16 22:49:42 -0800 | [diff] [blame] | 243 | <% _.each(pickedItems, function(item) { %>
|
| 244 | <option value="<%= item %>"><%= lookupFunc ? lookupFunc(item) : item %></option> |
| 245 | <% }); %>
|
| 246 | </select>
|
| 247 | </div>
|
| 248 | <div class="picker_column">
|
| 249 | <br>
|
| 250 | <div class="btn btn-success btn-picker-up">Up</div><br><br>
|
| 251 | <div class="btn btn-success btn-picker-down">Down</div>
|
| 252 | </div>
|
| 253 | </div> |
| 254 | </div> |
| 255 | <% detailView.viewInitializers.push( function() { init_picker("#" + id); } ); %> |
| 256 | </script> |
| 257 | |
Scott Baker | 09ed3e0 | 2014-11-07 13:01:43 -0800 | [diff] [blame] | 258 | <script> |
| 259 | xosInlineDetailButtonsTemplate = _.template($("#xos-inline-detail-buttons-template").html()); |
Scott Baker | 2c97485 | 2014-12-04 17:23:27 -0800 | [diff] [blame] | 260 | xosListHeaderTemplate = _.template($("#xos-list-header-template").html()); |
| 261 | xosListFooterTemplate = _.template($("#xos-list-footer-template").html()); |
Scott Baker | b1e6333 | 2014-12-02 10:49:04 -0800 | [diff] [blame] | 262 | xosDeleteButtonTemplate = _.template($("#xos-delete-button-template").html()); |
| 263 | xosDetailLinkTemplate = _.template($("#xos-detail-link-template").html()); |
Scott Baker | a515007 | 2014-12-12 14:26:21 -0800 | [diff] [blame] | 264 | xosBackendStatusIconTemplate = _.template($("#xos-backend-status-icon-template").html()); |
Scott Baker | eb253d5 | 2014-12-12 14:46:24 -0800 | [diff] [blame] | 265 | xosBackendStatusTextTemplate = _.template($("#xos-backend-status-text-template").html()); |
Scott Baker | cde19e6 | 2014-12-16 22:49:42 -0800 | [diff] [blame] | 266 | xosPickerTemplate = _.template($("#xos-picker-template").html()); |
Scott Baker | 09ed3e0 | 2014-11-07 13:01:43 -0800 | [diff] [blame] | 267 | </script> |
Scott Baker | a322dba | 2014-12-08 23:54:18 -0800 | [diff] [blame] | 268 | |