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.

123 lines
3.1 KiB

  1. // Ionic Starter App
  2. // angular.module is a global place for creating, registering and retrieving Angular modules
  3. // 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
  4. // the 2nd parameter is an array of 'requires'
  5. // 'starter.controllers' is found in controllers.js
  6. angular.module('starter', ['ionic',
  7. 'starter.controllers',
  8. 'pascalprecht.translate'])
  9. .run(function($ionicPlatform) {
  10. $ionicPlatform.ready(function() {
  11. // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  12. // for form inputs)
  13. if (window.cordova && window.cordova.plugins.Keyboard) {
  14. cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  15. cordova.plugins.Keyboard.disableScroll(true);
  16. }
  17. if (window.StatusBar) {
  18. // org.apache.cordova.statusbar required
  19. StatusBar.styleDefault();
  20. }
  21. });
  22. })
  23. .config(function($stateProvider, $urlRouterProvider) {
  24. $stateProvider
  25. .state('app', {
  26. url: '/app',
  27. abstract: true,
  28. templateUrl: 'templates/menu.html',
  29. controller: 'AppCtrl'
  30. })
  31. .state('app.settings', {
  32. url: '/settings',
  33. views: {
  34. 'menuContent': {
  35. templateUrl: 'templates/settings.html',
  36. controller: 'SettingsCtrl'
  37. }
  38. }
  39. })
  40. .state('app.help', {
  41. url: '/help',
  42. views: {
  43. 'menuContent': {
  44. templateUrl: 'templates/help.html',
  45. controller: 'HelpCtrl'
  46. }
  47. }
  48. })
  49. .state('app.notifications', {
  50. url: '/notifications/:username',
  51. views: {
  52. 'menuContent': {
  53. templateUrl: 'templates/notifications.html',
  54. controller: 'NotificationsCtrl'
  55. }
  56. }
  57. })
  58. .state('app.users', {
  59. url: '/users',
  60. views: {
  61. 'menuContent': {
  62. templateUrl: 'templates/users.html',
  63. controller: 'UsersCtrl'
  64. }
  65. }
  66. })
  67. .state('app.user', {
  68. url: '/users/:username',
  69. views: {
  70. 'menuContent': {
  71. templateUrl: 'templates/user.html',
  72. controller: 'UserCtrl'
  73. }
  74. }
  75. })
  76. .state('app.travels', {
  77. url: '/travels',
  78. views: {
  79. 'menuContent': {
  80. templateUrl: 'templates/travels.html',
  81. controller: 'TravelsCtrl'
  82. }
  83. }
  84. })
  85. .state('app.travel', {
  86. url: '/travels/:travelId',
  87. views: {
  88. 'menuContent': {
  89. templateUrl: 'templates/travel.html',
  90. controller: 'TravelCtrl'
  91. }
  92. }
  93. });
  94. // if none of the above states are matched, use this as the fallback
  95. $urlRouterProvider.otherwise('/app/travels');
  96. })
  97. /* translator */
  98. .config(['$translateProvider',function($translateProvider) {
  99. /* get lang from the file translations.js */
  100. for(lang in translations){
  101. $translateProvider.translations(lang, translations[lang]);
  102. }
  103. if(window.localStorage.getItem('lang')) {
  104. $translateProvider.preferredLanguage(window.localStorage.getItem('lang'));
  105. }else{
  106. $translateProvider.preferredLanguage('english');
  107. };
  108. $translateProvider.useSanitizeValueStrategy('escape');
  109. }]);