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
     'ui.router',
7
     'ui.router',
8
     'LocalStorageModule',
8
     'LocalStorageModule',
9
     'ngMaterial',
9
     'ngMaterial',
10
+    'ngMaterialDatePicker',
10
     'appSdk'
11
     'appSdk'
11
 ]);
12
 ]);
12
 
13
 
22
             controller:'HomeController'
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
         $urlRouterProvider.otherwise('/');
32
         $urlRouterProvider.otherwise('/');
26
 
33
 
27
     }])
34
     }])

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

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
 
4
 
5
             $scope.DataShareBusiness = DataShareBusiness;
5
             $scope.DataShareBusiness = DataShareBusiness;
6
             $scope.dateFormat = DataShareBusiness.DateFormat;
6
             $scope.dateFormat = DataShareBusiness.DateFormat;
7
-            $scope.hourFormat = DataShareBusiness.HourFormat;
7
+            $scope.timeFormat = DataShareBusiness.TimeFormat;
8
             $scope.courses = null;
8
             $scope.courses = null;
9
             $scope.weekId = {
9
             $scope.weekId = {
10
                 id: null,
10
                 id: null,

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

3
  */
3
  */
4
 
4
 
5
 angular.module('app')
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
             $scope.course = course;
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
             $scope.close = function()
13
             $scope.close = function()
14
             {
14
             {

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

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
  */
3
  */
4
 
4
 
5
 angular.module('app')
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
             $scope.DataShareBusiness = DataShareBusiness;
9
             $scope.DataShareBusiness = DataShareBusiness;
10
 
10
 
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
                 {
12
                 {
13
                     $mdSidenav('left').toggle();
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
     <!-- build:css css/globals.css -->
8
     <!-- build:css css/globals.css -->
9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
10
     <link rel="stylesheet" href="../bower_components/angular-material/angular-material.min.css">
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
     <link rel="stylesheet" href="css/lubusy.css">
12
     <link rel="stylesheet" href="css/lubusy.css">
12
     <!-- endbuild -->
13
     <!-- endbuild -->
13
 
14
 
38
     <script src="../bower_components/angular-aria/angular-aria.min.js"></script>
39
     <script src="../bower_components/angular-aria/angular-aria.min.js"></script>
39
     <script src="../bower_components/angular-animate/angular-animate.min.js"></script>
40
     <script src="../bower_components/angular-animate/angular-animate.min.js"></script>
40
     <script src="../bower_components/angular-material/angular-material.min.js"></script>
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
     <!-- scripts -->
45
     <!-- scripts -->
43
     <script src="app.js"></script>
46
     <script src="app.js"></script>
46
     <script src="controllers/sidebar.controller.js"></script>
49
     <script src="controllers/sidebar.controller.js"></script>
47
     <script src="controllers/toolbar.controller.js"></script>
50
     <script src="controllers/toolbar.controller.js"></script>
48
     <script src="controllers/home.controller.js"></script>
51
     <script src="controllers/home.controller.js"></script>
49
-    <script src="controllers/modals/course.controller.js"></script>
50
 
52
 
51
     <!-- Modal Controller -->
53
     <!-- Modal Controller -->
54
+    <script src="controllers/modals/course.controller.js"></script>
55
+    <script src="controllers/freeroom.controller.js"></script>
52
 
56
 
53
     <!-- SDK -->
57
     <!-- SDK -->
54
     <script src="../sdk/sdk.js"></script>
58
     <script src="../sdk/sdk.js"></script>

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

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

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

14
                 <div ng-repeat="staff in course.StaffList">
14
                 <div ng-repeat="staff in course.StaffList">
15
                     <span class="day-column-staff-name">{{staff.Name}}</span>
15
                     <span class="day-column-staff-name">{{staff.Name}}</span>
16
                 </div>
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
             </div>
18
             </div>
19
         </md-dialog-content>
19
         </md-dialog-content>
20
         <md-dialog-actions layout="row">
20
         <md-dialog-actions layout="row">

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

43
                 </li>
43
                 </li>
44
             </ul>
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
         </div>
52
         </div>
51
     </md-content>
53
     </md-content>
52
 </md-sidenav>
54
 </md-sidenav>

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

3
         <md-button class="md-icon-button" aria-label="Groupes" ng-click="toggleSideBar()" hide-gt-md>
3
         <md-button class="md-icon-button" aria-label="Groupes" ng-click="toggleSideBar()" hide-gt-md>
4
             <md-icon md-svg-icon="img/menu.svg"></md-icon>
4
             <md-icon md-svg-icon="img/menu.svg"></md-icon>
5
         </md-button>
5
         </md-button>
6
-        <h2>
6
+        <h2 ng-show="isInState('home')">
7
             <a ng-href="{{DataShareBusiness.getGroupUrl(null)}}">{{ DataShareBusiness.SearchSeparator }} </a>
7
             <a ng-href="{{DataShareBusiness.getGroupUrl(null)}}">{{ DataShareBusiness.SearchSeparator }} </a>
8
             <a ng-href="{{DataShareBusiness.getGroupUrl(group)}}" ng-repeat="group in DataShareBusiness.CurrentGroups">
8
             <a ng-href="{{DataShareBusiness.getGroupUrl(group)}}" ng-repeat="group in DataShareBusiness.CurrentGroups">
9
                 {{ group.Name }}{{ $last ? "" : " " + DataShareBusiness.SearchSeparator + " " }}
9
                 {{ group.Name }}{{ $last ? "" : " " + DataShareBusiness.SearchSeparator + " " }}
10
             </a>
10
             </a>
11
         </h2>
11
         </h2>
12
+        <h2 ng-show="isInState('freeroom')">
13
+            Find a free room
14
+        </h2>
12
         <span flex></span>
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
     </div>
16
     </div>
20
 </md-toolbar>
17
 </md-toolbar>

+ 6
- 1
bower.json View File

8
   "dependencies": {
8
   "dependencies": {
9
     "angular": "1.5.x",
9
     "angular": "1.5.x",
10
     "jquery": "2.1.x",
10
     "jquery": "2.1.x",
11
+    "angular-bootstrap": "1.1.x",
11
     "angular-ui-router": "0.2.x",
12
     "angular-ui-router": "0.2.x",
12
     "bootstrap": "3.3.x",
13
     "bootstrap": "3.3.x",
13
     "less": "1.7.x",
14
     "less": "1.7.x",
14
     "angular-local-storage": "0.2.3",
15
     "angular-local-storage": "0.2.3",
15
     "angular-material": "^1.0.6",
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
 (function()
1
 (function()
2
 {
2
 {
3
     angular.module('appSdk')
3
     angular.module('appSdk')
4
-        .factory('DataShareBusiness', ['$location', function ($location) {
4
+        .factory('DataShareBusiness', ['$location', '$state', function ($location, $state) {
5
 
5
 
6
             var data = {
6
             var data = {
7
                 Groups: null,
7
                 Groups: null,
12
 
12
 
13
                 DateFormat: "dd MMM yyyy",
13
                 DateFormat: "dd MMM yyyy",
14
 
14
 
15
-                HourFormat: "HH'h'mm",
15
+                TimeFormat: "HH'h'mm",
16
 
16
 
17
                 setCurrentGroup: function(group)
17
                 setCurrentGroup: function(group)
18
                 {
18
                 {
68
                 getGroupUrl: function(group)
68
                 getGroupUrl: function(group)
69
                 {
69
                 {
70
                     var search = data.getSearchString(group);
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
                 setFromSearchString: function(string)
74
                 setFromSearchString: function(string)

Loading…
Cancel
Save