|
3 | 3 | <h2><%= _.capitalize(pluralize(name)) %></h2>
|
4 | 4 |
|
5 | 5 | <script type = "text/ng-template" id="<%= name %>-save.html">
|
6 |
| - <div class="modal-dialog"> |
7 |
| - <div class="modal-content"> |
8 |
| - <form name="form" role="form" novalidate |
9 |
| - class="ng-scope ng-invalid ng-invalid-required ng-dirty" |
10 |
| - ng-submit="ok()"> |
| 6 | + <form name="form" role="form" novalidate |
| 7 | + class="ng-scope ng-invalid ng-invalid-required ng-dirty" |
| 8 | + ng-submit="ok()"> |
11 | 9 |
|
12 |
| - <div class="modal-header"> |
13 |
| - <button type="button" class="close" |
14 |
| - ng-click="cancel()">×</button> |
15 |
| - <h4 class="modal-title" id="my<%= _.capitalize(name) %>Label">Create or edit a <%= _.capitalize(name) %></h4> |
16 |
| - </div> |
17 |
| - <div class="modal-body"> |
18 |
| - <div class="form-group"> |
19 |
| - <label>ID</label> |
20 |
| - <input type="text" class="form-control" name="id" |
21 |
| - ng-model="<%= name %>.id" readonly> |
22 |
| - </div> |
| 10 | + <div class="modal-header"> |
| 11 | + <button type="button" class="close" |
| 12 | + ng-click="cancel()">×</button> |
| 13 | + <h4 class="modal-title" id="my<%= _.capitalize(name) %>Label">Create or edit a <%= _.capitalize(name) %></h4> |
| 14 | + </div> |
| 15 | + <div class="modal-body"> |
| 16 | + <div class="form-group"> |
| 17 | + <label>ID</label> |
| 18 | + <input type="text" class="form-control" name="id" |
| 19 | + ng-model="<%= name %>.id" readonly> |
| 20 | + </div> |
23 | 21 |
|
24 |
| - <% _.each(attrs, function (attr) { %> |
25 |
| - <div class="form-group"> |
26 |
| - <label><%= attr.attrName %>:</label> |
27 |
| - <% if (attr.attrType === "String") { %> |
28 |
| - <input type="text" class="form-control" name="<%= attr.attrName %>" |
29 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
30 |
| - <% if (attr.minLength) { %>ng-minlength=<%= attr.minLength %> <% } %><% if (attr.maxLength) { %>ng-maxlength=<%= attr.maxLength %><% } %>/> |
31 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.minlength">Must be at least <%= attr.minLength %> characters.</span> |
32 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.maxlength">Must be at most <%= attr.maxLength %> characters.</span><% |
33 |
| - } else if (attr.attrType === "Integer") { %> |
34 |
| - <input type="number" class="form-control" name="<%= attr.attrName %>" |
35 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
36 |
| - <% if (attr.min) { %>min=<%= attr.min%> <% } %><% if (attr.max) { %>max=<%= attr.max %><% } %>/> |
37 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.min">Must be greater than or equal to <%= attr.min %>.</span> |
38 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.max">Must be less than or equal to <%= attr.max %>.</span><% |
39 |
| - } else if (attr.attrType === "Float") { %> |
40 |
| - <input type="number" step="any" class="form-control" name="<%= attr.attrName %>" |
41 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
42 |
| - <% if (attr.min) { %>min=<%= attr.min%> <% } %><% if (attr.max) { %>max=<%= attr.max %><% } %>/> |
43 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.min">Must be greater than or equal to <%= attr.min %>.</span> |
44 |
| - <span class="error" ng-show="form.<%= attr.attrName %>.$error.max">Must be less than or equal to <%= attr.max %>.</span><% |
45 |
| - } else if (attr.attrType === "Boolean") { %> |
46 |
| - <input type="checkbox" name="<%= attr.attrName %>" |
47 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/><% |
48 |
| - } else if (attr.attrType === "Date") { %> |
49 |
| - <input type="text" class="form-control" name="<%= attr.attrName %>" ui-date="<%= attr.attrName %>DateOptions" ui-date-format="yy-mm-dd" |
50 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/><% |
51 |
| - } else if (attr.attrType === "Enum") { |
52 |
| - _.each(attr.enumValues, function (value) { %> |
53 |
| - <label class="radio"><input type="radio" name="<%= attr.attrName %>" value="<%= value %>" |
54 |
| - ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/> <%= value %> </label><% })} %> |
55 |
| - </div> |
56 |
| - <% }); %> |
| 22 | + <% _.each(attrs, function (attr) { %> |
| 23 | + <div class="form-group"> |
| 24 | + <label><%= attr.attrName %>:</label> |
| 25 | + <% if (attr.attrType === "String") { %> |
| 26 | + <input type="text" class="form-control" name="<%= attr.attrName %>" |
| 27 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
| 28 | + <% if (attr.minLength) { %>ng-minlength=<%= attr.minLength %> <% } %><% if (attr.maxLength) { %>ng-maxlength=<%= attr.maxLength %><% } %>/> |
| 29 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.minlength">Must be at least <%= attr.minLength %> characters.</span> |
| 30 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.maxlength">Must be at most <%= attr.maxLength %> characters.</span><% |
| 31 | + } else if (attr.attrType === "Integer") { %> |
| 32 | + <input type="number" class="form-control" name="<%= attr.attrName %>" |
| 33 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
| 34 | + <% if (attr.min) { %>min=<%= attr.min%> <% } %><% if (attr.max) { %>max=<%= attr.max %><% } %>/> |
| 35 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.min">Must be greater than or equal to <%= attr.min %>.</span> |
| 36 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.max">Must be less than or equal to <%= attr.max %>.</span><% |
| 37 | + } else if (attr.attrType === "Float") { %> |
| 38 | + <input type="number" step="any" class="form-control" name="<%= attr.attrName %>" |
| 39 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>" |
| 40 | + <% if (attr.min) { %>min=<%= attr.min%> <% } %><% if (attr.max) { %>max=<%= attr.max %><% } %>/> |
| 41 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.min">Must be greater than or equal to <%= attr.min %>.</span> |
| 42 | + <span class="error" ng-show="form.<%= attr.attrName %>.$error.max">Must be less than or equal to <%= attr.max %>.</span><% |
| 43 | + } else if (attr.attrType === "Boolean") { %> |
| 44 | + <input type="checkbox" name="<%= attr.attrName %>" |
| 45 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/><% |
| 46 | + } else if (attr.attrType === "Date") { %> |
| 47 | + <input type="text" class="form-control" name="<%= attr.attrName %>" ui-date="<%= attr.attrName %>DateOptions" ui-date-format="yy-mm-dd" |
| 48 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/><% |
| 49 | + } else if (attr.attrType === "Enum") { |
| 50 | + _.each(attr.enumValues, function (value) { %> |
| 51 | + <label class="radio"><input type="radio" name="<%= attr.attrName %>" value="<%= value %>" |
| 52 | + ng-model="<%= name %>.<%= attr.attrName %>" ng-required="<%= attr.required %>"/> <%= value %> </label><% })} %> |
| 53 | + </div> |
| 54 | + <% }); %> |
57 | 55 |
|
58 |
| - </div> |
59 |
| - <div class="modal-footer"> |
60 |
| - <button type="button" class="btn btn-default" ng-click="cancel()">Cancel |
61 |
| - </button> |
62 |
| - <button type="submit" ng-disabled="form.$invalid" class="btn btn-primary">Save</button> |
63 |
| - </div> |
64 |
| - </form> |
65 | 56 | </div>
|
66 |
| - </div> |
| 57 | + <div class="modal-footer"> |
| 58 | + <button type="button" class="btn btn-default" ng-click="cancel()">Cancel |
| 59 | + </button> |
| 60 | + <button type="submit" ng-disabled="form.$invalid" class="btn btn-primary">Save</button> |
| 61 | + </div> |
| 62 | + </form> |
67 | 63 | </script>
|
68 | 64 |
|
69 | 65 | <button class="btn btn-primary btn-lg" ng-click="create()">
|
|
0 commit comments