選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

app.js 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. 'use strict';
  2. /* App Module */
  3. var app = angular.module('app', [
  4. 'ui.bootstrap',
  5. 'ui.router',
  6. 'LocalStorageModule',
  7. 'ngMaterial',
  8. 'ngMaterialDatePicker',
  9. 'appSdk'
  10. ]);
  11. app.config(['$stateProvider', '$urlRouterProvider',
  12. function($stateProvider, $urlRouterProvider) {
  13. $stateProvider.state('home', {
  14. url:'/groups?group',
  15. title: "Courses",
  16. reloadOnSearch: false,
  17. templateUrl:'views/home.html',
  18. controller:'HomeController'
  19. });
  20. $stateProvider.state('rooms', {
  21. url:'/rooms?group',
  22. title: "Rooms",
  23. reloadOnSearch: false,
  24. templateUrl:'views/home.html',
  25. controller:'HomeController'
  26. });
  27. $stateProvider.state('freeroom', {
  28. url:'/freeroom',
  29. title: "Free Rooms",
  30. templateUrl:'views/freeroom.html',
  31. controller:'FreeRoomController'
  32. });
  33. $urlRouterProvider.otherwise('/groups');
  34. if (!('find' in Array.prototype)) {
  35. Array.prototype.find= function(func) {
  36. for (var i = 0; i < this.length; ++i) {
  37. if (func(this[i])) {
  38. return this[i];
  39. }
  40. }
  41. return null;
  42. };
  43. }
  44. }])
  45. .directive('dateNow', ['$filter', function($filter) {
  46. return {
  47. link: function( $scope, $element, $attrs) {
  48. $element.text($filter('date')(new Date(), $attrs.dateNow));
  49. }
  50. };
  51. }])
  52. .run(['$rootScope', '$state', 'DataShareBusiness', 'GroupsBusiness', 'StaffsBusiness', 'RoomsBusiness', '$mdDateLocale', '$filter',
  53. function ($rootScope, $state, DataShareBusiness, GroupsBusiness, StaffsBusiness, RoomsBusiness, $mdDateLocale, $filter) {
  54. $rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
  55. $rootScope.title = current.title + " - Chronos";
  56. });
  57. var promiseLoadEntities = {
  58. id: "promiseLoadEntities",
  59. loaderGroups: ["toolbar"],
  60. groups: ["sidebar"]
  61. };
  62. GroupsBusiness.getAll(promiseLoadEntities).then(function(groups)
  63. {
  64. StaffsBusiness.getAll(promiseLoadEntities).then(function(staffs)
  65. {
  66. RoomsBusiness.getAll(promiseLoadEntities).then(function(rooms)
  67. {
  68. DataShareBusiness.Groups = groups;
  69. DataShareBusiness.Staffs = staffs;
  70. DataShareBusiness.Rooms = rooms;
  71. });
  72. });
  73. });
  74. $mdDateLocale.firstDayOfWeek = 1;
  75. $mdDateLocale.formatDate = function(date) {
  76. return $filter("date")(date, DataShareBusiness.DateFormat);
  77. };
  78. }]);