+ Events Page
This commit is contained in:
1 parent
026a38dab1
commit
109dbbe44f
18 files changed
+166
-5
No files matched your search
@@ -3,6 +3,7 @@ import APIGallery from './APIGallery';
|
|||||||
import APIDocument from './APIDocument';
|
import APIDocument from './APIDocument';
|
||||||
import APICollective from './APICollective';
|
import APICollective from './APICollective';
|
||||||
import APISchedule from './APISchedule';
|
import APISchedule from './APISchedule';
|
||||||
|
import APIEvent from './APIEvent';
|
||||||
|
|
||||||
export default class API {
|
export default class API {
|
||||||
constructor(request) {
|
constructor(request) {
|
||||||
@@ -11,5 +12,6 @@ export default class API {
|
|||||||
this.document = new APIDocument(request);
|
this.document = new APIDocument(request);
|
||||||
this.collective = new APICollective(request);
|
this.collective = new APICollective(request);
|
||||||
this.schedule = new APISchedule(request);
|
this.schedule = new APISchedule(request);
|
||||||
|
this.event = new APIEvent(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,11 @@ import ScheduleSlider from './components/ScheduleSlider';
|
|||||||
import ScheduleSlide from './components/ScheduleSlide';
|
import ScheduleSlide from './components/ScheduleSlide';
|
||||||
import ScheduleRecord from './components/ScheduleRecord';
|
import ScheduleRecord from './components/ScheduleRecord';
|
||||||
import FooterLinks from './components/FooterLinks';
|
import FooterLinks from './components/FooterLinks';
|
||||||
|
import EventPost from './components/EventPost';
|
||||||
|
|
||||||
import PageSchool from './components/PageSchool';
|
import PageSchool from './components/PageSchool';
|
||||||
|
import PageEvents from './components/PageEvents';
|
||||||
|
import PageEvent from './components/PageEvent';
|
||||||
import PageSchedule from './components/PageSchedule';
|
import PageSchedule from './components/PageSchedule';
|
||||||
import PageCollective from './components/PageCollective';
|
import PageCollective from './components/PageCollective';
|
||||||
import PageGallery from './components/PageGallery';
|
import PageGallery from './components/PageGallery';
|
||||||
@@ -92,12 +95,15 @@ app.run(($location, $rootScope, $http) => {
|
|||||||
TimelineRecord,
|
TimelineRecord,
|
||||||
TimelineRecordPost,
|
TimelineRecordPost,
|
||||||
TimelineRecordInstagram,
|
TimelineRecordInstagram,
|
||||||
|
EventPost,
|
||||||
Document,
|
Document,
|
||||||
Award,
|
Award,
|
||||||
GalleryItem,
|
GalleryItem,
|
||||||
AlbumCollection,
|
AlbumCollection,
|
||||||
TeacherProfile,
|
TeacherProfile,
|
||||||
PageSchool,
|
PageSchool,
|
||||||
|
PageEvent,
|
||||||
|
PageEvents,
|
||||||
PageSchedule,
|
PageSchedule,
|
||||||
PageCollective,
|
PageCollective,
|
||||||
PageGallery,
|
PageGallery,
|
||||||
|
|||||||
@@ -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}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -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];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -25,6 +25,15 @@ export let routes = [
|
|||||||
template: '<page-school></page-school>',
|
template: '<page-school></page-school>',
|
||||||
title: 'ДХШ Шлиссельбурга'
|
title: 'ДХШ Шлиссельбурга'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '/events/:page?/:pageNumber?',
|
||||||
|
template: '<page-events></page-events>',
|
||||||
|
title: 'События Школы'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '/event/:event',
|
||||||
|
template: '<page-event></page-event>'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '/schedule/:period?/:semester?',
|
name: '/schedule/:period?/:semester?',
|
||||||
template: '<page-schedule></page-schedule>',
|
template: '<page-schedule></page-schedule>',
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import menuItems from '../../models/menu';
|
import menuItems from '../../models/menu';
|
||||||
|
|
||||||
class Menu {
|
class Menu {
|
||||||
constructor() {
|
constructor(items) {
|
||||||
this.items = menuItems;
|
this.items = items;
|
||||||
this.current = null;
|
this.current = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,8 +16,9 @@ class Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function (app) {
|
export default function (app) {
|
||||||
app.factory('menu', ($route, $rootScope) => {
|
app.factory('menu', ($rootScope) => {
|
||||||
const menu = new Menu();
|
const menu = new Menu(menuItems);
|
||||||
|
|
||||||
$rootScope.$on('$routeChangeSuccess', (event, current) => {
|
$rootScope.$on('$routeChangeSuccess', (event, current) => {
|
||||||
try {
|
try {
|
||||||
let path = current['$$route'].originalPath;
|
let path = current['$$route'].originalPath;
|
||||||
|
|||||||
+3
-1
@@ -5,7 +5,9 @@ export default [
|
|||||||
"color": "blue"
|
"color": "blue"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "События"
|
"text": "События",
|
||||||
|
"url": "/events",
|
||||||
|
"color": "orange"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Расписание",
|
"text": "Расписание",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import route from 'koa-route';
|
||||||
|
import {c} from '../core/db';
|
||||||
|
import {json} from './';
|
||||||
|
|
||||||
|
export default function (app) {
|
||||||
|
app.use(route.get('/events', json(
|
||||||
|
function *() {
|
||||||
|
let query = {};
|
||||||
|
this.body = yield c('events')
|
||||||
|
.find(query)
|
||||||
|
.toArray();
|
||||||
|
}
|
||||||
|
)));
|
||||||
|
|
||||||
|
app.use(route.get('/event/:event', json(
|
||||||
|
function *(event) {
|
||||||
|
this.body = yield c('events').findOne({id: event});
|
||||||
|
}
|
||||||
|
)));
|
||||||
|
};
|
||||||
@@ -23,6 +23,7 @@ import instagramIO from './instagram/io';
|
|||||||
import error404 from './routes/404';
|
import error404 from './routes/404';
|
||||||
import documents from './routes/documents';
|
import documents from './routes/documents';
|
||||||
import collective from './routes/collective';
|
import collective from './routes/collective';
|
||||||
|
import events from './routes/events';
|
||||||
|
|
||||||
export const app = koa();
|
export const app = koa();
|
||||||
app.proxy = true;
|
app.proxy = true;
|
||||||
@@ -56,5 +57,6 @@ gallery(app);
|
|||||||
instagram(app);
|
instagram(app);
|
||||||
instagramIO(app);
|
instagramIO(app);
|
||||||
documents(app);
|
documents(app);
|
||||||
|
events(app);
|
||||||
app.use(collective());
|
app.use(collective());
|
||||||
app.use(error404());
|
app.use(error404());
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
@import "../variables";
|
||||||
|
|
||||||
|
.event-post {
|
||||||
|
margin-bottom: $double-margin;
|
||||||
|
|
||||||
|
&__head {
|
||||||
|
margin-bottom: $small-margin;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.75em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date {
|
||||||
|
text-align: center;
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $dark-color;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__body{
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto $small-margin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,6 +52,10 @@
|
|||||||
border-top: $menu-colored-mark-thickness solid $blue-color;
|
border-top: $menu-colored-mark-thickness solid $blue-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.orange {
|
||||||
|
border-top: $menu-colored-mark-thickness solid $orange-color;
|
||||||
|
}
|
||||||
|
|
||||||
&.green {
|
&.green {
|
||||||
border-top: $menu-colored-mark-thickness solid $green-color;
|
border-top: $menu-colored-mark-thickness solid $green-color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
@import "components/timeline-record-instagram";
|
@import "components/timeline-record-instagram";
|
||||||
@import "components/schedule-table";
|
@import "components/schedule-table";
|
||||||
@import "components/footer-links";
|
@import "components/footer-links";
|
||||||
|
@import "components/event-post";
|
||||||
|
|
||||||
@import "components/page-school";
|
@import "components/page-school";
|
||||||
@import "components/page-schedule";
|
@import "components/page-schedule";
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ $light-color: hsl(0, 0%, 80%);
|
|||||||
$lighter-color: hsl(0, 0%, 100%);
|
$lighter-color: hsl(0, 0%, 100%);
|
||||||
|
|
||||||
$blue-color: rgb(63, 156, 234);
|
$blue-color: rgb(63, 156, 234);
|
||||||
|
$orange-color: rgb(240, 160, 65);
|
||||||
$green-color: rgb(92, 190, 64);
|
$green-color: rgb(92, 190, 64);
|
||||||
$yellow-color: rgb(255, 238, 0);
|
$yellow-color: rgb(255, 238, 0);
|
||||||
$pink-color: rgb(246, 85, 160);
|
$pink-color: rgb(246, 85, 160);
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<div class="event-post">
|
||||||
|
<div class="event-post__head">
|
||||||
|
<a href="{{$.url}}"><h3>{{$.post.title}}</h3></a>
|
||||||
|
<p class="date">{{$.post.date | date : "dd.MM.yyyy"}}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="event-post__body" ng-bind-html="$.message"></div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="content content_thin content--padding-top--double">
|
||||||
|
<event-post ng-repeat="i in $.posts" post="i"></event-post>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="content content_thin content--padding-top--double">
|
||||||
|
<event-post ng-repeat="i in $.posts" post="i"></event-post>
|
||||||
|
</div>
|
||||||
Reference in new issue
Block a user