diff --git a/src/client/app.js b/src/client/app.js
index 4f26d7f2..61a291c9 100644
--- a/src/client/app.js
+++ b/src/client/app.js
@@ -51,162 +51,162 @@ import {sortByPattern} from '../utils/sort';
import {documentsSortPattern, collectiveSortPattern} from './config';
let app = angular.module('hudozka', [
- 'ngRoute',
- 'angulartics',
- 'angulartics.google.analytics',
- 'angularSpinner'
+ 'ngRoute',
+ 'angulartics',
+ 'angulartics.google.analytics',
+ 'angularSpinner'
]);
app.config(($locationProvider, $routeProvider) => {
- $locationProvider.hashPrefix('!');
- $locationProvider.html5Mode(true);
+ $locationProvider.hashPrefix('!');
+ $locationProvider.html5Mode(true);
- let routers = [
- {
- name: '/',
- template: '',
- title: 'Шлиссельбургская детская художественная школа'
- },
- {
- name: '/events/:page?',
- template: '',
- title: 'События Школы',
- resolveAs: '$',
- resolve: {
- page: ($route, api) => {
- let page = $route.current.params.page;
- if(!page) page = 1;
+ let routers = [
+ {
+ name: '/',
+ template: '',
+ title: 'Шлиссельбургская детская художественная школа'
+ },
+ {
+ name: '/events/:page?',
+ template: '',
+ title: 'События Школы',
+ resolveAs: '$',
+ resolve: {
+ page: ($route, api) => {
+ let page = $route.current.params.page;
+ if (!page) page = 1;
- return api.event
- .list(page)
- .then(i => i.data)
- .then(i => {
- let totalPages = Math.ceil(i.total / i.limit);
- return {
- data: i.data,
- page: page,
- totalPages: totalPages
- }
- });
- }
- }
- },
- {
- name: '/article/:id',
- template: '',
- resolveAs: '$',
- resolve:{
- data: ($route, api) => {
- let id = $route.current.params.id;
- if(!id) return null;
- return api.article.id(id)
- .then(i => i.data)
- }
- }
- },
- {
- name: '/schedule/:period?/:semester?',
- template: '',
- title: 'Расписание',
- resolve: {
- list: api => api.schedule
- .list()
- .then(i => i.data)
- }
- },
- {
- name: '/collective',
- template: '',
- title: 'Преподаватели',
- resolve: {
- list: api => api.teacher
- .list(collectiveSortPattern)
- .then(i => i.data)
- }
- },
- {
- name: '/teacher/:id',
- template: '',
- title: 'Преподаватели',
- resolve: {
- profile: ($route, api) => {
- let id = $route.current.params.id;
- return api.teacher
- .fetch(id)
- .then(i => i.data);
- }
- }
- },
- {
- name: '/gallery',
- template: '',
- title: 'Работы учащихся',
- resolve: {
- list: api => api.album
- .list()
- .then(i => i.data)
- }
- },
- {
- name: '/album/:id',
- template: '',
- resolve: {
- album: ($route, api) => {
- let id = $route.current.params.id;
+ return api.event
+ .list(page)
+ .then(i => i.data)
+ .then(i => {
+ let totalPages = Math.ceil(i.total / i.limit);
+ return {
+ data: i.data,
+ page: page,
+ totalPages: totalPages
+ }
+ });
+ }
+ }
+ },
+ {
+ name: '/article/:id',
+ template: '',
+ resolveAs: '$',
+ resolve: {
+ data: ($route, api) => {
+ let id = $route.current.params.id;
+ if (!id) return null;
+ return api.article.id(id)
+ .then(i => i.data)
+ }
+ }
+ },
+ {
+ name: '/schedule/:period?/:semester?',
+ template: '',
+ title: 'Расписание',
+ resolve: {
+ list: api => api.schedule
+ .list()
+ .then(i => i.data)
+ }
+ },
+ {
+ name: '/collective',
+ template: '',
+ title: 'Преподаватели',
+ resolve: {
+ list: api => api.teacher
+ .list(collectiveSortPattern)
+ .then(i => i.data)
+ }
+ },
+ {
+ name: '/teacher/:id',
+ template: '',
+ title: 'Преподаватели',
+ resolve: {
+ profile: ($route, api) => {
+ let id = $route.current.params.id;
+ return api.teacher
+ .fetch(id)
+ .then(i => i.data);
+ }
+ }
+ },
+ {
+ name: '/gallery',
+ template: '',
+ title: 'Работы учащихся',
+ resolve: {
+ list: api => api.album
+ .list()
+ .then(i => i.data)
+ }
+ },
+ {
+ name: '/album/:id',
+ template: '',
+ resolve: {
+ album: ($route, api) => {
+ let id = $route.current.params.id;
- return api.album
- .fetch(id)
- .then(i => i.data)
- }
- }
- },
- {
- name: '/documents',
- template: '',
- title: 'Документы',
- resolve: {
- awards: api => api.document
- .awards()
- .then(i => i.data),
+ return api.album
+ .fetch(id)
+ .then(i => i.data)
+ }
+ }
+ },
+ {
+ name: '/documents',
+ template: '',
+ title: 'Документы',
+ resolve: {
+ awards: api => api.document
+ .awards()
+ .then(i => i.data),
- documents: api => api.document
- .documents()
- .then(i => i.data)
- .then(i => {
- return sortByPattern(i, documentsSortPattern, i => i.category);
- })
- }
- },
- {
- name: '/documents/:id',
- template: '',
- resolve: {
- document: ($route, api) => {
- let id = $route.current.params.id;
+ documents: api => api.document
+ .documents()
+ .then(i => i.data)
+ .then(i => {
+ return sortByPattern(i, documentsSortPattern, i => i.category);
+ })
+ }
+ },
+ {
+ name: '/documents/:id',
+ template: '',
+ resolve: {
+ document: ($route, api) => {
+ let id = $route.current.params.id;
- return api.document
- .id(id)
- .then(i => i.data)
- }
- }
- }
- ]
- .map(i => {
- let path = i.name;
- delete i.name;
- return {
- path: path,
- route: i
- }
- });
+ return api.document
+ .id(id)
+ .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);
- });
+ routers.forEach(i => {
+ $routeProvider.when(i.path, i.route);
+ });
- $routeProvider.otherwise({
- templateUrl: '/404.html'
- });
+ $routeProvider.otherwise({
+ templateUrl: '/404.html'
+ });
});
app.run(($location, $rootScope, $http) => {
@@ -230,57 +230,57 @@ app.run(($location, $rootScope, $http) => {
}, 500)
});
- $rootScope.$on('$routeChangeError', (event, current) => {
- //let title = current['$$route'].title;
- //if (title) $rootScope.title = title;
- });
+ $rootScope.$on('$routeChangeError', (event, current) => {
+ // let title = current['$$route'].title;
+ // if (title) $rootScope.title = title;
+ });
- $http.defaults.headers.common['Accept'] = 'application/json';
+ $http.defaults.headers.common['Accept'] = 'application/json';
});
[
- API,
- IOService,
- MenuService,
- RemoveHashtags,
- RemoveNewline,
- Strip,
- Join,
- UppercaseFirst,
- Bytes,
- Ext,
- MainMenu,
- Navigation,
- Breadcrumbs,
- Timeline,
- TimelineRecord,
- TimelineRecordInstagram,
- Article,
- ArticlePageControl,
- Album,
- Parallax,
- Document,
- Award,
- GalleryItem,
- AlbumCollection,
- TeacherProfile,
- PageSchool,
- PageArticle,
- PageEvents,
- PageSchedule,
- PageCollective,
- PageTeacher,
- PageGallery,
- PageAlbum,
- PageDocuments,
- PageDocument,
- AppController,
- CopyrightController,
- ContactsController,
- Schedule,
- ScheduleTable,
- ScheduleSlider,
- ScheduleSlide,
- ScheduleRecord,
- FooterLinks
+ API,
+ IOService,
+ MenuService,
+ RemoveHashtags,
+ RemoveNewline,
+ Strip,
+ Join,
+ UppercaseFirst,
+ Bytes,
+ Ext,
+ MainMenu,
+ Navigation,
+ Breadcrumbs,
+ Timeline,
+ TimelineRecord,
+ TimelineRecordInstagram,
+ Article,
+ ArticlePageControl,
+ Album,
+ Parallax,
+ Document,
+ Award,
+ GalleryItem,
+ AlbumCollection,
+ TeacherProfile,
+ PageSchool,
+ PageArticle,
+ PageEvents,
+ PageSchedule,
+ PageCollective,
+ PageTeacher,
+ PageGallery,
+ PageAlbum,
+ PageDocuments,
+ PageDocument,
+ AppController,
+ CopyrightController,
+ ContactsController,
+ Schedule,
+ ScheduleTable,
+ ScheduleSlider,
+ ScheduleSlide,
+ ScheduleRecord,
+ FooterLinks
].map(i => i(app));