+ document page

This commit is contained in:
tmshv committed 2016-03-18 05:38:27 +03:00
1 parent d3e6eb2659
commit 2dc366c9ba
9 files changed
+78 -10

No files matched your search

+5
View File
@@ -10,4 +10,9 @@ export default class APIDocument extends EndPoint {
let url = '/documents/type/award';
return this.get(url);
}
id(id){
let url = `/documents/${id}`;
return this.get(url);
}
}
+15
View File
@@ -31,6 +31,7 @@ import PageTeacher from './components/PageTeacher';
import PageGallery from './components/PageGallery';
import PageAlbum from './components/PageAlbum';
import PageDocuments from './components/PageDocuments';
import PageDocument from './components/PageDocument';
import AppController from './controllers/AppController';
import CopyrightController from './controllers/CopyrightController';
@@ -177,6 +178,19 @@ app.config(($locationProvider, $routeProvider) => {
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 => {
@@ -246,6 +260,7 @@ app.run(($location, $rootScope, $http) => {
PageGallery,
PageAlbum,
PageDocuments,
PageDocument,
AppController,
CopyrightController,
ContactsController,
+6 -2
View File
@@ -3,11 +3,15 @@ import template from '../../templates/components/document.html';
export default function (app) {
app.component('document', {
bindings: {
document: '<'
document: '<',
preview: '@'
},
controllerAs: '$',
controller: function () {
this.previewUrl = this.document.preview.data.medium.url;
const size = this.preview || 'medium';
this.imageClass = `document__image--${size}`;
this.previewUrl = this.document.preview.data[size].url;
this.file = this.document.file;
},
template: template
+12
View File
@@ -0,0 +1,12 @@
import template from '../../templates/components/page-document.html';
import {unique} from '../../utils/common';
export default function (app) {
app.component('pageDocument', {
bindings: {
item: '<'
},
template: template,
controllerAs: '$'
});
};
-1
View File
@@ -10,7 +10,6 @@ export default function (app) {
template: template,
controllerAs: '$',
controller: function () {
this.pageClass = 'page-documents';
let categories = unique(i => i.category);
this.collections = [];