+ Events Page

This commit is contained in:
tmshv committed 2016-02-27 23:30:43 +03:00
1 parent 026a38dab1
commit 109dbbe44f
18 files changed
+166 -5

No files matched your search

+2
View File
@@ -3,6 +3,7 @@ import APIGallery from './APIGallery';
import APIDocument from './APIDocument';
import APICollective from './APICollective';
import APISchedule from './APISchedule';
import APIEvent from './APIEvent';
export default class API {
constructor(request) {
@@ -11,5 +12,6 @@ export default class API {
this.document = new APIDocument(request);
this.collective = new APICollective(request);
this.schedule = new APISchedule(request);
this.event = new APIEvent(request);
}
}
+13
View File
@@ -0,0 +1,13 @@
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});
}
post(id) {
let url = `/event/${id}`;
return this.request.get(url, {cache: true});
}
}
+6
View File
@@ -18,8 +18,11 @@ import ScheduleSlider from './components/ScheduleSlider';
import ScheduleSlide from './components/ScheduleSlide';
import ScheduleRecord from './components/ScheduleRecord';
import FooterLinks from './components/FooterLinks';
import EventPost from './components/EventPost';
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 PageGallery from './components/PageGallery';
@@ -92,12 +95,15 @@ app.run(($location, $rootScope, $http) => {
TimelineRecord,
TimelineRecordPost,
TimelineRecordInstagram,
EventPost,
Document,
Award,
GalleryItem,
AlbumCollection,
TeacherProfile,
PageSchool,
PageEvent,
PageEvents,
PageSchedule,
PageCollective,
PageGallery,
+15
View File
@@ -0,0 +1,15 @@
import template from '../../templates/components/event-post.html';
export default function (app) {
app.component('eventPost', {
bindings: {
post: '<'
},
template: template,
controllerAs: '$',
controller: function ($sce) {
this.message = $sce.trustAsHtml(this.post.post);
this.url = `/event/${this.post.id}`;
}
});
};
+21
View File
@@ -0,0 +1,21 @@
import template from '../../templates/components/page-event.html';
export default function (app) {
app.component('pageEvent', {
template: template,
controllerAs: '$',
controller: function ($rootScope, $routeParams, api, menu) {
this.pageClass = 'page-event';
menu.activate('/events');
let id = $routeParams.event;
if(!id) return;
api.event.post(id)
.success(post => {
$rootScope.title = post.title;
this.posts = [post];
});
}
});
};
+17
View File
@@ -0,0 +1,17 @@
import template from '../../templates/components/page-events.html';
export default function (app) {
app.component('pageEvents', {
template: template,
controllerAs: '$',
controller: function (api, menu) {
this.pageClass = 'page-events';
menu.activate('/events');
api.event.list()
.success(posts => {
this.posts = posts;
});
}
});
};
+9
View File
@@ -25,6 +25,15 @@ export let routes = [
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>',
+5 -4
View File
@@ -1,8 +1,8 @@
import menuItems from '../../models/menu';
class Menu {
constructor() {
this.items = menuItems;
constructor(items) {
this.items = items;
this.current = null;
}
@@ -16,8 +16,9 @@ class Menu {
}
export default function (app) {
app.factory('menu', ($route, $rootScope) => {
const menu = new Menu();
app.factory('menu', ($rootScope) => {
const menu = new Menu(menuItems);
$rootScope.$on('$routeChangeSuccess', (event, current) => {
try {
let path = current['$$route'].originalPath;