Parcourir la source

begin free room; centralized date/hour format

tags/1.0.0
Robin Thoni il y a 8 ans
Parent
révision
7a5492c50e

+ 7
- 5
app/app.js Voir le fichier

@@ -32,11 +32,8 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
32 32
             }
33 33
         };
34 34
     }])
35
-    .run(['$rootScope', '$state', '$location', 'DataShareBusiness', 'GroupsBusiness',
36
-        function ($rootScope, $state, $location, DataShareBusiness, GroupsBusiness) {
37
-            $rootScope.$on('$stateChangeError', function (e, curr, prev) {
38
-                //$state.go('/');
39
-            });
35
+    .run(['$rootScope', '$state', '$location', 'DataShareBusiness', 'GroupsBusiness', '$mdDateLocale', '$filter',
36
+        function ($rootScope, $state, $location, DataShareBusiness, GroupsBusiness, $mdDateLocale, $filter) {
40 37
 
41 38
             $rootScope.$watch(function(){ return Object.keys($location.search())[0] }, function(){
42 39
                 if (DataShareBusiness.Groups != null) {
@@ -53,4 +50,9 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
53 50
             {
54 51
                 DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
55 52
             });
53
+
54
+            $mdDateLocale.firstDayOfWeek = 1;
55
+            $mdDateLocale.formatDate = function(date) {
56
+                return $filter("date")(date, DataShareBusiness.DateFormat);
57
+            };
56 58
     }]);

+ 2
- 11
app/controllers/home.controller.js Voir le fichier

@@ -3,8 +3,8 @@ angular.module('app')
3 3
         function($scope, $state, DataShareBusiness, WeeksBusiness, $mdDialog) {
4 4
 
5 5
             $scope.DataShareBusiness = DataShareBusiness;
6
-            $scope.dateFormat = "dd MMM yyyy";
7
-            $scope.hourFormat = "HH'h'mm";
6
+            $scope.dateFormat = DataShareBusiness.DateFormat;
7
+            $scope.hourFormat = DataShareBusiness.HourFormat;
8 8
             $scope.courses = null;
9 9
             $scope.weekId = {
10 10
                 id: null,
@@ -96,15 +96,6 @@ angular.module('app')
96 96
                         course: course
97 97
                     }
98 98
                 });
99
-                /*$mdDialog.show(
100
-                    $mdDialog.alert()
101
-                        .parent(angular.element(document.querySelector('#popupContainer')))
102
-                        .clickOutsideToClose(true)
103
-                        .title(course.Name)
104
-                        .content("<a href=''>42</a>")
105
-                        .ariaLabel(course.Name)
106
-                        .ok('Ok')
107
-                );*/
108 99
             };
109 100
 
110 101
             $scope.onWeekReceived = function(data)

+ 17
- 0
app/controllers/modals/freeroom.controller.js Voir le fichier

@@ -0,0 +1,17 @@
1
+/**
2
+ * Created by robin on 11/1/15.
3
+ */
4
+
5
+angular.module('app')
6
+    .controller('FreeRoomController', ['$scope', '$mdDialog',
7
+        function($scope, $mdDialog) {
8
+
9
+            $scope.course = course;
10
+            $scope.dateFormat = DataShareBusiness.DateFormat;
11
+            $scope.hourFormat = DataShareBusiness.HourFormat;
12
+
13
+            $scope.close = function()
14
+            {
15
+                $mdDialog.cancel();
16
+            };
17
+        }]);

+ 8
- 1
app/controllers/sidebar.controller.js Voir le fichier

@@ -50,6 +50,13 @@ angular.module('app')
50 50
 
51 51
             $scope.findFreeRoom = function()
52 52
             {
53
-
53
+                $mdDialog.show({
54
+                    controller: 'FreeRoomController',
55
+                    templateUrl: 'views/modals/freeroom.html',
56
+                    parent: angular.element(document.body),
57
+                    targetEvent: null,
58
+                    clickOutsideToClose: true,
59
+                    fullscreen: false
60
+                });
54 61
             };
55 62
         }]);

+ 4
- 0
sdk/Business/DataShareBusiness.js Voir le fichier

@@ -10,6 +10,10 @@
10 10
 
11 11
                 CurrentGroups: [],
12 12
 
13
+                DateFormat: "dd MMM yyyy",
14
+
15
+                HourFormat: "HH'h'mm",
16
+
13 17
                 setCurrentGroup: function(group)
14 18
                 {
15 19
                     data.CurrentGroups = [];

Chargement…
Annuler
Enregistrer