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