|
| 1 | +<html ng-app="ionicApp"> |
| 2 | + <head> |
| 3 | + <meta charset="utf-8"> |
| 4 | + <title>Side Menus</title> |
| 5 | + |
| 6 | + <!-- Sets initial viewport load and disables zooming --> |
| 7 | + <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> |
| 8 | + <link rel="stylesheet" href="../../../../dist/css/ionic.css"> |
| 9 | + <script src="../../../../dist/js/ionic.js"></script> |
| 10 | + <script src="../../../../dist/js/angular/angular.js"></script> |
| 11 | + <script src="../../../../dist/js/angular/angular-animate.js"></script> |
| 12 | + <script src="../../../../dist/js/angular/angular-sanitize.js"></script> |
| 13 | + <script src="../../../../dist/js/angular-ui/angular-ui-router.js"></script> |
| 14 | + <script src="../../../../dist/js/ionic-angular.js"></script> |
| 15 | + </head> |
| 16 | + <body> |
| 17 | + |
| 18 | + <div ng-controller="MainCtrl"> |
| 19 | + <nav-view></nav-view> |
| 20 | + </div> |
| 21 | + |
| 22 | + <script id="event-menu.html" type="text/ng-template"> |
| 23 | + <side-menus> |
| 24 | + |
| 25 | + <pane side-menu-content> |
| 26 | + <nav-bar type="bar-positive" |
| 27 | + back-button-type="button-icon" |
| 28 | + back-button-icon="ion-ios7-arrow-back"></nav-bar> |
| 29 | + <nav-view name="menuContent"></nav-view> |
| 30 | + </pane> |
| 31 | + |
| 32 | + <side-menu side="left"> |
| 33 | + <header class="bar bar-header bar-assertive"> |
| 34 | + <div class="title">Left Menu</div> |
| 35 | + </header> |
| 36 | + <content has-header="true"> |
| 37 | + <ul class="list"> |
| 38 | + <a href="#/event/check-in" class="item">Check-in</a> |
| 39 | + <a href="#/event/attendees" class="item">Attendees</a> |
| 40 | + </ul> |
| 41 | + </content> |
| 42 | + </side-menu> |
| 43 | + |
| 44 | + </side-menus> |
| 45 | + </script> |
| 46 | + |
| 47 | + <script id="home.html" type="text/ng-template"> |
| 48 | + <view title="'Welcome'"> |
| 49 | + <content has-header="true" padding="true"> |
| 50 | + <p>Swipe to the right to reveal the left menu.</p> |
| 51 | + <p>(On desktop click and drag from left to right)</p> |
| 52 | + </content> |
| 53 | + </view> |
| 54 | + </script> |
| 55 | + |
| 56 | + <script id="check-in.html" type="text/ng-template"> |
| 57 | + <view title="'Event Check-in'"> |
| 58 | + <content has-header="true"> |
| 59 | + <form class="list" ng-show="showForm"> |
| 60 | + <div class="item item-divider"> |
| 61 | + Attendee Info |
| 62 | + </div> |
| 63 | + <label class="item item-input"> |
| 64 | + <input type="text" placeholder="First Name" ng-model="attendee.firstname"> |
| 65 | + </label> |
| 66 | + <label class="item item-input"> |
| 67 | + <input type="text" placeholder="Last Name" ng-model="attendee.lastname"> |
| 68 | + </label> |
| 69 | + <div class="item item-divider"> |
| 70 | + Shirt Size |
| 71 | + </div> |
| 72 | + <radio ng-repeat="shirtSize in shirtSizes" |
| 73 | + ng-value="shirtSize.value" |
| 74 | + ng-model="attendee.shirtSize"> |
| 75 | + {{ shirtSize.text }} |
| 76 | + </radio> |
| 77 | + <div class="item item-divider"> |
| 78 | + Lunch |
| 79 | + </div> |
| 80 | + <toggle ng-model="attendee.vegetarian"> |
| 81 | + Vegetarian |
| 82 | + </toggle> |
| 83 | + <div class="padding"> |
| 84 | + <button class="button button-block" ng-click="submit()">Checkin</button> |
| 85 | + </div> |
| 86 | + </form> |
| 87 | + |
| 88 | + <div ng-hide="showForm"> |
| 89 | + <pre ng-bind="attendee | json"></pre> |
| 90 | + <a href="#/event/attendees">View attendees</a> |
| 91 | + </div> |
| 92 | + </content> |
| 93 | + </view> |
| 94 | + </script> |
| 95 | + |
| 96 | + <script id="attendees.html" type="text/ng-template"> |
| 97 | + <view title="'Event Attendees'"> |
| 98 | + <content has-header="true"> |
| 99 | + <div class="list"> |
| 100 | + <toggle ng-repeat="attendee in attendees | orderBy:'firstname' | orderBy:'lastname'" |
| 101 | + ng-model="attendee.arrived" |
| 102 | + ng-change="arrivedChange(attendee)"> |
| 103 | + {{ attendee.firstname }} |
| 104 | + {{ attendee.lastname }} |
| 105 | + </toggle> |
| 106 | + <div class="item item-divider"> |
| 107 | + Activity |
| 108 | + </div> |
| 109 | + <div class="item" ng-repeat="msg in activity"> |
| 110 | + {{ msg }} |
| 111 | + </div> |
| 112 | + </div> |
| 113 | + </content> |
| 114 | + </view> |
| 115 | + </script> |
| 116 | + |
| 117 | + <script> |
| 118 | + angular.module('ionicApp', ['ionic']) |
| 119 | + |
| 120 | + .config(function($stateProvider, $urlRouterProvider) { |
| 121 | + |
| 122 | + $stateProvider |
| 123 | + .state('eventmenu', { |
| 124 | + url: "/event", |
| 125 | + abstract: true, |
| 126 | + templateUrl: "event-menu.html" |
| 127 | + }) |
| 128 | + .state('eventmenu.home', { |
| 129 | + url: "/home", |
| 130 | + views: { |
| 131 | + 'menuContent' :{ |
| 132 | + templateUrl: "home.html" |
| 133 | + } |
| 134 | + } |
| 135 | + }) |
| 136 | + .state('eventmenu.checkin', { |
| 137 | + url: "/check-in", |
| 138 | + views: { |
| 139 | + 'menuContent' :{ |
| 140 | + templateUrl: "check-in.html", |
| 141 | + controller: "CheckinCtrl" |
| 142 | + } |
| 143 | + } |
| 144 | + }) |
| 145 | + .state('eventmenu.attendees', { |
| 146 | + url: "/attendees", |
| 147 | + views: { |
| 148 | + 'menuContent' :{ |
| 149 | + templateUrl: "attendees.html", |
| 150 | + controller: "AttendeesCtrl" |
| 151 | + } |
| 152 | + } |
| 153 | + }) |
| 154 | + |
| 155 | + $urlRouterProvider.otherwise("/event/home"); |
| 156 | + }) |
| 157 | + |
| 158 | + .controller('MainCtrl', function($scope) { |
| 159 | + console.log('MainCtrl'); |
| 160 | + |
| 161 | + $scope.attendees = [ |
| 162 | + { firstname: 'Nicolas', lastname: 'Cage' }, |
| 163 | + { firstname: 'Jean-Claude', lastname: 'Van Damme' }, |
| 164 | + { firstname: 'Keanu', lastname: 'Reeves' }, |
| 165 | + { firstname: 'Steven', lastname: 'Seagal' }, |
| 166 | + { firstname: 'Jeff', lastname: 'Goldblum' }, |
| 167 | + { firstname: 'Brendan', lastname: 'Fraser' } |
| 168 | + ]; |
| 169 | + }) |
| 170 | + |
| 171 | + .controller('CheckinCtrl', function($scope) { |
| 172 | + $scope.showForm = true; |
| 173 | + |
| 174 | + $scope.shirtSizes = [ |
| 175 | + { text: 'Large', value: 'L' }, |
| 176 | + { text: 'Medium', value: 'M' }, |
| 177 | + { text: 'Small', value: 'S' } |
| 178 | + ]; |
| 179 | + |
| 180 | + $scope.attendee = {}; |
| 181 | + $scope.submit = function() { |
| 182 | + if(!$scope.attendee.firstname) { |
| 183 | + alert('Info required'); |
| 184 | + return; |
| 185 | + } |
| 186 | + $scope.showForm = false; |
| 187 | + $scope.attendees.push($scope.attendee); |
| 188 | + }; |
| 189 | + |
| 190 | + }) |
| 191 | + |
| 192 | + .controller('AttendeesCtrl', function($scope) { |
| 193 | + |
| 194 | + $scope.activity = []; |
| 195 | + $scope.arrivedChange = function(attendee) { |
| 196 | + var msg = attendee.firstname + ' ' + attendee.lastname; |
| 197 | + msg += (!attendee.arrived ? ' has arrived, ' : ' just left, '); |
| 198 | + msg += new Date().getMilliseconds(); |
| 199 | + $scope.activity.push(msg); |
| 200 | + if($scope.activity.length > 3) { |
| 201 | + $scope.activity.splice(0, 1); |
| 202 | + } |
| 203 | + }; |
| 204 | + |
| 205 | + }); |
| 206 | + </script> |
| 207 | + </body> |
| 208 | +</html> |
| 209 | + |
0 commit comments