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.

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