|
| 1 | +<!DOCTYPE html> |
| 2 | + |
| 3 | +<html ng-app="items"> |
| 4 | +<head> |
| 5 | + <title>To Do List</title> |
| 6 | + |
| 7 | + <link rel="stylesheet" href="lib/dependencies/css/bootstrap.min.css" /> |
| 8 | + <link rel="stylesheet" href="lib/dependencies/css/ng-grid.min.css" /> |
| 9 | + |
| 10 | + <!-- build:css css/application.css --> |
| 11 | + <link rel="stylesheet" type="text/css" href="css/style.css"/> |
| 12 | + <!-- endbuild --> |
| 13 | + |
| 14 | + <script src="lib/dependencies/jquery.min.js"></script> |
| 15 | + <script src="lib/dependencies/angular.min.js"></script> |
| 16 | + <script src="lib/dependencies/angular-resource.min.js"></script> |
| 17 | + <script src="lib/dependencies/ng-grid-2.0.11.min.js"></script> |
| 18 | + <script src="lib/dependencies/ui-bootstrap-tpls.min.js"></script> |
| 19 | + |
| 20 | + <!-- build:js script/all.js --> |
| 21 | + <script src="script/item.js"></script> |
| 22 | + <!-- endbuild --> |
| 23 | +</head> |
| 24 | + |
| 25 | +<body> |
| 26 | + |
| 27 | +<h1>To Do List Application</h1> |
| 28 | + |
| 29 | +<br/> |
| 30 | + |
| 31 | +<!-- Specify a Angular controller script that binds Javascript variables to the feedback messages.--> |
| 32 | +<div class="message" ng-controller="alertMessagesController"> |
| 33 | + <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert> |
| 34 | +</div> |
| 35 | + |
| 36 | +<br> |
| 37 | + |
| 38 | +<!-- Specify a Angular controller script that binds Javascript variables to the grid.--> |
| 39 | +<div class="grid" ng-controller="itemsListController"> |
| 40 | + <div> |
| 41 | + <h3>To Do List</h3> |
| 42 | + </div> |
| 43 | + |
| 44 | + <!-- Binds the grid component to be displayed. --> |
| 45 | + <div class="gridStyle" ng-grid="gridOptions"></div> |
| 46 | + |
| 47 | + <!-- Bind the pagination component to be displayed. --> |
| 48 | + <pagination direction-links="true" boundary-links="true" |
| 49 | + total-items="items.totalResults" items-per-page="items.pageSize" |
| 50 | + ng-model="items.currentPage" ng-change="refreshGrid()"> |
| 51 | + </pagination> |
| 52 | +</div> |
| 53 | + |
| 54 | +<!-- Specify a Angular controller script that binds Javascript variables to the form.--> |
| 55 | +<div class="form" ng-controller="itemsFormController"> |
| 56 | + <!-- Verify item, if there is no id present, that we are Adding a Item --> |
| 57 | + <div ng-if="item.id == null"> |
| 58 | + <h3>Add Task</h3> |
| 59 | + </div> |
| 60 | + <!-- Otherwise it's an Edit --> |
| 61 | + <div ng-if="item.id != null"> |
| 62 | + <h3>Edit Task</h3> |
| 63 | + </div> |
| 64 | + |
| 65 | + <div> |
| 66 | + <!-- Specify the function to be called on submit and disable HTML5 validation, since we're using Angular validation--> |
| 67 | + <form name="itemForm" ng-submit="updateItem()" novalidate> |
| 68 | + |
| 69 | + <!-- Display an error if the input is invalid and is dirty (only when someone changes the value) --> |
| 70 | + <div class="form-group" ng-class="{'has-error' : itemForm.description.$invalid && itemForm.description.$dirty}"> |
| 71 | + <label for="description">Description:</label> |
| 72 | + <!-- Display a check when the field is valid and was modified --> |
| 73 | + <span ng-class="{'glyphicon glyphicon-ok' : itemForm.description.$valid && itemForm.description.$dirty}"></span> |
| 74 | + |
| 75 | + <input id="description" name="description" type="text" class="form-control" maxlength="100" |
| 76 | + ng-model="item.description" |
| 77 | + required ng-minlength="5" ng-maxlength="100"/> |
| 78 | + |
| 79 | + <!-- Validation messages to be displayed on required, minlength and maxlength --> |
| 80 | + <p class="help-block" ng-show="itemForm.description.$error.required">Add Description.</p> |
| 81 | + <p class="help-block" ng-show="itemForm.description.$error.minlength">Description must be at least 5 characters long.</p> |
| 82 | + <p class="help-block" ng-show="itemForm.description.$error.maxlength">Description cannot be longer than 100 characters.</p> |
| 83 | + </div> |
| 84 | + |
| 85 | + <div class="form-group" ng-class="{'has-error' : itemForm.done.$invalid && itemForm.done.$dirty}"> |
| 86 | + <label for="done">Completed:</label> |
| 87 | + <!-- Display a check when the field is valid and was modified --> |
| 88 | + <span ng-class="{'glyphicon glyphicon-ok' : itemForm.done.$valid && itemForm.done.$dirty}"></span> |
| 89 | + |
| 90 | + <input id="done" name="done" type="checkbox" class="form-control" |
| 91 | + ng-model="item.done" /> |
| 92 | + |
| 93 | + </div> |
| 94 | + |
| 95 | + <!-- Form buttons. The 'Save' button is only enabled when the form is valid. --> |
| 96 | + <div class="buttons"> |
| 97 | + <button type="button" class="btn btn-primary" ng-click="clearForm()">Clear</button> |
| 98 | + <button type="submit" class="btn btn-primary" ng-disabled="itemForm.$invalid">Save</button> |
| 99 | + </div> |
| 100 | + </form> |
| 101 | + </div> |
| 102 | +</div> |
| 103 | +<div class="footer" ng-controller="hostController"> |
| 104 | +From host: {{host.hostname}} / {{host.ip}} |
| 105 | +</div> |
| 106 | +</body> |
| 107 | +</html> |
0 commit comments