From 38127b2cc7a4aaa3a95a0d511872dd0efef7e574 Mon Sep 17 00:00:00 2001 From: Kenneth Lynne Date: Sat, 15 Mar 2014 21:23:51 +0100 Subject: [PATCH] start work on #77 and #41 --- .../modal/_video-list-item-modal.scss | 69 ------------------ .../modal/video-list-item-modal.html | 15 ---- .../modal/video-list-item-modal.js | 36 --------- app/index.html | 4 +- .../admin/videos/index/videos-controller.js | 2 +- app/pages/index/index/index.js | 2 - app/pages/video/index/_video-page.scss | 73 +++++++++++++++++++ app/pages/video/index/modal.html | 17 +++++ app/pages/video/index/video-controller.js | 21 ++++++ app/styles/_components.scss | 2 - app/styles/_pages.scss | 3 +- .../pages/video/index/video-controller.js | 23 ++++++ 12 files changed, 140 insertions(+), 127 deletions(-) delete mode 100644 app/components/video-list-item/modal/_video-list-item-modal.scss delete mode 100644 app/components/video-list-item/modal/video-list-item-modal.html delete mode 100644 app/components/video-list-item/modal/video-list-item-modal.js create mode 100644 app/pages/video/index/_video-page.scss create mode 100644 app/pages/video/index/modal.html create mode 100644 app/pages/video/index/video-controller.js create mode 100644 test/unit/spec/pages/video/index/video-controller.js diff --git a/app/components/video-list-item/modal/_video-list-item-modal.scss b/app/components/video-list-item/modal/_video-list-item-modal.scss deleted file mode 100644 index d735745..0000000 --- a/app/components/video-list-item/modal/_video-list-item-modal.scss +++ /dev/null @@ -1,69 +0,0 @@ -.modal { - .modal-dialog { - @include clearfix; - - position: static; - top: 0; - width: 100%; - margin: 0; - margin-top: 70px; - - .modal-body { - margin: 0 auto; - } - - .close { - position: absolute; - top: -50px; - right: 10px; - font-size: 40px; - background: none; - box-shadow: none; - border: none; - color: #fff; - } - - .modal-video { - // @include span-columns(6 of 10); - - // @include media($tablet) { - @include span-columns(20 of 20); - // } - } - - .modal-video-info { - // @include span-columns(4 of 10); - color: #fff; - padding: $content-gutter 0; - - // @include media($tablet) { - @include span-columns(20 of 20); - // } - - h2 { - margin-top: 0; - } - } - - button.favorite { - float: left; - vertical-align: top; - margin-right: 10px; - margin-top: -5px; - background: none; - border: none; - box-shadow: none; - color: #fff; - font-size: 30px; - padding: 0; - - i.fa-star { - color: $primary-color; - } - } - } -} - -.modal-backdrop { - opacity: 0.8 !important; -} \ No newline at end of file diff --git a/app/components/video-list-item/modal/video-list-item-modal.html b/app/components/video-list-item/modal/video-list-item-modal.html deleted file mode 100644 index a9c21e1..0000000 --- a/app/components/video-list-item/modal/video-list-item-modal.html +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/app/components/video-list-item/modal/video-list-item-modal.js b/app/components/video-list-item/modal/video-list-item-modal.js deleted file mode 100644 index 1a4f68b..0000000 --- a/app/components/video-list-item/modal/video-list-item-modal.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -//TODO: Add water and unit tests! -angular.module('ndc') - .config(function ($stateProvider) { - $stateProvider.state("videoDetails", - { - url: "/videos/{id}", - onEnter: ['$stateParams', '$state', '$modal', 'VideoRepository', '$window', function ($stateParams, $state, $modal, VideoRepository, $window) { - $modal - .open({ - backdrop: 'static', - templateUrl: 'components/video-list-item/modal/video-list-item-modal.html', - controller: 'videoListItemModalCtrl', - resolve: { - video: function () { - return VideoRepository.getById($stateParams.id); - } - } - }) - .result.then(function (result) { - $window.history.back(); - }); - }], - onExit: function () { - //TODO: Store progress information - } - } - ); - }) - .controller('videoListItemModalCtrl', function ($scope, $modalInstance, video) { - $scope.video = video; - $scope.closeModal = function(){ - $modalInstance.close(/*TODO: Pass the progression of the video*/); - }; - }); \ No newline at end of file diff --git a/app/index.html b/app/index.html index 70eccb4..6e6d902 100644 --- a/app/index.html +++ b/app/index.html @@ -59,6 +59,8 @@

Javascript is deactivated. You must +
+
@@ -113,7 +115,6 @@

Javascript is deactivated. You must - @@ -124,6 +125,7 @@

Javascript is deactivated. You must + diff --git a/app/pages/admin/videos/index/videos-controller.js b/app/pages/admin/videos/index/videos-controller.js index 471d791..5da97ed 100644 --- a/app/pages/admin/videos/index/videos-controller.js +++ b/app/pages/admin/videos/index/videos-controller.js @@ -8,7 +8,7 @@ angular.module('ndc') parent: 'admin' })); }) - .controller('AdminVideosCtrl', function ($scope, VideoRepository, vimeoAPI, $modal) { + .controller('AdminVideosCtrl', function ($scope, VideoRepository, vimeoAPI) { $scope.existingVideos = []; diff --git a/app/pages/index/index/index.js b/app/pages/index/index/index.js index 5f861e0..7c138da 100644 --- a/app/pages/index/index/index.js +++ b/app/pages/index/index/index.js @@ -9,8 +9,6 @@ angular.module('ndc') }) .controller('IndexCtrl', function ($scope, CurrentUser, TagRepository, VideoRepository, $stateParams, $location, _, TagModel) { - - $scope.tags = []; //This variable holds selected tags $scope.User = CurrentUser; diff --git a/app/pages/video/index/_video-page.scss b/app/pages/video/index/_video-page.scss new file mode 100644 index 0000000..78eba2d --- /dev/null +++ b/app/pages/video/index/_video-page.scss @@ -0,0 +1,73 @@ +.video-page { + +} + +.modal { + .modal-dialog { + @include clearfix; + + position: static; + top: 0; + width: 100%; + margin: 0; + margin-top: 70px; + + .modal-body { + margin: 0 auto; + } + + .close { + position: absolute; + top: -50px; + right: 10px; + font-size: 40px; + background: none; + box-shadow: none; + border: none; + color: #fff; + } + + .modal-video { + // @include span-columns(6 of 10); + + // @include media($tablet) { + @include span-columns(20 of 20); + // } + } + + .modal-video-info { + // @include span-columns(4 of 10); + color: #fff; + padding: $content-gutter 0; + + // @include media($tablet) { + @include span-columns(20 of 20); + // } + + h2 { + margin-top: 0; + } + } + + button.favorite { + float: left; + vertical-align: top; + margin-right: 10px; + margin-top: -5px; + background: none; + border: none; + box-shadow: none; + color: #fff; + font-size: 30px; + padding: 0; + + i.fa-star { + color: $primary-color; + } + } + } +} + +.modal-backdrop { + opacity: 0.8 !important; +} \ No newline at end of file diff --git a/app/pages/video/index/modal.html b/app/pages/video/index/modal.html new file mode 100644 index 0000000..0a37bfb --- /dev/null +++ b/app/pages/video/index/modal.html @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/app/pages/video/index/video-controller.js b/app/pages/video/index/video-controller.js new file mode 100644 index 0000000..1bd15d0 --- /dev/null +++ b/app/pages/video/index/video-controller.js @@ -0,0 +1,21 @@ +'use strict'; + +angular.module('ndc') + .config(function ($stateProvider, stateFactory) { + $stateProvider.state('videoDetails', stateFactory('Video', { + url: '/video/{id}', + views: { + 'modal@': { + templateUrl: 'pages/video/index/modal.html', + controller: 'VideoCtrl' + } + } + })); + }) + .controller('VideoCtrl', function ($scope, $stateParams, VideoRepository) { + + VideoRepository.getById($stateParams.id).then(function (video) { + $scope.video = video; + }); + + }); diff --git a/app/styles/_components.scss b/app/styles/_components.scss index a6bb3d7..600cf40 100644 --- a/app/styles/_components.scss +++ b/app/styles/_components.scss @@ -1,9 +1,7 @@ // TODO: Shoudn't need to include config and neat-helpers here - inheritance bug? @import 'config'; @import 'neat/app/assets/stylesheets/neat-helpers'; - @import '../components/navbar/navbar'; @import '../components/media-player/media-player'; @import '../components/video-list-item/video-list-item'; -@import '../components/video-list-item/modal/video-list-item-modal'; @import '../components/navbar-mini-player/navbar-mini-player'; diff --git a/app/styles/_pages.scss b/app/styles/_pages.scss index a644f1b..960c348 100644 --- a/app/styles/_pages.scss +++ b/app/styles/_pages.scss @@ -7,4 +7,5 @@ @import '../pages/admin/users/index/users-page'; @import '../pages/admin/videos/index/videos-page'; @import '../pages/admin/videos/import/index/import-page'; -@import '../pages/admin/videos/import/index/import-page'; \ No newline at end of file +@import '../pages/admin/videos/import/index/import-page'; +@import '../pages/video/index/video-page'; \ No newline at end of file diff --git a/test/unit/spec/pages/video/index/video-controller.js b/test/unit/spec/pages/video/index/video-controller.js new file mode 100644 index 0000000..4d9f621 --- /dev/null +++ b/test/unit/spec/pages/video/index/video-controller.js @@ -0,0 +1,23 @@ +'use strict'; + +describe('Controller(/video): VideoCtrl', function () { + + var VideoCtrl, scope; + + beforeEach(function () { + + module('ndc'); + + inject(function ($controller, $rootScope) { + scope = $rootScope.$new(); + VideoCtrl = $controller('VideoCtrl', { + $scope: scope, + init: 'video' + }); + }); + }); + + it('should attach init data to scope', function () { + expect(scope.video).toEqual('video'); + }); +});