app.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var yltApp = angular.module('YellowLabTools', [
  2. 'ngRoute',
  3. 'ngSanitize',
  4. 'indexCtrl',
  5. 'aboutCtrl',
  6. 'dashboardCtrl',
  7. 'queueCtrl',
  8. 'ruleCtrl',
  9. 'timelineCtrl',
  10. 'runsFactory',
  11. 'resultsFactory',
  12. 'menuService',
  13. 'gradeDirective',
  14. ]);
  15. yltApp.run(['$rootScope', '$location', function($rootScope, $location) {
  16. $rootScope.loadedRunId = null;
  17. // Google Analytics
  18. $rootScope.$on('$routeChangeSuccess', function(){
  19. ga('send', 'pageview', {'page': $location.path()});
  20. });
  21. }]);
  22. yltApp.config(['$routeProvider', '$locationProvider',
  23. function($routeProvider, $locationProvider) {
  24. $routeProvider.
  25. when('/', {
  26. templateUrl: 'views/index.html',
  27. controller: 'IndexCtrl'
  28. }).
  29. when('/queue/:runId', {
  30. templateUrl: 'views/queue.html',
  31. controller: 'QueueCtrl'
  32. }).
  33. when('/about', {
  34. templateUrl: 'views/about.html',
  35. controller: 'AboutCtrl'
  36. }).
  37. when('/result/:runId', {
  38. templateUrl: 'views/dashboard.html',
  39. controller: 'DashboardCtrl'
  40. }).
  41. when('/result/:runId/timeline', {
  42. templateUrl: 'views/timeline.html',
  43. controller: 'TimelineCtrl'
  44. }).
  45. when('/result/:runId/rule/:policy', {
  46. templateUrl: 'views/rule.html',
  47. controller: 'RuleCtrl'
  48. }).
  49. otherwise({
  50. redirectTo: '/'
  51. });
  52. $locationProvider.html5Mode(true);
  53. }
  54. ]);