client app.js eslinted
This commit is contained in:
1 parent
997923a3d8
commit
59cbcc7886
1 file changed
+195
-195
+195
-195
@@ -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: '<page-school></page-school>',
|
||||
title: 'Шлиссельбургская детская художественная школа'
|
||||
},
|
||||
{
|
||||
name: '/events/:page?',
|
||||
template: '<page-events page="{{$.page.page}}" total-pages="{{$.page.totalPages}}" posts="$.page.data"></page-events>',
|
||||
title: 'События Школы',
|
||||
resolveAs: '$',
|
||||
resolve: {
|
||||
page: ($route, api) => {
|
||||
let page = $route.current.params.page;
|
||||
if(!page) page = 1;
|
||||
let routers = [
|
||||
{
|
||||
name: '/',
|
||||
template: '<page-school></page-school>',
|
||||
title: 'Шлиссельбургская детская художественная школа'
|
||||
},
|
||||
{
|
||||
name: '/events/:page?',
|
||||
template: '<page-events page="{{$.page.page}}" total-pages="{{$.page.totalPages}}" posts="$.page.data"></page-events>',
|
||||
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: '<page-article article="$.data"></page-article>',
|
||||
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: '<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.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: '<page-article article="$.data"></page-article>',
|
||||
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: '<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),
|
||||
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)
|
||||
.then(i => {
|
||||
return sortByPattern(i, documentsSortPattern, i => i.category);
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '/documents/:id',
|
||||
template: '<page-document item="$resolve.document"></page-document>',
|
||||
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: '<page-document item="$resolve.document"></page-document>',
|
||||
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));
|
||||
Reference in new issue
Block a user