= schedule page added;
+ clients dir for browser code; + some models (course); = other (main style, etc);
This commit is contained in:
1 parent
c1e160d779
commit
8784043f1d
12 files changed
+261
-57
No files matched your search
@@ -1,12 +1,10 @@
|
|||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
// width: 100%;
|
|
||||||
// height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "PT Sans";
|
font-family: "PT Sans", Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
td{
|
td{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
:not(.group){
|
&:not(.group){
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
/* width: 15%;*/
|
/* width: 15%;*/
|
||||||
width: 150px;
|
width: 150px;
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
vertical-align:baseline;
|
vertical-align:baseline;
|
||||||
|
|
||||||
p{
|
p{
|
||||||
position: absolute;
|
// position: absolute;
|
||||||
width:30px;
|
width:30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -155,6 +155,7 @@
|
|||||||
background-color: rgba(255, 255, 255, 0.96);
|
background-color: rgba(255, 255, 255, 0.96);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
|
||||||
|
border-radius: 0 0 20px 20px;
|
||||||
|
|
||||||
.current{
|
.current{
|
||||||
border: none;
|
border: none;
|
||||||
@@ -164,7 +165,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
th{
|
th{
|
||||||
/* border: 1px solid black;*/
|
|
||||||
:not(.group){
|
:not(.group){
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
/* width: 15%;*/
|
/* width: 15%;*/
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
$(document).ready(function(){
|
||||||
|
$(window).scroll(function(){
|
||||||
|
if ($(window).scrollTop() >= 220) {
|
||||||
|
$(".schedule table thead").addClass("fix animated fadeInDown");
|
||||||
|
$(".schedule table tbody").addClass("fix");
|
||||||
|
}else{
|
||||||
|
$(".schedule table thead").removeClass("fix animated fadeInDown");
|
||||||
|
$(".schedule table tbody").removeClass("fix");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var now = new Date();
|
||||||
|
var day = now.getDay();
|
||||||
|
if(day < 7) selectDay(day);
|
||||||
|
else deselectDays();
|
||||||
|
|
||||||
|
var dates = getDates(day);
|
||||||
|
// var dates = [45, 53, 53, 23, 53, 64];
|
||||||
|
$(".schedule thead .date").each(function(index, elem){
|
||||||
|
$(elem).text(dates[index]);
|
||||||
|
});
|
||||||
|
|
||||||
|
function selectDay(day){
|
||||||
|
deselectDays();
|
||||||
|
// day = Math.min(1, day);
|
||||||
|
// day = Math.max(6, day);
|
||||||
|
|
||||||
|
$($(".schedule thead th")[day]).addClass("current first");
|
||||||
|
$(".schedule tbody tr").each(function(index, elem){
|
||||||
|
$($(elem).find("td")[day]).addClass("current");
|
||||||
|
});
|
||||||
|
$($(".schedule tbody tr").last().find("td")[day]).addClass("last");
|
||||||
|
}
|
||||||
|
|
||||||
|
function deselectDays(){
|
||||||
|
$(".schedule thead th").removeClass("current first");
|
||||||
|
$(".schedule tbody td").removeClass("current last");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function range(start, num, step){
|
||||||
|
var list= [];
|
||||||
|
var val = start;
|
||||||
|
for(var i = 0; i<num; i++){
|
||||||
|
list.push(val);
|
||||||
|
val += step;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDates(day){
|
||||||
|
var dates = [];
|
||||||
|
var prev = day - 1;
|
||||||
|
var next = 6 - day;
|
||||||
|
var dayMask = range(-1, 1, -1).concat([0]).concat(range(1, next, 1));
|
||||||
|
console.log("day mask", dayMask);
|
||||||
|
dayMask.forEach(function(m){
|
||||||
|
var time = Date.now() + (1000 * 60 * 60 * 24) * m;
|
||||||
|
var date = new Date(time);
|
||||||
|
console.log(date);
|
||||||
|
dates.push(date.getDate());
|
||||||
|
});
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
@@ -1,10 +1,87 @@
|
|||||||
|
const MENU = require("./models/menu.json");
|
||||||
|
const DOCUMENTS = require("./models/documents.json");
|
||||||
|
const SCHEDULE = require("./models/schedule-2014-early.json");
|
||||||
|
|
||||||
|
const team = require("./models/team");
|
||||||
|
const course = require("./models/course");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
port: 18010,
|
port: 18010,
|
||||||
pub: "./",
|
pub: "./",
|
||||||
data:{
|
data:{
|
||||||
documents: require("./models/documents.json"),
|
menu: MENU,
|
||||||
schedule: require("./models/schedule-2014-early.json"),
|
documents: DOCUMENTS,
|
||||||
team: require("./models/team.json"),
|
team: team.team,
|
||||||
menu: require("./models/menu.json"),
|
courses: course.courses,
|
||||||
|
schedule: schedule(SCHEDULE),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function schedule(_schedule){
|
||||||
|
var days = function(group){
|
||||||
|
var result = [];
|
||||||
|
var list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
||||||
|
list.forEach(function(i){
|
||||||
|
var lesson = group[i];
|
||||||
|
if(lesson){
|
||||||
|
result.push(
|
||||||
|
lol(lesson)
|
||||||
|
.fun(time())
|
||||||
|
.fun(populate(team.short, "teacher"))
|
||||||
|
.fun(populate(course.name, "lesson"))
|
||||||
|
.data()
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
result.push(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var time = function(){
|
||||||
|
return function(lesson){
|
||||||
|
for(var i=0; i < lesson.time.length; i++){
|
||||||
|
lesson.time[i] = lesson.time[i].replace(" ", "—");
|
||||||
|
}
|
||||||
|
return lesson;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = [];
|
||||||
|
_schedule.forEach(function(group){
|
||||||
|
result.push({
|
||||||
|
name: group.name,
|
||||||
|
days: days(group)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lol(data){
|
||||||
|
var Fun = function(data){
|
||||||
|
this._data = data;
|
||||||
|
}
|
||||||
|
Fun.prototype = {
|
||||||
|
fun: function(fun){
|
||||||
|
if(typeof fun == "function"){
|
||||||
|
this._data = fun(this._data);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
data: function(){
|
||||||
|
return this._data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var fun = new Fun(data);
|
||||||
|
return fun;
|
||||||
|
}
|
||||||
|
|
||||||
|
function populate(find, field){
|
||||||
|
return function(lesson){
|
||||||
|
var id = lesson[field];
|
||||||
|
var val = find(id);
|
||||||
|
if(val) lesson[field] = val;
|
||||||
|
return lesson;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
const COURSES = require("./courses.json");
|
||||||
|
|
||||||
|
exports.courses = COURSES;
|
||||||
|
exports.course = getCourseByID;
|
||||||
|
exports.name = getCourseNameByID;
|
||||||
|
|
||||||
|
function getCourseByID(id){
|
||||||
|
for(var i=0; i<COURSES.length; i++){
|
||||||
|
var p = COURSES[i];
|
||||||
|
if(p.id == id){
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCourseNameByID(id){
|
||||||
|
var p = getCourseByID(id);
|
||||||
|
if(p) return p.name;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "painting",
|
||||||
|
"name": "Живопись"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "drawing",
|
||||||
|
"name": "Рисунок"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sculpting",
|
||||||
|
"name": "Скульптура"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "composition",
|
||||||
|
"name": "Композиция"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "history",
|
||||||
|
"name": "История искусства"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cg",
|
||||||
|
"name": "Комп. графика"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"name": "1",
|
"name": "1",
|
||||||
"monday": {
|
"monday": {
|
||||||
"lesson": "composition",
|
"lesson": "composition",
|
||||||
"teacher": "as-mantseva",
|
"teacher": "as-timasheva",
|
||||||
"time": [
|
"time": [
|
||||||
"15:00 15:45",
|
"15:00 15:45",
|
||||||
"15:55 16:40"
|
"15:55 16:40"
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
"saturday": {
|
"saturday": {
|
||||||
"lesson": "composition",
|
"lesson": "composition",
|
||||||
"teacher": "as-mantseva",
|
"teacher": "as-timasheva",
|
||||||
"time": [
|
"time": [
|
||||||
"12:00 12:45",
|
"12:00 12:45",
|
||||||
"12:55 13:40"
|
"12:55 13:40"
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
"saturday": {
|
"saturday": {
|
||||||
"lesson": "composition",
|
"lesson": "composition",
|
||||||
"teacher": "as-mantseva",
|
"teacher": "as-timasheva",
|
||||||
"time": [
|
"time": [
|
||||||
"10:00 10:45",
|
"10:00 10:45",
|
||||||
"10:55 11:40"
|
"10:55 11:40"
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
const TEAM = require("./team.json");
|
||||||
|
|
||||||
|
exports.team = TEAM;
|
||||||
|
exports.person = getPersonByID;
|
||||||
|
exports.name = getNameByID;
|
||||||
|
exports.short = getShortNameByID;
|
||||||
|
|
||||||
|
function getPersonByID(id){
|
||||||
|
for(var i=0; i<TEAM.length; i++){
|
||||||
|
var p = TEAM[i];
|
||||||
|
if(p.id == id){
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNameByID(id){
|
||||||
|
var p = getPersonByID(id);
|
||||||
|
if(p) return p.name;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getShortNameByID(id){
|
||||||
|
var n = getNameByID(id);
|
||||||
|
if(n) return shortifyName(n)
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function shortifyName(name){
|
||||||
|
var m = /(.+)\s(.+)\s(.+)/.exec(name);
|
||||||
|
var n = m[1].replace(/^(.).+/, "$1. ") +
|
||||||
|
m[2].replace(/^(.).+/, "$1. ") +
|
||||||
|
m[3];
|
||||||
|
return n;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ extends ../layout
|
|||||||
|
|
||||||
block custom_head
|
block custom_head
|
||||||
link(rel='stylesheet', href='/s/animate.min.css')
|
link(rel='stylesheet', href='/s/animate.min.css')
|
||||||
link(rel='stylesheet', href='/s/sschedule.css')
|
link(rel='stylesheet', href='/s/schedule.css')
|
||||||
script(src='http://code.jquery.com/jquery-2.1.0.min.js')
|
script(src='http://code.jquery.com/jquery-2.1.0.min.js')
|
||||||
script(src='/c/schedule.js')
|
script(src='/c/schedule.js')
|
||||||
|
|
||||||
@@ -25,53 +25,19 @@ block content
|
|||||||
//- th.current.first
|
//- th.current.first
|
||||||
//- th.weekend
|
//- th.weekend
|
||||||
th
|
th
|
||||||
p.day day
|
p.day #{day}
|
||||||
p.date
|
p.date
|
||||||
tbody
|
tbody
|
||||||
for group in groups
|
for group in groups
|
||||||
for
|
|
||||||
tr
|
tr
|
||||||
td.group
|
td.group
|
||||||
p 1
|
p #{group.name}
|
||||||
|
for day in group.days
|
||||||
td
|
td
|
||||||
|
if day
|
||||||
p.lesson
|
p.lesson
|
||||||
a(href='') Рисунок
|
a(href='') #{day.lesson}
|
||||||
p.teacher
|
p.teacher
|
||||||
a(href='') С. А. Латыпова
|
a(href='') #{day.teacher}
|
||||||
p.time 15:00—15:45
|
for time in day.time
|
||||||
p.time 15:55—16:40
|
p.time #{time}
|
||||||
td.canceled
|
|
||||||
p.lesson
|
|
||||||
a(href='') Живопись
|
|
||||||
p.teacher
|
|
||||||
a(href='') В. Ю. Саржин
|
|
||||||
p.time 15:00—15:45
|
|
||||||
p.time 15:55—16:40
|
|
||||||
td
|
|
||||||
p.lesson
|
|
||||||
a(href='') Макетирование
|
|
||||||
p.teacher
|
|
||||||
a(href='') А. С. Тимашева
|
|
||||||
p.time 15:00—15:45
|
|
||||||
p.time 15:55—16:40
|
|
||||||
td.current
|
|
||||||
p.lesson
|
|
||||||
a(href='') Композиция
|
|
||||||
p.teacher
|
|
||||||
a(href='') А. А Андеева
|
|
||||||
p.time 15:00—15:45
|
|
||||||
p.time 15:55—16:40
|
|
||||||
td
|
|
||||||
p.lesson
|
|
||||||
a(href='') История искусства
|
|
||||||
p.teacher
|
|
||||||
a(href='') М. Ю. Валькова
|
|
||||||
p.time 15:00—15:45
|
|
||||||
p.time 15:55—16:40
|
|
||||||
td
|
|
||||||
p.lesson
|
|
||||||
a(href='') Комп. графика
|
|
||||||
p.teacher
|
|
||||||
a(href='') Р. К. Тимашев
|
|
||||||
p.time 15:00—15:45
|
|
||||||
p.time 15:55—16:40
|
|
||||||
+1
-1
@@ -2,7 +2,7 @@ const config = require("../config")
|
|||||||
const DOCUMENTS = config.data.documents;
|
const DOCUMENTS = config.data.documents;
|
||||||
|
|
||||||
function getMenu(){
|
function getMenu(){
|
||||||
return config.data.menu;
|
return clone(config.data.menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDoc(name, capitalFirstLetter){
|
function getDoc(name, capitalFirstLetter){
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
var Router = require("express").Router;
|
||||||
|
var config = require("../config");
|
||||||
|
var route = require("./route");
|
||||||
|
|
||||||
|
var router = new Router();
|
||||||
|
router.get("/schedule", function(req, res){
|
||||||
|
var url = "/schedule";
|
||||||
|
|
||||||
|
res.render("schedule/schedule", {
|
||||||
|
menu: route.menu(url),
|
||||||
|
groups: config.data.schedule
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -22,6 +22,7 @@ server.get("/", function(req, res){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.use(require("./routers/schedule.router").middleware);
|
||||||
server.use(require("./routers/team.router").middleware);
|
server.use(require("./routers/team.router").middleware);
|
||||||
server.use(require("./routers/doc.router").middleware);
|
server.use(require("./routers/doc.router").middleware);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user