You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. 'use strict';
  2. /* App Module */
  3. angular.module('app', [
  4. 'ui.bootstrap',
  5. 'ui.router',
  6. 'LocalStorageModule',
  7. 'ngMaterial',
  8. 'md.data.table',
  9. 'sasrio.angular-material-sidenav',
  10. 'luticate2Utils',
  11. // 'luticateAuth',
  12. 'appSdk'
  13. ])
  14. .config(['$stateProvider', '$urlRouterProvider', 'ssSideNavSectionsProvider', '$mdThemingProvider', '$mdIconProvider',
  15. function($stateProvider, $urlRouterProvider, ssSideNavSectionsProvider, $mdThemingProvider, $mdIconProvider) {
  16. // $mdThemingProvider
  17. // .theme('default')
  18. // .primaryPalette('blue', {
  19. // 'default': '700'
  20. // });
  21. // $mdThemingProvider.theme('default')
  22. // .primaryPalette('blue')
  23. // .accentPalette('pink');
  24. $mdIconProvider
  25. .icon('md-toggle-arrow', 'img/arrow.svg');
  26. ssSideNavSectionsProvider.initWithTheme($mdThemingProvider);
  27. ssSideNavSectionsProvider.initWithSections([{
  28. id: 'toogle_1',
  29. name: 'Home',
  30. type: 'heading',
  31. children: [{
  32. name: 'Home 1',
  33. type: 'toggle',
  34. pages: [{
  35. id: 'toogle_1_link_1',
  36. name: 'Home 1 1',
  37. state: 'home'
  38. }, {
  39. id: 'toogle_1_link_2',
  40. name: 'Home 1 2',
  41. state: 'home.1.2',
  42. hidden: true
  43. }, {
  44. id: 'toogle_1_link_3',
  45. name: 'Home 1 3',
  46. state: 'home.1.3'
  47. }]
  48. }]
  49. }, {
  50. id: 'link_1',
  51. name: 'Home 2 ',
  52. state: 'home.2',
  53. type: 'link',
  54. icon: 'fa fa-check'
  55. }, {
  56. id: 'link_2',
  57. name: 'Home 3',
  58. state: 'home.3',
  59. type: 'link'
  60. }, {
  61. id: 'link_3',
  62. name: 'Link 3',
  63. state: 'common.link3',
  64. type: 'link',
  65. hidden: true
  66. }, {
  67. id: 'toogle_2',
  68. name: 'PkGuid',
  69. type: 'heading',
  70. children: [{
  71. name: 'PkGuids',
  72. type: 'toggle',
  73. pages: [{
  74. id: 'toogle_2_link_1',
  75. name: 'All',
  76. state: 'pkguid'
  77. },{
  78. id: 'toogle_2_link_1',
  79. name: 'New',
  80. state: 'pkguid_add'
  81. }]
  82. }]
  83. }]);
  84. $stateProvider.state('root', {
  85. abstract: true,
  86. template: '<div ui-view=""></div>',
  87. // resolve: ['luticateAuthUsers', function(luticateAuthUsers)
  88. // {
  89. // return luticateAuthUsers.loadUserData(null);
  90. // }]
  91. });
  92. $stateProvider.state('home', {
  93. url:'/',
  94. parent: 'root',
  95. title: "Home",
  96. reloadOnSearch: false,
  97. templateUrl:'views/home.html',
  98. controller:'HomeController'
  99. });
  100. $stateProvider.state('pkguid', {
  101. url:'/pkguids',
  102. parent: 'root',
  103. title: "PkGuid",
  104. reloadOnSearch: false,
  105. templateUrl:'views/pkguid.html',
  106. controller:'PkGuidController'
  107. });
  108. $stateProvider.state('pkguid_add', {
  109. url:'/pkguids/add',
  110. parent: 'root',
  111. title: "New PkGuid",
  112. toolbarTitle: "PkGuid ~ New",
  113. reloadOnSearch: false,
  114. templateUrl:'views/pkguidedit.html',
  115. controller:'PkGuidEditController'
  116. });
  117. $stateProvider.state('pkguid_edit', {
  118. url:'/pkguids/edit/:id',
  119. parent: 'root',
  120. title: "Edit PkGuid",
  121. toolbarTitle: "PkGuid ~ Edit",
  122. reloadOnSearch: false,
  123. templateUrl:'views/pkguidedit.html',
  124. controller:'PkGuidEditController',
  125. params: {
  126. pkguid: null
  127. }
  128. });
  129. $urlRouterProvider.otherwise('/');
  130. }])
  131. .directive('dateNow', ['$filter', function($filter) {
  132. return {
  133. link: function( $scope, $element, $attrs) {
  134. $element.text($filter('date')(new Date(), $attrs.dateNow));
  135. }
  136. };
  137. }])
  138. .run(['$rootScope', '$transitions', 'AppUtilsBusiness', function ($rootScope, $transitions, AppUtilsBusiness) {
  139. $transitions.onEnter({}, function($transitions)
  140. {
  141. var toState = $transitions.$to();
  142. var title = toState.title != null ? toState.title : toState.toolbarTitle != null ? toState.toolbarTitle : null;
  143. var toolbarTitle = toState.toolbarTitle != null ? toState.toolbarTitle : toState.title != null ? toState.title : null;
  144. if (title != null) {
  145. AppUtilsBusiness.setTitle(title);
  146. }
  147. if (toolbarTitle != null) {
  148. AppUtilsBusiness.setToolbarTitle(toolbarTitle);
  149. }
  150. });
  151. }]);