schedule page update: multiple schedules, prettify, other changes
This commit is contained in:
1 parent
a22820c278
commit
f747ce17f3
3 files changed
+62
-19
No files matched your search
@@ -15,6 +15,10 @@
|
|||||||
padding-bottom: 50px;
|
padding-bottom: 50px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
& > p{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.schedule-block{
|
.schedule-block{
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
}
|
}
|
||||||
@@ -90,10 +94,6 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
p{
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a{
|
a{
|
||||||
color: black;
|
color: black;
|
||||||
|
|
||||||
|
|||||||
+49
-11
@@ -6,20 +6,58 @@ module.exports = function (app) {
|
|||||||
var now = new Date();
|
var now = new Date();
|
||||||
var dates = getDates(now);
|
var dates = getDates(now);
|
||||||
|
|
||||||
var sem = "autumn";
|
$http.get("/schedules")
|
||||||
$scope.sem = [["spring", "весеннего"], ["autumn", "осеннего"]].reduce(function (s, word) {
|
.success(function (schedules) {
|
||||||
if (word[0] === sem) return word[1];
|
//return ;
|
||||||
});
|
var last = schedules.length - 1;
|
||||||
$scope.year = "2014-2015";
|
|
||||||
|
|
||||||
$http.get("/schedule/2014-2015/spring")
|
$scope.schedules = schedules.map(function (schedule) {
|
||||||
.success(function (s) {
|
var sem = [["spring", "весеннего"], ["autumn", "осеннего"]].reduce(function (s, word) {
|
||||||
$scope.schedule = schedule.populate(s.schedule, [
|
if (word[0] === schedule.semester) return word[1];
|
||||||
populate(team.short, "teacher"),
|
else return s[1];
|
||||||
populate(course.name, "lesson")
|
});
|
||||||
]);
|
|
||||||
|
schedule.text = 'Расписание {{sem}} семестра {{period}} года'
|
||||||
|
.replace('{{sem}}', sem)
|
||||||
|
.replace('{{period}}', schedule.period);
|
||||||
|
|
||||||
|
return schedule;
|
||||||
|
});
|
||||||
|
$scope.schedules[last].selected = true;
|
||||||
|
$scope.currentSchedule = $scope.schedules[last]._id;
|
||||||
|
$scope.loadSchedule();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$watch('currentSchedule', function (newValue) {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.loadSchedule = function (id) {
|
||||||
|
var schedule_item = getScheduleByID(id || $scope.currentSchedule);
|
||||||
|
|
||||||
|
if(schedule_item) {
|
||||||
|
var sem = schedule_item.semester;
|
||||||
|
var period = schedule_item.period;
|
||||||
|
|
||||||
|
$http.get("/schedule/" + period + "/" + sem)
|
||||||
|
.success(function (scheduleRecord) {
|
||||||
|
$scope.groups = schedule.populate(scheduleRecord.schedule, [
|
||||||
|
populate(team.short, "teacher"),
|
||||||
|
populate(course.name, "lesson")
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function getScheduleByID(id) {
|
||||||
|
var schedules = $scope.schedules;
|
||||||
|
for (var i in schedules) {
|
||||||
|
var s = schedules[i];
|
||||||
|
if (id === s._id) return s;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.isToday = function (weekDayIndex) {
|
$scope.isToday = function (weekDayIndex) {
|
||||||
return (now.getDay() - 1) === weekDayIndex;
|
return (now.getDay() - 1) === weekDayIndex;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="schedule" ng-controller="ScheduleController">
|
<div class="schedule" ng-controller="ScheduleController">
|
||||||
<p> Расписание {{sem}} семестра {{year}} года</p>
|
<p>
|
||||||
<div class="schedule-block">
|
<select ng-model="currentSchedule" ng-change="loadSchedule(currentSchedule)">
|
||||||
|
<option ng-repeat="s in schedules" value="{{s._id}}" selected="{{s.selected}}">{{s.text}}</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="schedule-block" ng-show="groups">
|
||||||
<table>
|
<table>
|
||||||
<thead class="">
|
<thead class="">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -37,8 +42,8 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="">
|
<tbody>
|
||||||
<tr ng-repeat="group in schedule">
|
<tr ng-repeat="group in groups">
|
||||||
<td class="group">
|
<td class="group">
|
||||||
<p class="name">{{group.name}}</p>
|
<p class="name">{{group.name}}</p>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user