From 57141313e9180a605dc4aa1898bc84ca0a5fe416 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Thu, 25 Feb 2016 18:20:16 +0300 Subject: [PATCH] home page -> school page; + PageSchool component --- src/client/app.js | 9 ++--- src/client/components/PageSchool.js | 37 +++++++++++++++++++ src/client/config.js | 3 +- src/client/controllers/HomeController.js | 30 --------------- src/style/components/page-school.scss | 10 +++++ src/style/page.scss | 11 ------ .../home.html => components/page-school.html} | 2 +- 7 files changed, 52 insertions(+), 50 deletions(-) create mode 100644 src/client/components/PageSchool.js delete mode 100644 src/client/controllers/HomeController.js create mode 100644 src/style/components/page-school.scss rename src/templates/{views/home.html => components/page-school.html} (94%) diff --git a/src/client/app.js b/src/client/app.js index 7ee2ed19..5297c74c 100644 --- a/src/client/app.js +++ b/src/client/app.js @@ -16,8 +16,9 @@ import ScheduleSlide from './components/ScheduleSlide'; import ScheduleRecord from './components/ScheduleRecord'; import FooterLinks from './components/FooterLinks'; +import PageSchool from './components/PageSchool'; + import AppController from './controllers/AppController'; -import HomeController from './controllers/HomeController'; import ScheduleController from './controllers/ScheduleController'; import CollectiveController from './controllers/CollectiveController'; import GalleryController from './controllers/GalleryController'; @@ -89,8 +90,8 @@ app.run(($location, $rootScope, $http) => { GalleryItem, AlbumCollection, TeacherProfile, + PageSchool, AppController, - HomeController, ScheduleController, CollectiveController, GalleryController, @@ -105,10 +106,6 @@ app.run(($location, $rootScope, $http) => { ScheduleRecord, FooterLinks, function (app) { - app.controller('HomePageController', ($scope) => { - $scope.pageClass = 'page-home'; - }); - app.controller('SchedulePageController', ($scope) => { $scope.pageClass = 'page-schedule'; }); diff --git a/src/client/components/PageSchool.js b/src/client/components/PageSchool.js new file mode 100644 index 00000000..f8b2baad --- /dev/null +++ b/src/client/components/PageSchool.js @@ -0,0 +1,37 @@ +import template from '../../templates/components/page-school.html'; + +export default function (app) { + app.component('pageSchool', { + template: template, + controller: () => { + this.pageClass = 'page-school'; + + let fotorama; + let $tape = $('.tape-block'); + let $fotorama = $tape.find('.tape-block__content'); + + $tape.addClass('simplified'); + $fotorama.on('fotorama:ready', () => { + $tape.removeClass('simplified'); + fotorama.setOptions({ + nav: 'dots', + transition: 'crossfade', + autoplay: '6000', + arrows: 'false', + width: '100%', + fit: 'cover', + loop: 'true' + }); + }); + + fotorama = $fotorama.fotorama().data('fotorama'); + setTimeout(() => { + fotorama.load([ + {img: 'https://static.shburg.org/art/img/cat1.jpg'}, + {img: 'https://static.shburg.org/art/img/cat2.jpg'}, + {img: 'https://static.shburg.org/art/img/cat3.jpg'} + ]); + }, 100); + } + }); +}; \ No newline at end of file diff --git a/src/client/config.js b/src/client/config.js index 73463d7a..4c605835 100644 --- a/src/client/config.js +++ b/src/client/config.js @@ -22,8 +22,7 @@ export let collectiveSortPattern = [ export let routes = [ { name: '/', - templateUrl: '/views/home.html', - controller: 'HomePageController', + template: '', title: 'ДХШ Шлиссельбурга' }, { diff --git a/src/client/controllers/HomeController.js b/src/client/controllers/HomeController.js deleted file mode 100644 index cf721e5e..00000000 --- a/src/client/controllers/HomeController.js +++ /dev/null @@ -1,30 +0,0 @@ -export default function (app) { - app.controller('HomeController', () => { - let fotorama; - let $tape = $('.tape-block'); - let $fotorama = $tape.find('.tape-block__content'); - - $tape.addClass('simplified'); - $fotorama.on('fotorama:ready', () => { - $tape.removeClass('simplified'); - fotorama.setOptions({ - nav: 'dots', - transition: 'crossfade', - autoplay: '6000', - arrows: 'false', - width: '100%', - fit: 'cover', - loop: 'true' - }); - }); - - fotorama = $fotorama.fotorama().data('fotorama'); - setTimeout(() => { - fotorama.load([ - {img: 'https://static.shburg.org/art/img/cat1.jpg'}, - {img: 'https://static.shburg.org/art/img/cat2.jpg'}, - {img: 'https://static.shburg.org/art/img/cat3.jpg'} - ]); - }, 100); - }); -}; diff --git a/src/style/components/page-school.scss b/src/style/components/page-school.scss new file mode 100644 index 00000000..0db09981 --- /dev/null +++ b/src/style/components/page-school.scss @@ -0,0 +1,10 @@ +.page-school { + &.ng-leave { + transform-origin: 0% 0%; + animation: rotateFall .3s both ease-in; + } + + &.ng-enter { + animation: scaleUp 0.3s both ease-in; + } +} \ No newline at end of file diff --git a/src/style/page.scss b/src/style/page.scss index fea3d756..c071a8c0 100644 --- a/src/style/page.scss +++ b/src/style/page.scss @@ -5,17 +5,6 @@ &.ng-enter {} } -.page-home { - &.ng-leave { - transform-origin: 0% 0%; - animation: rotateFall .3s both ease-in; - } - - &.ng-enter { - animation: scaleUp 0.3s both ease-in; - } -} - .page-schedule { &.ng-leave { transform-origin: 0% 0%; diff --git a/src/templates/views/home.html b/src/templates/components/page-school.html similarity index 94% rename from src/templates/views/home.html rename to src/templates/components/page-school.html index 4fb51d5d..a9ad0962 100644 --- a/src/templates/views/home.html +++ b/src/templates/components/page-school.html @@ -1,4 +1,4 @@ -
+