Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

app.js 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. 'pascalprecht.translate',
  11. 'luticate2Utils',
  12. // 'luticateAuth',
  13. 'appSdk'
  14. ])
  15. .config(['$stateProvider', '$urlRouterProvider', 'ssSideNavSectionsProvider', '$mdThemingProvider', '$mdIconProvider', '$translateProvider',
  16. function($stateProvider, $urlRouterProvider, ssSideNavSectionsProvider, $mdThemingProvider, $mdIconProvider, $translateProvider) {
  17. // $mdThemingProvider
  18. // .theme('default')
  19. // .primaryPalette('blue', {
  20. // 'default': '700'
  21. // });
  22. // $mdThemingProvider.theme('default')
  23. // .primaryPalette('blue')
  24. // .accentPalette('pink');
  25. $translateProvider.useSanitizeValueStrategy('escape');
  26. $translateProvider.useMessageFormatInterpolation();
  27. $translateProvider.useStaticFilesLoader({
  28. prefix: 'translations/',
  29. suffix: '.json'
  30. });
  31. $translateProvider.preferredLanguage('en');
  32. $mdIconProvider
  33. .icon('md-toggle-arrow', 'img/arrow.svg');
  34. ssSideNavSectionsProvider.initWithTheme($mdThemingProvider);
  35. ssSideNavSectionsProvider.initWithSections([{
  36. id: 'toogle_1',
  37. name: 'home.name',
  38. type: 'heading',
  39. children: [{
  40. name: 'home.name',
  41. type: 'toggle',
  42. pages: [{
  43. id: 'toogle_1_link_1',
  44. name: 'home.name',
  45. state: 'home'
  46. }, {
  47. id: 'toogle_1_link_2',
  48. name: 'Home 1 2',
  49. state: 'home.1.2',
  50. hidden: true
  51. }, {
  52. id: 'toogle_1_link_3',
  53. name: 'home.name',
  54. state: 'home.1.3'
  55. }]
  56. }]
  57. }, {
  58. id: 'link_1',
  59. name: 'home.name',
  60. state: 'home.2',
  61. type: 'link',
  62. icon: 'fa fa-check'
  63. }, {
  64. id: 'link_2',
  65. name: 'home.name',
  66. state: 'home.3',
  67. type: 'link'
  68. }, {
  69. id: 'link_3',
  70. name: 'home.name',
  71. state: 'common.link3',
  72. type: 'link',
  73. hidden: true
  74. }, {
  75. id: 'toogle_2',
  76. name: 'pkguid.name',
  77. type: 'heading',
  78. children: [{
  79. name: 'pkguid.name',
  80. type: 'toggle',
  81. pages: [{
  82. id: 'toogle_2_link_1',
  83. name: 'common.all',
  84. state: 'pkguid'
  85. },{
  86. id: 'toogle_2_link_1',
  87. name: 'common.new',
  88. state: 'pkguid_add'
  89. }]
  90. }]
  91. }]);
  92. $stateProvider.state('root', {
  93. abstract: true,
  94. template: '<div ui-view=""></div>',
  95. // resolve: ['luticateAuthUsers', function(luticateAuthUsers)
  96. // {
  97. // return luticateAuthUsers.loadUserData(null);
  98. // }]
  99. });
  100. $stateProvider.state('home', {
  101. url:'/',
  102. parent: 'root',
  103. title: "home.name",
  104. reloadOnSearch: false,
  105. templateUrl:'views/home.html',
  106. controller:'HomeController'
  107. });
  108. $stateProvider.state('pkguid', {
  109. url:'/pkguids',
  110. parent: 'root',
  111. title: "pkguid.name",
  112. reloadOnSearch: false,
  113. templateUrl:'views/pkguid.html',
  114. controller:'PkGuidController'
  115. });
  116. $stateProvider.state('pkguid_add', {
  117. url:'/pkguids/add',
  118. parent: 'root',
  119. title: "pkguid.add.defaultTitle",
  120. toolbarTitle: "pkguid.add.defaultToolbarTitle",
  121. reloadOnSearch: false,
  122. templateUrl:'views/pkguidedit.html',
  123. controller:'PkGuidEditController'
  124. });
  125. $stateProvider.state('pkguid_edit', {
  126. url:'/pkguids/edit/:id',
  127. parent: 'root',
  128. title: "pkguid.edit.defaultTitle",
  129. toolbarTitle: "pkguid.edit.defaultToolbarTitle",
  130. reloadOnSearch: false,
  131. templateUrl:'views/pkguidedit.html',
  132. controller:'PkGuidEditController',
  133. params: {
  134. pkguid: null
  135. }
  136. });
  137. $urlRouterProvider.otherwise('/');
  138. }])
  139. .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate) {
  140. $translate('common.appName').then(function() {
  141. for (var i = 0; i < ssSideNav.sections.length; ++i) {
  142. var a = ssSideNav.sections[i];
  143. a.name = AppUtilsBusiness.tr(a.name);
  144. if (a.children != null) {
  145. for (var j = 0; j < a.children.length; ++j) {
  146. var b = a.children[j];
  147. b.name = AppUtilsBusiness.tr(b.name);
  148. if (b.pages != null) {
  149. for (var k = 0; k < b.pages.length; ++k) {
  150. var c = b.pages[k];
  151. c.name = AppUtilsBusiness.tr(c.name);
  152. }
  153. }
  154. }
  155. }
  156. }
  157. }, function (error) {
  158. console.error(error);
  159. });
  160. $transitions.onEnter({}, function($transitions)
  161. {
  162. var toState = $transitions.$to();
  163. var title = toState.title != null ? toState.title : toState.toolbarTitle != null ? toState.toolbarTitle : null;
  164. var toolbarTitle = toState.toolbarTitle != null ? toState.toolbarTitle : toState.title != null ? toState.title : null;
  165. if (title != null) {
  166. AppUtilsBusiness.setTitle(AppUtilsBusiness.tr(title));
  167. }
  168. if (toolbarTitle != null) {
  169. AppUtilsBusiness.setToolbarTitle(AppUtilsBusiness.tr(toolbarTitle));
  170. }
  171. });
  172. }]);