diff --git a/src/client/app.js b/src/client/app.js index 73cf88a1..dab66fb4 100644 --- a/src/client/app.js +++ b/src/client/app.js @@ -20,9 +20,9 @@ import PageSchool from './components/PageSchool'; import PageSchedule from './components/PageSchedule'; import PageCollective from './components/PageCollective'; import PageGallery from './components/PageGallery'; +import PageGalleryAlbum from './components/PageGalleryAlbum'; import AppController from './controllers/AppController'; -import AlbumController from './controllers/AlbumController'; import DocumentsController from './controllers/DocumentsController'; import CopyrightController from './controllers/CopyrightController'; import ContactsController from './controllers/ContactsController'; @@ -94,8 +94,8 @@ app.run(($location, $rootScope, $http) => { PageSchedule, PageCollective, PageGallery, + PageGalleryAlbum, AppController, - AlbumController, DocumentsController, CopyrightController, ContactsController, @@ -106,10 +106,6 @@ app.run(($location, $rootScope, $http) => { ScheduleRecord, FooterLinks, function (app) { - app.controller('AlbumPageController', ($scope) => { - $scope.pageClass = 'page-album'; - }); - app.controller('DocumentsPageController', ($scope) => { $scope.pageClass = 'page-documents'; }); diff --git a/src/client/components/PageGalleryAlbum.js b/src/client/components/PageGalleryAlbum.js new file mode 100644 index 00000000..320c70cc --- /dev/null +++ b/src/client/components/PageGalleryAlbum.js @@ -0,0 +1,40 @@ +import template from '../../templates/components/page-gallery.html'; + +export default function (app) { + app.component('pageGalleryAlbum', { + template: template, + controller: function ($rootScope, $routeParams, api, menu) { + this.pageClass = 'page-gallery-album'; + + menu.activate('/gallery'); + + let year_uri = $routeParams.year; + let course_uri = $routeParams.course; + let album_uri = $routeParams.album; + + api.gallery.album(year_uri, course_uri, album_uri) + .success(album => { + //album.teacherName = team.name(album['teacher']); + album.teacherName = album['teacher']; + + this.album = album; + this.crumbs = [ + { + url: '/gallery', + name: 'Галерея' + }, + { + name: year_uri + }, + { + name: album.course + }, + { + name: album.title + } + ]; + $rootScope.title = album.title; + }); + } + }); +}; \ No newline at end of file diff --git a/src/client/config.js b/src/client/config.js index ddabb0a1..080a9bbd 100644 --- a/src/client/config.js +++ b/src/client/config.js @@ -42,8 +42,7 @@ export let routes = [ }, { name: '/gallery/:year/:course/:album', - templateUrl: '/views/gallery-album.html', - controller: 'AlbumPageController' + template: '' }, { name: '/documents', diff --git a/src/client/controllers/AlbumController.js b/src/client/controllers/AlbumController.js deleted file mode 100644 index c34c6a5e..00000000 --- a/src/client/controllers/AlbumController.js +++ /dev/null @@ -1,33 +0,0 @@ -export default function (app) { - app.controller('AlbumController', ($scope, $rootScope, $http, $routeParams, api, menu) => { - menu.activate('/gallery'); - - let year_uri = $routeParams.year; - let course_uri = $routeParams.course; - let album_uri = $routeParams.album; - - api.gallery.album(year_uri, course_uri, album_uri) - .success(album => { - //album.teacherName = team.name(album['teacher']); - album.teacherName = album['teacher']; - - $scope.album = album; - $scope.crumbs = [ - { - url: '/gallery', - name: 'Галерея' - }, - { - name: year_uri - }, - { - name: album.course - }, - { - name: album.title - } - ]; - $rootScope.title = album.title; - }); - }); -}; diff --git a/src/templates/views/gallery-album.html b/src/templates/components/page-gallery-album.html similarity index 52% rename from src/templates/views/gallery-album.html rename to src/templates/components/page-gallery-album.html index e4c5536d..f06e6727 100644 --- a/src/templates/views/gallery-album.html +++ b/src/templates/components/page-gallery-album.html @@ -1,17 +1,17 @@ -
- +
+
-

{{album.title}}

+

{{$ctrl.album.title}}

-
+
-

Предмет: {{album.course}}

-

Преподаватель: {{album.teacherName}}

-

{{album.description}}

+

Предмет: {{$ctrl.album.course}}

+

Преподаватель: {{$ctrl.album.teacherName}}

+

{{$ctrl.album.description}}

-
+