Browse Source

begin free room controller

tags/1.0.0
Robin Thoni 8 years ago
parent
commit
5a59a8924e

+ 7
- 0
app/app.js View File

@@ -7,6 +7,7 @@ var app = angular.module('app', [
7 7
     'ui.router',
8 8
     'LocalStorageModule',
9 9
     'ngMaterial',
10
+    'ngMaterialDatePicker',
10 11
     'appSdk'
11 12
 ]);
12 13
 
@@ -22,6 +23,12 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationP
22 23
             controller:'HomeController'
23 24
         });
24 25
 
26
+        $stateProvider.state('freeroom',{
27
+            url:'/freeroom',
28
+            templateUrl:'views/freeroom.html',
29
+            controller:'FreeRoomController'
30
+        });
31
+
25 32
         $urlRouterProvider.otherwise('/');
26 33
 
27 34
     }])

+ 20
- 0
app/controllers/freeroom.controller.js View File

@@ -0,0 +1,20 @@
1
+/**
2
+ * Created by robin on 11/1/15.
3
+ */
4
+
5
+angular.module('app')
6
+    .controller('FreeRoomController', ['$scope', '$mdDialog', 'DataShareBusiness',
7
+        function($scope, $mdDialog, DataShareBusiness) {
8
+
9
+            $scope.dateFormat = DataShareBusiness.DateFormat;
10
+            $scope.timeFormat = DataShareBusiness.TimeFormat;
11
+            $scope.Search = {
12
+                Begin: new Date(),
13
+                End: new Date()
14
+            };
15
+
16
+            $scope.close = function()
17
+            {
18
+                $mdDialog.cancel();
19
+            };
20
+        }]);

+ 1
- 1
app/controllers/home.controller.js View File

@@ -4,7 +4,7 @@ angular.module('app')
4 4
 
5 5
             $scope.DataShareBusiness = DataShareBusiness;
6 6
             $scope.dateFormat = DataShareBusiness.DateFormat;
7
-            $scope.hourFormat = DataShareBusiness.HourFormat;
7
+            $scope.timeFormat = DataShareBusiness.TimeFormat;
8 8
             $scope.courses = null;
9 9
             $scope.weekId = {
10 10
                 id: null,

+ 4
- 4
app/controllers/modals/course.controller.js View File

@@ -3,12 +3,12 @@
3 3
  */
4 4
 
5 5
 angular.module('app')
6
-    .controller('CourseController', ['$scope', '$mdDialog', 'course',
7
-        function($scope, $mdDialog, course) {
6
+    .controller('CourseController', ['$scope', '$mdDialog', 'course', 'DataShareBusiness',
7
+        function($scope, $mdDialog, course, DataShareBusiness) {
8 8
 
9 9
             $scope.course = course;
10
-            $scope.dateFormat = "dd MMM yyyy";
11
-            $scope.hourFormat = "HH'h'mm";
10
+            $scope.dateFormat = DataShareBusiness.dateFormat;
11
+            $scope.timeFormat = DataShareBusiness.TimeFormat;
12 12
 
13 13
             $scope.close = function()
14 14
             {

+ 0
- 17
app/controllers/modals/freeroom.controller.js View File

@@ -1,17 +0,0 @@
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
-        }]);

+ 4
- 11
app/controllers/sidebar.controller.js View File

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 5
 angular.module('app')
6
-    .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness',
7
-        function($scope, $state, DataShareBusiness) {
6
+    .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness', '$mdDialog',
7
+        function($scope, $state, DataShareBusiness, $mdDialog) {
8 8
 
9 9
             $scope.DataShareBusiness = DataShareBusiness;
10 10
 
@@ -48,15 +48,8 @@ angular.module('app')
48 48
                 }
49 49
             };
50 50
 
51
-            $scope.findFreeRoom = function()
51
+            $scope.isInState = function(state)
52 52
             {
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
-                });
53
+                return $state.current.name == state;
61 54
             };
62 55
         }]);

+ 5
- 0
app/controllers/toolbar.controller.js View File

@@ -12,4 +12,9 @@ angular.module('app')
12 12
                 {
13 13
                     $mdSidenav('left').toggle();
14 14
                 };
15
+
16
+                $scope.isInState = function(state)
17
+                {
18
+                        return $state.current.name == state;
19
+                };
15 20
         }]);

+ 5
- 1
app/index.html View File

@@ -8,6 +8,7 @@
8 8
     <!-- build:css css/globals.css -->
9 9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
10 10
     <link rel="stylesheet" href="../bower_components/angular-material/angular-material.min.css">
11
+    <link rel="stylesheet" href="../bower_components/angular-material-datetimepicker/css/material-datetimepicker.min.css">
11 12
     <link rel="stylesheet" href="css/lubusy.css">
12 13
     <!-- endbuild -->
13 14
 
@@ -38,6 +39,8 @@
38 39
     <script src="../bower_components/angular-aria/angular-aria.min.js"></script>
39 40
     <script src="../bower_components/angular-animate/angular-animate.min.js"></script>
40 41
     <script src="../bower_components/angular-material/angular-material.min.js"></script>
42
+    <script src="../bower_components/moment/min/moment.min.js"></script>
43
+    <script src="../bower_components/angular-material-datetimepicker/js/angular-material-datetimepicker.min.js"></script>
41 44
 
42 45
     <!-- scripts -->
43 46
     <script src="app.js"></script>
@@ -46,9 +49,10 @@
46 49
     <script src="controllers/sidebar.controller.js"></script>
47 50
     <script src="controllers/toolbar.controller.js"></script>
48 51
     <script src="controllers/home.controller.js"></script>
49
-    <script src="controllers/modals/course.controller.js"></script>
50 52
 
51 53
     <!-- Modal Controller -->
54
+    <script src="controllers/modals/course.controller.js"></script>
55
+    <script src="controllers/freeroom.controller.js"></script>
52 56
 
53 57
     <!-- SDK -->
54 58
     <script src="../sdk/sdk.js"></script>

+ 4
- 0
app/views/freeroom.html View File

@@ -0,0 +1,4 @@
1
+<div layout="column" layout-fill layout-align="top center">
2
+    <input class="form-control" mdc-datetime-picker="" date="true" time="true" type="text" id="datetime"
3
+           placeholder="Begin date" min-date="date" ng-model="Search.Begin" class=" md-input">
4
+</div>

+ 4
- 2
app/views/home.html View File

@@ -29,7 +29,7 @@
29 29
         <div class="col-xs-1 hour-column">
30 30
             <div class="day-column-hours">
31 31
                 <div class="day-column-hour" ng-hide="$first" ng-repeat="hour in hours" ng-style="{'top': ($index / hours.length * 100) + '%'}">
32
-                    {{hour | date : hourFormat}} -
32
+                    {{hour | date : timeFormat}} -
33 33
                 </div>
34 34
             </div>
35 35
         </div>
@@ -59,10 +59,12 @@
59 59
                         <div ng-repeat="staff in course.StaffList">
60 60
                             <span class="day-column-staff-name">{{staff.Name}}</span>
61 61
                         </div>
62
-                        <span class="day-column-course-hour">{{course.BeginDate | date : hourFormat}} - {{course.EndDate | date : hourFormat}}</span>
62
+                        <span class="day-column-course-hour">{{course.BeginDate | date : timeFormat}} - {{course.EndDate | date : timeFormat}}</span>
63 63
                     </div>
64 64
                 </div>
65 65
             </div>
66
+
67
+
66 68
         </div>
67 69
     </div>
68 70
 

+ 1
- 1
app/views/modals/course.html View File

@@ -14,7 +14,7 @@
14 14
                 <div ng-repeat="staff in course.StaffList">
15 15
                     <span class="day-column-staff-name">{{staff.Name}}</span>
16 16
                 </div>
17
-                <span class="day-column-course-hour">{{course.BeginDate | date : hourFormat}} - {{course.EndDate | date : hourFormat}}</span>
17
+                <span class="day-column-course-hour">{{course.BeginDate | date : timeFormat}} - {{course.EndDate | date : timeFormat}}</span>
18 18
             </div>
19 19
         </md-dialog-content>
20 20
         <md-dialog-actions layout="row">

+ 6
- 4
app/views/sidebar.html View File

@@ -43,10 +43,12 @@
43 43
                 </li>
44 44
             </ul>
45 45
 
46
-            <!--<span>Need a room ?</span>
47
-            <md-button class="md-primary md-group-button col-xs-12" ng-click="findFreeRoom()">
48
-                Find a free room!
49
-            </md-button>-->
46
+            <div ng-hide="isInState('freeroom')">
47
+                <span>Need a room ?</span>
48
+                <md-button class="md-primary md-group-button col-xs-12" ui-sref="freeroom">
49
+                    Find a free room!
50
+                </md-button>
51
+            </div>
50 52
         </div>
51 53
     </md-content>
52 54
 </md-sidenav>

+ 4
- 7
app/views/toolbar.html View File

@@ -3,18 +3,15 @@
3 3
         <md-button class="md-icon-button" aria-label="Groupes" ng-click="toggleSideBar()" hide-gt-md>
4 4
             <md-icon md-svg-icon="img/menu.svg"></md-icon>
5 5
         </md-button>
6
-        <h2>
6
+        <h2 ng-show="isInState('home')">
7 7
             <a ng-href="{{DataShareBusiness.getGroupUrl(null)}}">{{ DataShareBusiness.SearchSeparator }} </a>
8 8
             <a ng-href="{{DataShareBusiness.getGroupUrl(group)}}" ng-repeat="group in DataShareBusiness.CurrentGroups">
9 9
                 {{ group.Name }}{{ $last ? "" : " " + DataShareBusiness.SearchSeparator + " " }}
10 10
             </a>
11 11
         </h2>
12
+        <h2 ng-show="isInState('freeroom')">
13
+            Find a free room
14
+        </h2>
12 15
         <span flex></span>
13
-        <!--<md-button class="md-icon-button" aria-label="Favorite">
14
-            <md-icon md-svg-icon="img/icons/favorite.svg" style="color: greenyellow;"></md-icon>
15
-        </md-button>
16
-        <md-button class="md-icon-button" aria-label="More">
17
-            <md-icon md-svg-icon="img/icons/more_vert.svg"></md-icon>
18
-        </md-button>-->
19 16
     </div>
20 17
 </md-toolbar>

+ 6
- 1
bower.json View File

@@ -8,11 +8,16 @@
8 8
   "dependencies": {
9 9
     "angular": "1.5.x",
10 10
     "jquery": "2.1.x",
11
+    "angular-bootstrap": "1.1.x",
11 12
     "angular-ui-router": "0.2.x",
12 13
     "bootstrap": "3.3.x",
13 14
     "less": "1.7.x",
14 15
     "angular-local-storage": "0.2.3",
15 16
     "angular-material": "^1.0.6",
16
-    "angular-bootstrap": "^1.2.1"
17
+    "angular-material-datetimepicker": "^1.3.1",
18
+    "moment": "^2.11.2"
19
+  },
20
+  "resolutions": {
21
+    "angular-material": "^1.0.6"
17 22
   }
18 23
 }

+ 3
- 3
sdk/Business/DataShareBusiness.js View File

@@ -1,7 +1,7 @@
1 1
 (function()
2 2
 {
3 3
     angular.module('appSdk')
4
-        .factory('DataShareBusiness', ['$location', function ($location) {
4
+        .factory('DataShareBusiness', ['$location', '$state', function ($location, $state) {
5 5
 
6 6
             var data = {
7 7
                 Groups: null,
@@ -12,7 +12,7 @@
12 12
 
13 13
                 DateFormat: "dd MMM yyyy",
14 14
 
15
-                HourFormat: "HH'h'mm",
15
+                TimeFormat: "HH'h'mm",
16 16
 
17 17
                 setCurrentGroup: function(group)
18 18
                 {
@@ -68,7 +68,7 @@
68 68
                 getGroupUrl: function(group)
69 69
                 {
70 70
                     var search = data.getSearchString(group);
71
-                    return "#" + $location.path() + $location.hash() + "?" + search;
71
+                    return $state.href('home') + $location.hash() + "?" + search;
72 72
                 },
73 73
 
74 74
                 setFromSearchString: function(string)

Loading…
Cancel
Save