|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <script src="components/angular/angular.js"></script> |
| 5 | + <script src="components/angular-route/angular-route.js"></script> |
| 6 | + <script src="message-center.js"></script> |
| 7 | + <script> |
| 8 | + angular.module('messageCenter.e2e', ['MessageCenterModule', 'ngRoute']) |
| 9 | + .config(function($routeProvider) { |
| 10 | + $routeProvider |
| 11 | + .when('/', { templateUrl: 'home' }) |
| 12 | + .when('/edit', { templateUrl: 'edit' }) |
| 13 | + .when('/html', { templateUrl: 'html' }) |
| 14 | + .when('/permanent', { templateUrl: 'permanent' }); |
| 15 | + }) |
| 16 | + |
| 17 | + .controller('HomeController', function($scope, $location, messageCenterService) { |
| 18 | + $scope.goIndex = function() { |
| 19 | + $location.path('/'); |
| 20 | + }; |
| 21 | + $scope.goEdit = function() { |
| 22 | + $location.path('/edit'); |
| 23 | + }; |
| 24 | + $scope.goHTML = function() { |
| 25 | + $location.path('/html'); |
| 26 | + }; |
| 27 | + $scope.goPermanent = function() { |
| 28 | + messageCenterService.add('success', 'Showing permanent message!', {status: messageCenterService.status.permanent}); |
| 29 | + $location.path('/permanent'); |
| 30 | + }; |
| 31 | + $scope.goEditSuccess = function() { |
| 32 | + messageCenterService.add('success', 'You have reached the edit page!', {status: messageCenterService.status.next}); |
| 33 | + $scope.goEdit(); |
| 34 | + }; |
| 35 | + $scope.goEditMultipleSuccess = function() { |
| 36 | + messageCenterService.add('success', 'Yay!', {status: messageCenterService.status.next}); |
| 37 | + messageCenterService.add('success', 'You have reached the edit page!', {status: messageCenterService.status.next}); |
| 38 | + $scope.goEdit(); |
| 39 | + }; |
| 40 | + $scope.goEditMultipleTypes = function() { |
| 41 | + messageCenterService.add('success', 'Yay!', {status: messageCenterService.status.next}); |
| 42 | + messageCenterService.add('danger', 'Something went wrong!', {status: messageCenterService.status.next}); |
| 43 | + $scope.goEdit(); |
| 44 | + }; |
| 45 | + $scope.goEditFailure = function() { |
| 46 | + messageCenterService.add('danger', 'Something went wrong!', {status: messageCenterService.status.next}); |
| 47 | + $scope.goEdit(); |
| 48 | + }; |
| 49 | + }) |
| 50 | + |
| 51 | + .controller('EditController', function($scope, $location, messageCenterService) { |
| 52 | + $scope.saveSuccess = function() { |
| 53 | + messageCenterService.add('success', 'Saved successfully!'); |
| 54 | + }; |
| 55 | + $scope.saveMultipleSuccess = function() { |
| 56 | + messageCenterService.add('success', 'Yay!'); |
| 57 | + messageCenterService.add('success', 'Saved successfully!'); |
| 58 | + }; |
| 59 | + $scope.saveMultipleTypes = function() { |
| 60 | + messageCenterService.add('success', 'Yay!'); |
| 61 | + messageCenterService.add('danger', 'Something went wrong!'); |
| 62 | + }; |
| 63 | + $scope.saveFailure = function() { |
| 64 | + messageCenterService.add('danger', 'Something went wrong!'); |
| 65 | + }; |
| 66 | + $scope.saveSuccessGoHome = function() { |
| 67 | + messageCenterService.add('success', 'Saved successfully and went home!', {status: messageCenterService.status.next}); |
| 68 | + $scope.goIndex(); |
| 69 | + }; |
| 70 | + $scope.goIndex = function() { |
| 71 | + $location.path('/'); |
| 72 | + }; |
| 73 | + }) |
| 74 | + |
| 75 | + .controller('AllowHTMLController', function($scope, $location, messageCenterService) { |
| 76 | + $scope.allowedHTML = function() { |
| 77 | + messageCenterService.add('success', '<strong>HTML</strong> <em>is</em> <span>allowed</span>.', {html: true}); |
| 78 | + }; |
| 79 | + $scope.plainText = function() { |
| 80 | + messageCenterService.add('warning', '<strong>HTML</strong> <em>is</em> NOT <span>allowed</span>.'); |
| 81 | + }; |
| 82 | + }) |
| 83 | + |
| 84 | + .controller('PermanentController', function($scope, $location, messageCenterService) { |
| 85 | + $scope.goIndex = function() { |
| 86 | + $location.path('/'); |
| 87 | + }; |
| 88 | + }) |
| 89 | + ; |
| 90 | + </script> |
| 91 | + </head> |
| 92 | + |
| 93 | + <body data-ng-app="messageCenter.e2e"> |
| 94 | + <script type="text/ng-template" id="home"> |
| 95 | + <article data-ng-controller="HomeController" > |
| 96 | + <div mc-messages></div> |
| 97 | + <h1>Home</h1> |
| 98 | + <button id="goIndex" data-ng-click="goIndex()">Index page</button> |
| 99 | + <button id="goEdit" data-ng-click="goEdit()">Edit page</button> |
| 100 | + <button id="goHTML" data-ng-click="goHTML()">HTML page</button> |
| 101 | + <button id="goPermanent" data-ng-click="goPermanent()">Permanent page</button> |
| 102 | + <button id="goEditSuccess" data-ng-click="goEditSuccess()">Edit (success)</button> |
| 103 | + <button id="goEditMultipleSuccess" data-ng-click="goEditMultipleSuccess()">Edit (multiple success)</button> |
| 104 | + <button id="goEditMultipleTypes" data-ng-click="goEditMultipleTypes()">Edit (multiple types)</button> |
| 105 | + <button id="goEditFailure" data-ng-click="goEditFailure()">Edit (failure)</button> |
| 106 | + <button id="testPermanent" data-ng-click="testPermanent()">Test permanent</button> |
| 107 | + <button id="testPermanentClose" data-ng-click="testPermanent()">Test permanent (close)</button> |
| 108 | + </article> |
| 109 | + </script> |
| 110 | + |
| 111 | + <script type="text/ng-template" id="edit"> |
| 112 | + <article data-ng-controller="EditController"> |
| 113 | + <div mc-messages></div> |
| 114 | + <h1>Edit</h1> |
| 115 | + <button id="saveSuccess" data-ng-click="saveSuccess()">Save</button> |
| 116 | + <button id="saveMultipleSuccess" data-ng-click="saveMultipleSuccess()">Save (multiple success)</button> |
| 117 | + <button id="saveMultipleTypes" data-ng-click="saveMultipleTypes()">Save (multiple types)</button> |
| 118 | + <button id="saveFailure" data-ng-click="saveFailure()">Save (failure)</button> |
| 119 | + <button id="saveSuccessGoHome" data-ng-click="saveSuccessGoHome()">Save and Go Home</button> |
| 120 | + |
| 121 | + </article> |
| 122 | + </script> |
| 123 | + |
| 124 | + <script type="text/ng-template" id="html"> |
| 125 | + <article data-ng-controller="AllowHTMLController"> |
| 126 | + <div mc-messages></div> |
| 127 | + <h1>HTML</h1> |
| 128 | + <button id="allowedHTML" data-ng-click="allowedHTML()">Allowed HTML</button> |
| 129 | + <button id="plainText" data-ng-click="plainText()">Plain Text</button> |
| 130 | + </article> |
| 131 | + </script> |
| 132 | + |
| 133 | + <script type="text/ng-template" id="permanent"> |
| 134 | + <article data-ng-controller="PermanentController"> |
| 135 | + <div mc-messages></div> |
| 136 | + <h1>Permanent</h1> |
| 137 | + <button id="goIndex" data-ng-click="goIndex()">Index page</button> |
| 138 | + </article> |
| 139 | + </script> |
| 140 | + |
| 141 | + |
| 142 | + <article data-ng-view /> |
| 143 | + </body> |
| 144 | +</html> |
0 commit comments