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.

115 lines
2.9 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.users', {
  50. url: '/users',
  51. views: {
  52. 'menuContent': {
  53. templateUrl: 'templates/users.html',
  54. controller: 'UsersCtrl'
  55. }
  56. }
  57. })
  58. .state('app.user', {
  59. url: '/users/:username',
  60. views: {
  61. 'menuContent': {
  62. templateUrl: 'templates/user.html',
  63. controller: 'UserCtrl'
  64. }
  65. }
  66. })
  67. .state('app.travels', {
  68. url: '/travels',
  69. views: {
  70. 'menuContent': {
  71. templateUrl: 'templates/travels.html',
  72. controller: 'TravelsCtrl'
  73. }
  74. }
  75. })
  76. .state('app.travel', {
  77. url: '/travels/:travelId',
  78. views: {
  79. 'menuContent': {
  80. templateUrl: 'templates/travel.html',
  81. controller: 'TravelCtrl'
  82. }
  83. }
  84. });
  85. // if none of the above states are matched, use this as the fallback
  86. $urlRouterProvider.otherwise('/app/travels');
  87. })
  88. /* translator */
  89. .config(['$translateProvider',function($translateProvider) {
  90. /* get lang from the file translations.js */
  91. for(lang in translations){
  92. $translateProvider.translations(lang, translations[lang]);
  93. }
  94. if(window.localStorage.getItem('lang')) {
  95. $translateProvider.preferredLanguage(window.localStorage.getItem('lang'));
  96. }else{
  97. $translateProvider.preferredLanguage('english');
  98. };
  99. $translateProvider.useSanitizeValueStrategy('escape');
  100. }]);