FUCKING BIG UPDATE: server, parallax, apis, new data models, style, layout, other
This commit is contained in:
1 parent
e0f54171a9
commit
359cc430f5
78 files changed
+1063
-445
No files matched your search
@@ -1,16 +1,16 @@
|
||||
import APIFeed from './APIFeed';
|
||||
import APIGallery from './APIGallery';
|
||||
import APITimeline from './APITimeline';
|
||||
import APIAlbum from './APIAlbum';
|
||||
import APIDocument from './APIDocument';
|
||||
import APICollective from './APICollective';
|
||||
import APITeacher from './APITeacher';
|
||||
import APISchedule from './APISchedule';
|
||||
import APIEvent from './APIEvent';
|
||||
|
||||
export default class API {
|
||||
constructor(request) {
|
||||
this.news = new APIFeed(request);
|
||||
this.gallery = new APIGallery(request);
|
||||
this.timeline = new APITimeline(request);
|
||||
this.album = new APIAlbum(request);
|
||||
this.document = new APIDocument(request);
|
||||
this.collective = new APICollective(request);
|
||||
this.teacher = new APITeacher(request);
|
||||
this.schedule = new APISchedule(request);
|
||||
this.event = new APIEvent(request);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import EndPoint from './EndPoint';
|
||||
|
||||
export default class APIAlbum extends EndPoint {
|
||||
list(){
|
||||
return this.get(`/gallery`);
|
||||
}
|
||||
|
||||
year(year) {
|
||||
return this.get(`/gallery/${year}`);
|
||||
}
|
||||
|
||||
fetch(id, doPopulate) {
|
||||
let url = `/album/${id}?populate=${doPopulate}`;
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ export default class APICollective extends EndPoint {
|
||||
list(sort=null) {
|
||||
let url = '/collective';
|
||||
if(sort) url = `/collective?sort=${sort.join(',')}`;
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ import EndPoint from './EndPoint';
|
||||
export default class APIDocument extends EndPoint {
|
||||
documents(){
|
||||
let url = '/documents/type/document';
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
|
||||
awards() {
|
||||
let url = '/documents/type/award';
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ import EndPoint from './EndPoint';
|
||||
export default class APIEvent extends EndPoint {
|
||||
list(skip=1, limit=10) {
|
||||
let url = `/events?skip=${skip}&limit=${limit}`;
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
|
||||
post(id) {
|
||||
let url = `/event/${id}`;
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Created by tmshv on 22/11/14.
|
||||
*/
|
||||
|
||||
import {query} from '../../utils/net';
|
||||
import EndPoint from './EndPoint';
|
||||
|
||||
export default class APIFeed extends EndPoint{
|
||||
feed(count, portion) {
|
||||
let q = query([['count', count], ['portion', portion]]);
|
||||
return this.request.get(`/news?${q}`);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@ import EndPoint from './EndPoint';
|
||||
|
||||
export default class APIGallery extends EndPoint {
|
||||
year(year) {
|
||||
return this.request.get(`/gallery/${year}`, {cache: true});
|
||||
return this.get(`/gallery/${year}`);
|
||||
}
|
||||
|
||||
album(year, course, album, doPopulate) {
|
||||
let url = `/gallery/${year}/${course}/${album}?populate=${doPopulate}`;
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
import EndPoint from './EndPoint';
|
||||
|
||||
export default class APISchedule extends EndPoint {
|
||||
get(period, semester, doPopulate=true) {
|
||||
let url = `/schedule/${period}/${semester}?populate=${doPopulate}`;
|
||||
return this.request.get(url, {cache: true});
|
||||
static buildScheduleUrl(period, semester) {
|
||||
return `/schedule/${period}/${semester}`;
|
||||
}
|
||||
|
||||
buildScheduleUrl(period, semester) {
|
||||
return `/schedule/${period}/${semester}`;
|
||||
fetch(period, semester, doPopulate=true) {
|
||||
let url = `/schedule/${period}/${semester}?populate=${doPopulate}`;
|
||||
return this.get(url);
|
||||
}
|
||||
|
||||
list() {
|
||||
let url = '/schedule/list';
|
||||
return this.request.get(url, {cache: true});
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import EndPoint from './EndPoint';
|
||||
|
||||
export default class APITeacher extends EndPoint {
|
||||
list(sort=null) {
|
||||
let url = '/teacher/list';
|
||||
if(sort) url = `/teacher/list?sort=${sort.join(',')}`;
|
||||
return this.get(url);
|
||||
}
|
||||
|
||||
fetch(id) {
|
||||
let url = `/teacher/${id}`;
|
||||
return this.get(url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import {query} from '../../utils/net';
|
||||
import EndPoint from './EndPoint';
|
||||
|
||||
export default class APITimeline extends EndPoint{
|
||||
feed(limit=10, skip=0) {
|
||||
let q = query([['limit', limit], ['skip', skip]]);
|
||||
return this.get(`/news?${q}`);
|
||||
}
|
||||
}
|
||||
@@ -2,4 +2,8 @@ export default class EndPoint{
|
||||
constructor(http){
|
||||
this.request = http;
|
||||
}
|
||||
|
||||
get(url){
|
||||
return this.request.get(url, {cache: true});
|
||||
}
|
||||
}
|
||||
+112
-6
@@ -19,14 +19,17 @@ import ScheduleSlide from './components/ScheduleSlide';
|
||||
import ScheduleRecord from './components/ScheduleRecord';
|
||||
import FooterLinks from './components/FooterLinks';
|
||||
import EventPost from './components/EventPost';
|
||||
import Album from './components/Album';
|
||||
import Parallax from './components/Parallax';
|
||||
|
||||
import PageSchool from './components/PageSchool';
|
||||
import PageEvents from './components/PageEvents';
|
||||
import PageEvent from './components/PageEvent';
|
||||
import PageSchedule from './components/PageSchedule';
|
||||
import PageCollective from './components/PageCollective';
|
||||
import PageTeacher from './components/PageTeacher';
|
||||
import PageGallery from './components/PageGallery';
|
||||
import PageGalleryAlbum from './components/PageGalleryAlbum';
|
||||
import PageAlbum from './components/PageAlbum';
|
||||
import PageDocuments from './components/PageDocuments';
|
||||
|
||||
import AppController from './controllers/AppController';
|
||||
@@ -45,7 +48,7 @@ import IOService from './services/io';
|
||||
import MenuService from './services/menu';
|
||||
import API from './services/api';
|
||||
|
||||
import {routes} from './config';
|
||||
import {collectiveSortPattern} from './config';
|
||||
|
||||
let app = angular.module('hudozka', [
|
||||
'ngRoute',
|
||||
@@ -58,9 +61,109 @@ app.config(($locationProvider, $routeProvider) => {
|
||||
$locationProvider.hashPrefix('!');
|
||||
$locationProvider.html5Mode(true);
|
||||
|
||||
routes.forEach(route => {
|
||||
if (typeof route === 'function') route = route();
|
||||
$routeProvider.when(route.name, route);
|
||||
let routers = [
|
||||
{
|
||||
name: '/',
|
||||
template: '<page-school></page-school>',
|
||||
title: 'ДХШ Шлиссельбурга'
|
||||
},
|
||||
{
|
||||
name: '/events/:page?/:pageNumber?',
|
||||
template: '<page-events events="$resolve.posts"></page-events>',
|
||||
title: 'События Школы',
|
||||
|
||||
resolve: {
|
||||
posts: api => api.event
|
||||
.list()
|
||||
.then(i => i.data)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/event/:event',
|
||||
template: '<page-event></page-event>'
|
||||
},
|
||||
{
|
||||
name: '/schedule/:period?/:semester?',
|
||||
template: '<page-schedule schedules="$resolve.list"></page-schedule>',
|
||||
title: 'Расписание',
|
||||
resolve: {
|
||||
list: api => api.schedule
|
||||
.list()
|
||||
.then(i => i.data)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/collective',
|
||||
template: '<page-collective members="$resolve.list"></page-collective>',
|
||||
title: 'Преподаватели',
|
||||
resolve: {
|
||||
list: api => api.teacher
|
||||
.list(collectiveSortPattern)
|
||||
.then(i => i.data)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/teacher/:id',
|
||||
template: '<page-teacher member="$resolve.profile"></page-teacher>',
|
||||
title: 'Преподаватели',
|
||||
resolve: {
|
||||
profile: ($route, api) => {
|
||||
let id = $route.current.params.id;
|
||||
return api.teacher
|
||||
.fetch(id)
|
||||
.then(i => i.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/gallery',
|
||||
template: '<page-gallery albums="$resolve.list"></page-gallery>',
|
||||
title: 'Работы учащихся',
|
||||
resolve: {
|
||||
list: api => api.album
|
||||
.list()
|
||||
.then(i => i.data)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/album/:id',
|
||||
template: '<page-album album="$resolve.album"></page-album>',
|
||||
resolve: {
|
||||
album: ($route, api) => {
|
||||
let id = $route.current.params.id;
|
||||
|
||||
return api.album
|
||||
.fetch(id)
|
||||
.then(i => i.data)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/documents',
|
||||
template: '<page-documents awards="$resolve.awards" documents="$resolve.documents"></page-documents>',
|
||||
title: 'Документы',
|
||||
resolve: {
|
||||
awards: api => api.document
|
||||
.awards()
|
||||
.then(i => i.data),
|
||||
|
||||
documents: api => api.document
|
||||
.documents()
|
||||
.then(i => i.data)
|
||||
}
|
||||
}
|
||||
]
|
||||
.map(i => {
|
||||
let path = i.name;
|
||||
delete i.name;
|
||||
return {
|
||||
path: path,
|
||||
route: i
|
||||
}
|
||||
});
|
||||
|
||||
routers.forEach(i => {
|
||||
$routeProvider.when(i.path, i.route);
|
||||
});
|
||||
|
||||
$routeProvider.otherwise({
|
||||
@@ -96,6 +199,8 @@ app.run(($location, $rootScope, $http) => {
|
||||
TimelineRecordPost,
|
||||
TimelineRecordInstagram,
|
||||
EventPost,
|
||||
Album,
|
||||
Parallax,
|
||||
Document,
|
||||
Award,
|
||||
GalleryItem,
|
||||
@@ -106,8 +211,9 @@ app.run(($location, $rootScope, $http) => {
|
||||
PageEvents,
|
||||
PageSchedule,
|
||||
PageCollective,
|
||||
PageTeacher,
|
||||
PageGallery,
|
||||
PageGalleryAlbum,
|
||||
PageAlbum,
|
||||
PageDocuments,
|
||||
AppController,
|
||||
CopyrightController,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import template from '../../templates/components/album.html';
|
||||
|
||||
export class AlbumController {
|
||||
constructor($sce) {
|
||||
if(this.album){
|
||||
//this.post = $sce.trustAsHtml(this.album.post);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function (app) {
|
||||
app.component('album', {
|
||||
bindings: {
|
||||
//album: '<'
|
||||
title: '@'
|
||||
},
|
||||
transclude: true,
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
//controller: function ($sce) {
|
||||
// if(this.album){
|
||||
// this.post = $sce.trustAsHtml(this.album.post);
|
||||
// }
|
||||
//}
|
||||
});
|
||||
};
|
||||
@@ -6,6 +6,7 @@ export default function (app) {
|
||||
title: '@',
|
||||
albums: '<'
|
||||
},
|
||||
template: template
|
||||
template: template,
|
||||
controllerAs: '$'
|
||||
});
|
||||
};
|
||||
@@ -3,8 +3,9 @@ import template from '../../templates/components/award.html';
|
||||
export default function (app) {
|
||||
app.component('award', {
|
||||
bindings: {
|
||||
document: '='
|
||||
document: '<'
|
||||
},
|
||||
template: template
|
||||
template: template,
|
||||
controllerAs: '$'
|
||||
});
|
||||
};
|
||||
@@ -3,8 +3,12 @@ import template from '../../templates/components/gallery-item.html';
|
||||
export default function (app) {
|
||||
app.component('galleryItem', {
|
||||
bindings: {
|
||||
record: '='
|
||||
record: '<'
|
||||
},
|
||||
template: template
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function () {
|
||||
this.previewImage = this.record.preview.url;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -5,6 +5,7 @@ export default function (app) {
|
||||
bindings: {
|
||||
menu: '<'
|
||||
},
|
||||
template: template
|
||||
template: template,
|
||||
controllerAs: '$'
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import template from '../../templates/components/page-album.html';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageAlbum', {
|
||||
bindings: {
|
||||
album: '<'
|
||||
},
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function ($rootScope,$sce, menu) {
|
||||
menu.activate('/gallery');
|
||||
|
||||
this.post = $sce.trustAsHtml(this.album.post);
|
||||
|
||||
//this.crumbs = [
|
||||
// {
|
||||
// url: '/gallery',
|
||||
// name: 'Галерея'
|
||||
// },
|
||||
// {
|
||||
// name: 1010
|
||||
// },
|
||||
// {
|
||||
// name: album.title
|
||||
// }
|
||||
//];
|
||||
|
||||
$rootScope.title = this.album.title;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,16 +1,16 @@
|
||||
import template from '../../templates/components/page-collective.html';
|
||||
import {collectiveSortPattern} from '../config';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageCollective', {
|
||||
bindings:{
|
||||
members: '<'
|
||||
},
|
||||
template: template,
|
||||
controller: function(api) {
|
||||
this.pageClass = 'page-collective';
|
||||
|
||||
api.collective.list(collectiveSortPattern)
|
||||
.success(collective => {
|
||||
this.members = collective;
|
||||
});
|
||||
controller: function() {
|
||||
//api.collective.list(collectiveSortPattern)
|
||||
// .success(collective => {
|
||||
// this.members = collective;
|
||||
// });
|
||||
|
||||
//let rangelen = r => r[1] - r[0];
|
||||
//let interpolate = (r, i) => (i - r[0]) / rangelen(r);
|
||||
|
||||
@@ -1,40 +1,37 @@
|
||||
import template from '../../templates/components/page-documents.html';
|
||||
|
||||
let unique = fn => list => [...new Set(list.map(fn))];
|
||||
import {unique} from '../../utils/common';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageDocuments', {
|
||||
bindings: {
|
||||
awards: '<',
|
||||
documents: '<'
|
||||
},
|
||||
template: template,
|
||||
controller: function (api) {
|
||||
controllerAs: '$',
|
||||
controller: function () {
|
||||
this.pageClass = 'page-documents';
|
||||
let categories = unique(i => i.category);
|
||||
|
||||
this.collections = [];
|
||||
|
||||
api.document.documents()
|
||||
.success(documents => {
|
||||
let cats = categories(documents)
|
||||
.map(cat => new Object({
|
||||
name: cat,
|
||||
documents: []
|
||||
}));
|
||||
let documents = this.documents;
|
||||
let cats = categories(documents)
|
||||
.map(cat => new Object({
|
||||
name: cat,
|
||||
documents: []
|
||||
}));
|
||||
|
||||
let docCollections = documents.reduce(
|
||||
(cats, doc) => {
|
||||
let c = cats.find(i => i.name === doc.category);
|
||||
c.documents.push(doc);
|
||||
return cats;
|
||||
},
|
||||
cats
|
||||
);
|
||||
let docCollections = documents.reduce(
|
||||
(cats, doc) => {
|
||||
let c = cats.find(i => i.name === doc.category);
|
||||
c.documents.push(doc);
|
||||
return cats;
|
||||
},
|
||||
cats
|
||||
);
|
||||
|
||||
this.collections = this.collections.concat(docCollections);
|
||||
});
|
||||
|
||||
api.document.awards()
|
||||
.success(data => {
|
||||
this.awards = data;
|
||||
});
|
||||
this.collections = this.collections.concat(docCollections);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -2,16 +2,19 @@ import template from '../../templates/components/page-events.html';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageEvents', {
|
||||
bindings: {
|
||||
events: '<'
|
||||
},
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function (api, menu) {
|
||||
this.pageClass = 'page-events';
|
||||
menu.activate('/events');
|
||||
|
||||
api.event.list()
|
||||
.success(posts => {
|
||||
this.posts = posts;
|
||||
});
|
||||
//api.event.list()
|
||||
// .success(posts => {
|
||||
// this.posts = posts;
|
||||
// });
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,27 +1,37 @@
|
||||
import template from '../../templates/components/page-gallery.html';
|
||||
import {branch} from '../../utils/common';
|
||||
|
||||
export default function (app) {
|
||||
let branchYears = branch(
|
||||
i => 'date' in i ? i.date.getFullYear() : 'XXXX'
|
||||
);
|
||||
|
||||
app.component('pageGallery', {
|
||||
bindings: {
|
||||
albums: '<'
|
||||
},
|
||||
template: template,
|
||||
controller: function (api) {
|
||||
controllerAs: '$',
|
||||
controller: function () {
|
||||
this.pageClass = 'page-gallery';
|
||||
|
||||
this.years = [];
|
||||
[2015, 2014, 2013, 2012, 2011, 2010]
|
||||
.forEach((year, year_index) => {
|
||||
api.gallery.year(year)
|
||||
.success(albums => {
|
||||
if (albums.length) {
|
||||
this.years[year_index] = {
|
||||
year: year,
|
||||
albums: albums.map(album => {
|
||||
let preview = album.content[0];
|
||||
album.preview_url = preview.content.medium.url;
|
||||
return album;
|
||||
})
|
||||
};
|
||||
}
|
||||
})
|
||||
let years = branchYears(
|
||||
this.albums
|
||||
.map(i => {
|
||||
i['date'] = new Date(i['date']);
|
||||
return i;
|
||||
})
|
||||
);
|
||||
|
||||
this.collections = Object
|
||||
.keys(years)
|
||||
.map(i => parseInt(i))
|
||||
.sort((a, b) => b - a)
|
||||
.map(i => {
|
||||
return {
|
||||
title: i,
|
||||
albums: years[i]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,74 +1,62 @@
|
||||
import template from '../../templates/components/page-schedule.html';
|
||||
import APISchedule from '../api/APISchedule';
|
||||
import {populate} from '../../utils/populate';
|
||||
import {getCourseNameByID} from '../../models/course';
|
||||
import {indexEquals} from '../../utils/common';
|
||||
import {select, choise} from '../../utils/common';
|
||||
|
||||
function isRequested(period, semester) {
|
||||
return function (schedule) {
|
||||
return schedule.period === period && schedule.semester === semester;
|
||||
}
|
||||
}
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageSchedule', {
|
||||
template: template,
|
||||
bindings: {
|
||||
//currentSchedule: '<',
|
||||
schedules: '<'
|
||||
},
|
||||
controller: function($http, $location, $routeParams, api, menu) {
|
||||
this.pageClass = 'page-schedule';
|
||||
menu.activate('/schedule');
|
||||
|
||||
let current_period = $routeParams.period;
|
||||
let current_semester = $routeParams.semester;
|
||||
let isScheduleRequested = current_period && current_semester;
|
||||
const period = $routeParams.period;
|
||||
const semester = $routeParams.semester;
|
||||
const useRoute = period && semester;
|
||||
|
||||
this.schedules = [];
|
||||
let getScheduleByID = (id) => choise(
|
||||
this.schedules,
|
||||
select(i => i._id === id)
|
||||
);
|
||||
|
||||
api.schedule.list()
|
||||
.success(schedules => {
|
||||
// By url params or last element
|
||||
let selector = isScheduleRequested ? isRequested(current_period, current_semester) : indexEquals(schedules.length - 1);
|
||||
|
||||
schedules = schedules.map(schedule => {
|
||||
let sem = [['spring', 'Весна'], ['autumn', 'Осень']]
|
||||
.reduce(select(
|
||||
i => i[0] === schedule.semester,
|
||||
i => i[1]
|
||||
));
|
||||
schedule.text = `${sem} ${schedule.period} года`;
|
||||
|
||||
return schedule;
|
||||
});
|
||||
|
||||
schedules.forEach((schedule, i) => {
|
||||
if (selector(schedule, i)) {
|
||||
this.currentSchedule = schedules[i];
|
||||
}
|
||||
});
|
||||
|
||||
this.schedules = schedules;
|
||||
this.loadSchedule(this.currentSchedule, isScheduleRequested);
|
||||
});
|
||||
|
||||
this.loadSchedule = (s, doUpdateURL) => {
|
||||
let id = s._id;
|
||||
let schedule_item = getScheduleByID(id);
|
||||
|
||||
if (schedule_item) {
|
||||
let sem = schedule_item.semester;
|
||||
let period = schedule_item.period;
|
||||
|
||||
api.schedule.get(period, sem, true)
|
||||
.success(scheduleRecord => {
|
||||
this.schedule = scheduleRecord.schedule;
|
||||
|
||||
if (doUpdateURL) $location.url(api.schedule.buildScheduleUrl(period, sem));
|
||||
this.loadSchedule = (record, doUpdateURL) => {
|
||||
let id = record._id;
|
||||
let scheduleItem = getScheduleByID(id);
|
||||
if (scheduleItem) {
|
||||
let p = scheduleItem.period;
|
||||
let s = scheduleItem.semester;
|
||||
api.schedule.fetch(p, s, true)
|
||||
.then(i => i.data)
|
||||
.then(i => {
|
||||
this.schedule = i.schedule;
|
||||
if (doUpdateURL) $location.url(APISchedule.buildScheduleUrl(p, s));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let getScheduleByID = id => this.schedules
|
||||
.find(i => i._id === id);
|
||||
|
||||
let getRoutedSchedule = list => {
|
||||
return list.find(i => i.period === period && i.semester === semester)
|
||||
};
|
||||
|
||||
let last = list => list.length ? list[list.length - 1] : null;
|
||||
let getDefaultSchedule = list => last(list);
|
||||
|
||||
let word = semester => [['spring', 'Весна'], ['autumn', 'Осень']]
|
||||
.find(i => i[0] === semester)
|
||||
[1];
|
||||
|
||||
this.schedules.forEach(i => {
|
||||
let periodIndex = i.semester === 'spring' ? 1 : 0;
|
||||
let year = i.period.split('-')[periodIndex];
|
||||
i.text = `${word(i.semester)} ${year} года`;
|
||||
});
|
||||
this.currentSchedule = useRoute ? getRoutedSchedule(this.schedules) : getDefaultSchedule(this.schedules);
|
||||
|
||||
this.loadSchedule(this.currentSchedule, useRoute);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,10 +1,19 @@
|
||||
import template from '../../templates/components/page-school.html';
|
||||
import {mobileMatchSelector} from '../config';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageSchool', {
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function() {
|
||||
this.pageClass = 'page-school';
|
||||
this.helloBlock = 'parallax';
|
||||
|
||||
try {
|
||||
if (window.matchMedia(mobileMatchSelector).matches) {
|
||||
this.helloBlock = 'mobile-image';
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
//let fotorama;
|
||||
//let $tape = $('.tape-block');
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import template from '../../templates/components/page-teacher.html';
|
||||
|
||||
export default function (app) {
|
||||
app.component('pageTeacher', {
|
||||
bindings:{
|
||||
member: '<'
|
||||
},
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function(menu){
|
||||
menu.activate('/collective');
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
import template from '../../templates/components/parallax.html'
|
||||
|
||||
export default function (app) {
|
||||
app.directive('parallax', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
link: function (scope, element) {
|
||||
let map_range = (i, low1, high1, low2, high2) => low2 + (high2 - low2) * (i - low1) / (high1 - low1);
|
||||
|
||||
scope.layers = [
|
||||
{x: 0, y: 0, s: 0, url: 'https://static.shlisselburg.org/art/graphics/main/11.jpg'},
|
||||
//{x: 716, y: 127, s: -0.4, url: 'https://static.shlisselburg.org/art/graphics/main/10.png'},
|
||||
//{x: 0, y: 216, s: -0.3, url: 'https://static.shlisselburg.org/art/graphics/main/9.png'},
|
||||
|
||||
{x: 0, y: 450, s: -0.2, url: 'https://static.shlisselburg.org/art/graphics/main/8.png'},
|
||||
{x: 683, y: 378, s: -0.25, url: 'https://static.shlisselburg.org/art/graphics/main/7.png'},
|
||||
{x: 0, y: 522, s: -0.3, url: 'https://static.shlisselburg.org/art/graphics/main/6.png'},
|
||||
{x: 414, y: 585, s: -0.4, url: 'https://static.shlisselburg.org/art/graphics/main/5.png'},
|
||||
{x: 0, y: 213, s: -.5, url: 'https://static.shlisselburg.org/art/graphics/main/4.png'},
|
||||
{x: 206, y: 667, s: -.6, url: 'https://static.shlisselburg.org/art/graphics/main/3.png'},
|
||||
{x: 556, y: 506, s: -0.7, url: 'https://static.shlisselburg.org/art/graphics/main/2.png'},
|
||||
{x: 0, y: 914, s: -0.7, url: 'https://static.shlisselburg.org/art/graphics/main/1.png'},
|
||||
|
||||
{x: 13, y: 88, s: 0, url: 'https://static.shlisselburg.org/art/graphics/main/title.png'}
|
||||
];
|
||||
|
||||
function mapper(range1, range2, fit) {
|
||||
let [r1, r2] = range1;
|
||||
let [d1, d2] = range2;
|
||||
|
||||
let constrain = value => {
|
||||
var min = Math.min(d1, d2);
|
||||
var max = Math.max(d1, d2);
|
||||
return Math.min(max, Math.max(min, value));
|
||||
};
|
||||
|
||||
return value => fit ?
|
||||
constrain(map_range(value, r1, r2, d1, d2))
|
||||
:
|
||||
map_range(value, r1, r2, d1, d2)
|
||||
}
|
||||
|
||||
let hm = mapper([0, 900], [0, 900], true);
|
||||
let em = mapper([340, 900], [0, 400], true);
|
||||
//let pm = mapper([0, 1000], [1000, 900], true);
|
||||
|
||||
function updateHead(value) {
|
||||
//console.log(value);
|
||||
|
||||
let v = hm(value);
|
||||
//let v = value;
|
||||
|
||||
try {
|
||||
[...document.querySelectorAll('.parallax .parallax__layer')]
|
||||
.forEach((e, i) => {
|
||||
let layer = scope.layers[i];
|
||||
e.style.top = `${layer.y + v * layer.s}px`;
|
||||
});
|
||||
|
||||
let end = document.querySelector('.parallax .parallax__end');
|
||||
end.style.height = `${em(value)}px`;
|
||||
|
||||
//let container = document.querySelector('.parallax');
|
||||
//container.style.height = '1000px';
|
||||
//container.style.height = `${pm(value)}px`;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
updateHead(0);
|
||||
$(window).scroll(() => {
|
||||
updateHead($(window).scrollTop())
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import template from '../../templates/components/schedule.html';
|
||||
import {mobileMatchSelector} from '../config';
|
||||
|
||||
export default function(app) {
|
||||
app.component('schedule', {
|
||||
@@ -10,11 +11,11 @@ export default function(app) {
|
||||
this.type = 'table';
|
||||
|
||||
try {
|
||||
if (window.matchMedia('(max-device-width: 30em)').matches) {
|
||||
if (window.matchMedia(mobileMatchSelector).matches) {
|
||||
this.type = 'slider';
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -13,9 +13,9 @@ function week(schedule) {
|
||||
date: dates[i],
|
||||
groups: schedule.map(group => {
|
||||
return {
|
||||
name: group.name,
|
||||
name: group.group,
|
||||
time: group.time,
|
||||
content: group.days[i]
|
||||
content: group.week[i]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
import {splitName} from '../../models/collective';
|
||||
import {stringToBoolean} from '../../utils/string';
|
||||
import template from '../../templates/components/teacher-profile.html';
|
||||
|
||||
export default function (app) {
|
||||
app.component('teacherProfile', {
|
||||
bindings: {
|
||||
member: '='
|
||||
profile: '<',
|
||||
showUrl: '@'
|
||||
},
|
||||
template: template,
|
||||
controllerAs: '$',
|
||||
controller: function($sce){
|
||||
const [_, first, middle, last] = splitName(this.member.name);
|
||||
this.url = this.showUrl === 'true';
|
||||
//this.showUrl = stringToBoolean(this.showUrl);
|
||||
|
||||
const [_, first, middle, last] = splitName(this.profile.name);
|
||||
this.firstName = first;
|
||||
this.middleName = middle;
|
||||
this.lastName = last;
|
||||
|
||||
if(this.member.picture){
|
||||
this.image = this.member.picture.big;
|
||||
if (this.profile.picture) {
|
||||
this.image = this.profile.picture.data.big;
|
||||
}
|
||||
|
||||
this.biography = $sce.trustAsHtml(this.member.biography);
|
||||
this.biography = $sce.trustAsHtml(this.profile.biography);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -28,8 +28,8 @@ export default function(app) {
|
||||
app.component('timeline', {
|
||||
template: template,
|
||||
controller: function($timeout, usSpinnerService, io, api){
|
||||
let portion = 0;
|
||||
let count = 10;
|
||||
let skip = 0;
|
||||
let limit = 10;
|
||||
this.feed = [];
|
||||
|
||||
this.timelineUpdating = false;
|
||||
@@ -59,7 +59,7 @@ export default function(app) {
|
||||
this.timelineUpdating = true;
|
||||
usSpinnerService.spin('timelineMore');
|
||||
|
||||
api.news.feed(count, portion)
|
||||
api.timeline.feed(limit, skip)
|
||||
.error(error => {
|
||||
console.log(error);
|
||||
})
|
||||
@@ -72,7 +72,7 @@ export default function(app) {
|
||||
else return post;
|
||||
});
|
||||
|
||||
portion++;
|
||||
skip++;
|
||||
this.feed = this.feed.concat(feed2);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function (app) {
|
||||
},
|
||||
template: template,
|
||||
controller: function($sce){
|
||||
this.message = $sce.trustAsHtml(this.post.body);
|
||||
this.message = $sce.trustAsHtml(this.post.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
+2
-41
@@ -2,6 +2,8 @@ import {stringReplace} from '../utils/string';
|
||||
|
||||
const nbsp = 0xA0;
|
||||
|
||||
export const mobileMatchSelector = '(max-device-width: 30em)';
|
||||
|
||||
export let contacts = {
|
||||
telephone: '+7 (81362) 76-312',
|
||||
email: 'hudozka@gmail.com',
|
||||
@@ -19,47 +21,6 @@ export let collectiveSortPattern = [
|
||||
'nv-andreeva'
|
||||
];
|
||||
|
||||
export let routes = [
|
||||
{
|
||||
name: '/',
|
||||
template: '<page-school></page-school>',
|
||||
title: 'ДХШ Шлиссельбурга'
|
||||
},
|
||||
{
|
||||
name: '/events/:page?/:pageNumber?',
|
||||
template: '<page-events></page-events>',
|
||||
title: 'События Школы'
|
||||
},
|
||||
{
|
||||
name: '/event/:event',
|
||||
template: '<page-event></page-event>'
|
||||
},
|
||||
{
|
||||
name: '/schedule/:period?/:semester?',
|
||||
template: '<page-schedule></page-schedule>',
|
||||
title: 'Расписание'
|
||||
},
|
||||
{
|
||||
name: '/collective',
|
||||
template: '<page-collective></page-collective>',
|
||||
title: 'Преподаватели'
|
||||
},
|
||||
{
|
||||
name: '/gallery',
|
||||
template: '<page-gallery></page-gallery>',
|
||||
title: 'Работы учащихся'
|
||||
},
|
||||
{
|
||||
name: '/gallery/:year/:course/:album',
|
||||
template: '<page-gallery-album></page-gallery-album>'
|
||||
},
|
||||
{
|
||||
name: '/documents',
|
||||
template: '<page-documents></page-documents>',
|
||||
title: 'Документы'
|
||||
}
|
||||
];
|
||||
|
||||
export const footer = {
|
||||
links: {
|
||||
docs: {
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import {footer} from '../config';
|
||||
import {footer, mobileMatchSelector} from '../config';
|
||||
|
||||
export default function (app) {
|
||||
app.controller('AppController', ($scope, menu) => {
|
||||
try {
|
||||
if (window.matchMedia(mobileMatchSelector).matches) {
|
||||
$scope.navigation = 'navigation';
|
||||
}else{
|
||||
$scope.navigation = 'main-menu';
|
||||
}
|
||||
} catch (e) {
|
||||
$scope.navigation = 'main-menu';
|
||||
}
|
||||
|
||||
$scope.menuProvider = menu.items;
|
||||
$scope.footer = footer;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user