+ PageGallery component
This commit is contained in:
1 parent
c51bdfbd10
commit
60b66123ef
6 files changed
+36
-35
No files matched your search
+2
-6
@@ -19,9 +19,9 @@ import FooterLinks from './components/FooterLinks';
|
|||||||
import PageSchool from './components/PageSchool';
|
import PageSchool from './components/PageSchool';
|
||||||
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 AppController from './controllers/AppController';
|
import AppController from './controllers/AppController';
|
||||||
import GalleryController from './controllers/GalleryController';
|
|
||||||
import AlbumController from './controllers/AlbumController';
|
import AlbumController from './controllers/AlbumController';
|
||||||
import DocumentsController from './controllers/DocumentsController';
|
import DocumentsController from './controllers/DocumentsController';
|
||||||
import CopyrightController from './controllers/CopyrightController';
|
import CopyrightController from './controllers/CopyrightController';
|
||||||
@@ -93,8 +93,8 @@ app.run(($location, $rootScope, $http) => {
|
|||||||
PageSchool,
|
PageSchool,
|
||||||
PageSchedule,
|
PageSchedule,
|
||||||
PageCollective,
|
PageCollective,
|
||||||
|
PageGallery,
|
||||||
AppController,
|
AppController,
|
||||||
GalleryController,
|
|
||||||
AlbumController,
|
AlbumController,
|
||||||
DocumentsController,
|
DocumentsController,
|
||||||
CopyrightController,
|
CopyrightController,
|
||||||
@@ -106,10 +106,6 @@ app.run(($location, $rootScope, $http) => {
|
|||||||
ScheduleRecord,
|
ScheduleRecord,
|
||||||
FooterLinks,
|
FooterLinks,
|
||||||
function (app) {
|
function (app) {
|
||||||
app.controller('GalleryPageController', ($scope) => {
|
|
||||||
$scope.pageClass = 'page-gallery';
|
|
||||||
});
|
|
||||||
|
|
||||||
app.controller('AlbumPageController', ($scope) => {
|
app.controller('AlbumPageController', ($scope) => {
|
||||||
$scope.pageClass = 'page-album';
|
$scope.pageClass = 'page-album';
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import template from '../../templates/components/page-gallery.html';
|
||||||
|
|
||||||
|
export default function (app) {
|
||||||
|
app.component('pageCollective', {
|
||||||
|
template: template,
|
||||||
|
controller: function (api) {
|
||||||
|
this.pageClass = 'page-gallery';
|
||||||
|
|
||||||
|
this.years = [];
|
||||||
|
[2015, 2014, 2013, 2012, 2011, 2010]
|
||||||
|
.forEach((year, year_index) => {
|
||||||
|
api.gallery.year(year)
|
||||||
|
.success(albums => {
|
||||||
|
if (albums.length) {
|
||||||
|
this.years[year_index] = {
|
||||||
|
year: year,
|
||||||
|
albums: albums.map(album => {
|
||||||
|
let preview = album.content[0];
|
||||||
|
album.preview_url = preview.content.medium.url;
|
||||||
|
return album;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -37,8 +37,7 @@ export let routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '/gallery',
|
name: '/gallery',
|
||||||
templateUrl: '/views/gallery.html',
|
template: '<page-gallery></page-gallery>',
|
||||||
controller: 'GalleryPageController',
|
|
||||||
title: 'Работы учащихся'
|
title: 'Работы учащихся'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
export default function (app) {
|
|
||||||
app.controller("GalleryController", ($scope, api) => {
|
|
||||||
$scope.years = [];
|
|
||||||
|
|
||||||
let years = [2015, 2014, 2013, 2012, 2011, 2010];
|
|
||||||
years.forEach((year, year_index) => {
|
|
||||||
api.gallery.year(year)
|
|
||||||
.success(albums => {
|
|
||||||
if (albums.length) {
|
|
||||||
$scope.years[year_index] = {
|
|
||||||
year: year,
|
|
||||||
albums: albums.map(album => {
|
|
||||||
let preview = album.content[0];
|
|
||||||
album.preview_url = preview.content.medium.url;
|
|
||||||
return album;
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div class="content content_wide">
|
||||||
|
<album-collection ng-repeat="i in $ctrl.years"
|
||||||
|
title="{{i.year}}" albums="i.albums"
|
||||||
|
></album-collection>
|
||||||
|
</div>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<div class="content content_wide" ng-controller="GalleryController">
|
|
||||||
<album-collection ng-repeat="i in years"
|
|
||||||
title="{{i.year}}" albums="i.albums"
|
|
||||||
></album-collection>
|
|
||||||
</div>
|
|
||||||
Reference in new issue
Block a user