From f27cc4003f2b9b6b55612f2cc823c95d9a83f97c Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sun, 19 Feb 2017 23:29:46 +0300 Subject: [PATCH] Awards as separate menu item --- src/client/app.js | 16 ++++++++++++---- src/client/components/PageAwards.js | 11 +++++++++++ src/client/components/PageDocuments.js | 1 - src/models/menu.js | 5 +++++ src/routes/documents.js | 2 +- src/templates/components/page-awards.html | 6 ++++++ src/templates/components/page-documents.html | 5 ----- 7 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 src/client/components/PageAwards.js create mode 100644 src/templates/components/page-awards.html diff --git a/src/client/app.js b/src/client/app.js index 9d1f82be..f66098d4 100644 --- a/src/client/app.js +++ b/src/client/app.js @@ -32,6 +32,7 @@ import PageTeacher from './components/PageTeacher' import PageGallery from './components/PageGallery' import PageAlbum from './components/PageAlbum' import PageDocuments from './components/PageDocuments' +import PageAwards from './components/PageAwards' import PageDocument from './components/PageDocument' import AppController from './controllers/AppController' @@ -180,14 +181,20 @@ app.config(($locationProvider, $routeProvider) => { } }, { - name: '/documents', - template: '', - title: 'Документы', + name: '/awards', + template: '', + title: 'Награды', resolve: { awards: api => api.document .awards() .then(i => i.data), - + } + }, + { + name: '/documents', + template: '', + title: 'Документы', + resolve: { documents: api => api.document .documents() .then(i => i.data) @@ -295,6 +302,7 @@ app.run(($location, $rootScope, $http) => { PageGallery, PageAlbum, PageDocuments, + PageAwards, PageDocument, AppController, CopyrightController, diff --git a/src/client/components/PageAwards.js b/src/client/components/PageAwards.js new file mode 100644 index 00000000..957b43a5 --- /dev/null +++ b/src/client/components/PageAwards.js @@ -0,0 +1,11 @@ +import template from '../../templates/components/page-awards.html' + +export default function (app) { + app.component('pageAwards', { + bindings: { + items: '<', + }, + template: template, + controllerAs: '$', + }) +} diff --git a/src/client/components/PageDocuments.js b/src/client/components/PageDocuments.js index d38c9898..942ff932 100644 --- a/src/client/components/PageDocuments.js +++ b/src/client/components/PageDocuments.js @@ -4,7 +4,6 @@ import {unique} from '../../utils/common'; export default function (app) { app.component('pageDocuments', { bindings: { - awards: '<', documents: '<' }, template: template, diff --git a/src/models/menu.js b/src/models/menu.js index c0426d09..42407d5a 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -29,6 +29,11 @@ export default [ "url": "/gallery", "color": "red" }, + { + "text": "Награды", + "url": "/awards", + "color": "yellow" + }, { "text": "Документы", "url": "/documents", diff --git a/src/routes/documents.js b/src/routes/documents.js index 82a62bb6..a5d390b2 100644 --- a/src/routes/documents.js +++ b/src/routes/documents.js @@ -54,7 +54,7 @@ function type() { return route.get('/documents/type/:type', async(ctx, type) => { let types = { 'document': ['documents', {type: 'document'}, populateDocPreview], - 'award': ['documents', {type: 'award'}, populateDocPreview] + 'award': ['awards', {type: 'award'}, populateDocPreview] } if (type in types) { diff --git a/src/templates/components/page-awards.html b/src/templates/components/page-awards.html new file mode 100644 index 00000000..298dd599 --- /dev/null +++ b/src/templates/components/page-awards.html @@ -0,0 +1,6 @@ +
+

Награды

+
+ +
+
diff --git a/src/templates/components/page-documents.html b/src/templates/components/page-documents.html index 3a97e888..22837815 100644 --- a/src/templates/components/page-documents.html +++ b/src/templates/components/page-documents.html @@ -6,9 +6,4 @@ - -

Награды

-
- -