ソースを参照

first calendar view

tags/1.0.0
Robin Thoni 8年前
コミット
0ed96b878e
5個のファイルの変更51行の追加46行の削除
  1. 0
    37
      Gruntfile_luticate.js
  2. 3
    3
      app/controllers/home.controller.js
  3. 6
    0
      app/less/app.less
  4. 2
    3
      app/views/home.html
  5. 40
    3
      sdk/Business/WeeksBusiness.js

+ 0
- 37
Gruntfile_luticate.js ファイルの表示

@@ -1,37 +0,0 @@
1
-/**
2
- * Created by robin on 11/10/15.
3
- */
4
-
5
-module.exports = function(grunt) {
6
-
7
-    grunt.loadNpmTasks('grunt-contrib-copy');
8
-
9
-    var path = require('path');
10
-
11
-    grunt.initConfig({
12
-        globals: {
13
-            releasePath: 'build/release/luticate',
14
-            appFolder: 'luticate',
15
-            staticFiles: [
16
-                '**'
17
-            ]
18
-        },
19
-        copy: {
20
-            release: {
21
-                files: [
22
-                    {
23
-                        expand: true,
24
-                        cwd:'<%= globals.appFolder %>/',
25
-                        src: ['<%= globals.staticFiles %>'],
26
-                        dest: '<%= globals.releasePath %>'
27
-                    }
28
-                ]
29
-            }
30
-        }
31
-    });
32
-    grunt.registerTask('default', [
33
-        'copy:release'
34
-    ]);
35
-
36
-
37
-};

+ 3
- 3
app/controllers/home.controller.js ファイルの表示

@@ -41,7 +41,7 @@ angular.module('app')
41 41
                 }
42 42
             };
43 43
 
44
-            $scope.getCourseListByDay = function(date)
44
+            $scope.getDayListByDay = function(date)
45 45
             {
46 46
                 if ($scope.courses == null || date == null) {
47 47
                     return null;
@@ -55,11 +55,11 @@ angular.module('app')
55 55
 
56 56
             $scope.getCoursesByDate = function(date)
57 57
             {
58
-                var courses = $scope.getCourseListByDay(date);
58
+                var courses = $scope.getDayListByDay(date);
59 59
                 if (courses == null) {
60 60
                     return [];
61 61
                 }
62
-                return ["42", "24"];
62
+                return courses.CourseList;
63 63
             };
64 64
 
65 65
             $scope.$watch(function(){return DataShareBusiness.CurrentGroups}, function()

+ 6
- 0
app/less/app.less ファイルの表示

@@ -82,3 +82,9 @@ footer {
82 82
 .day-column-header-date {
83 83
   padding-bottom: 5px;
84 84
 }
85
+
86
+.day-column-course {
87
+  position: absolute;
88
+  background-color: cadetblue;
89
+  width: 100%;
90
+}

+ 2
- 3
app/views/home.html ファイルの表示

@@ -12,11 +12,10 @@
12 12
         <div ng-repeat="day in days" class="col-sm-1 day-column">
13 13
             <div class="day-column-header day-column-header-day">{{ day.day }}</div>
14 14
             <div class="day-column-header day-column-header-date">{{ day.date | date : dateFormat }}</div>
15
-            <div ng-repeat="course in getCoursesByDate(day.date)" ng-style="{'heigth': '0'}">
16
-                {{course}}
15
+            <div class="day-column-course" ng-repeat="course in getCoursesByDate(day.date)" ng-style="{'height': (course.EndPercent - course.BeginPercent) + '%', 'top' : course.BeginPercent + '%'}">
16
+                {{ course.Name }}
17 17
             </div>
18 18
         </div>
19
-        {{ courses }}
20 19
     </div>
21 20
 
22 21
 </div>

+ 40
- 3
sdk/Business/WeeksBusiness.js ファイルの表示

@@ -1,13 +1,50 @@
1 1
 (function()
2 2
 {
3 3
     angular.module('appSdk')
4
-        .factory('WeeksBusiness', ['WeeksDataAccess', function (WeeksDataAccess) {
4
+        .factory('WeeksBusiness', ['WeeksDataAccess', '$q', function (WeeksDataAccess, $q) {
5 5
 
6 6
             var Business = {};
7 7
 
8
-            Business.getWeek = WeeksDataAccess.getWeek;
8
+            Business.formatWeek = function(data)
9
+            {
10
+                data.DayList.forEach(function(day) {
11
+                    day.CourseList.forEach(function (course) {
12
+                        var dt = new Date(course.BeginDate);
13
+                        var secs = dt.getSeconds() + (60 * dt.getMinutes()) + (60 * 60 * dt.getHours());
14
+                        course.BeginPercent = secs / (60 * 60 * 24) * 100;
15
+                        course.BeginSeconds = secs;
9 16
 
10
-            Business.getCurrentWeek = WeeksDataAccess.getCurrentWeek;
17
+                        dt = new Date(course.EndDate);
18
+                        secs = dt.getSeconds() + (60 * dt.getMinutes()) + (60 * 60 * dt.getHours());
19
+                        course.EndPercent = secs / (60 * 60 * 24) * 100;
20
+                        course.EndSeconds = secs;
21
+                    });
22
+                });
23
+            };
24
+
25
+            Business.getWeek = function(data, promise)
26
+            {
27
+                var defer = $q.defer();
28
+                WeeksDataAccess.getWeek(data, promise)
29
+                    .then(function(data)
30
+                    {
31
+                        Business.formatWeek(data);
32
+                        defer.resolve(data);
33
+                    }, defer.reject);
34
+                return defer.promise;
35
+            };
36
+
37
+            Business.getCurrentWeek = function(data, promise)
38
+            {
39
+                var defer = $q.defer();
40
+                WeeksDataAccess.getCurrentWeek(data, promise)
41
+                    .then(function(data)
42
+                    {
43
+                        Business.formatWeek(data);
44
+                        defer.resolve(data);
45
+                    }, defer.reject);
46
+                return defer.promise;
47
+            };
11 48
 
12 49
             return Business;
13 50
         }]);

読み込み中…
キャンセル
保存