From 41a2aee38cf812510010da09de9bae53590ec119 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 May 2016 16:23:10 +0200 Subject: Follow the angular styleguide for the directories structure --- client/angular/videos/components/list/sort.ts | 3 - .../components/list/video-miniature.component.html | 22 ----- .../components/list/video-miniature.component.scss | 55 ------------ .../components/list/video-miniature.component.ts | 47 ---------- .../components/list/video-sort.component.html | 5 -- .../videos/components/list/video-sort.component.ts | 36 -------- .../components/list/videos-list.component.html | 18 ---- .../components/list/videos-list.component.scss | 37 -------- .../components/list/videos-list.component.ts | 100 --------------------- 9 files changed, 323 deletions(-) delete mode 100644 client/angular/videos/components/list/sort.ts delete mode 100644 client/angular/videos/components/list/video-miniature.component.html delete mode 100644 client/angular/videos/components/list/video-miniature.component.scss delete mode 100644 client/angular/videos/components/list/video-miniature.component.ts delete mode 100644 client/angular/videos/components/list/video-sort.component.html delete mode 100644 client/angular/videos/components/list/video-sort.component.ts delete mode 100644 client/angular/videos/components/list/videos-list.component.html delete mode 100644 client/angular/videos/components/list/videos-list.component.scss delete mode 100644 client/angular/videos/components/list/videos-list.component.ts (limited to 'client/angular/videos/components/list') diff --git a/client/angular/videos/components/list/sort.ts b/client/angular/videos/components/list/sort.ts deleted file mode 100644 index 6e8cc7936..000000000 --- a/client/angular/videos/components/list/sort.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type SortField = "name" | "-name" - | "duration" | "-duration" - | "createdDate" | "-createdDate"; diff --git a/client/angular/videos/components/list/video-miniature.component.html b/client/angular/videos/components/list/video-miniature.component.html deleted file mode 100644 index 244254b5a..000000000 --- a/client/angular/videos/components/list/video-miniature.component.html +++ /dev/null @@ -1,22 +0,0 @@ -
- - video thumbnail - {{ video.duration }} - - - -
- - {{ video.name }} - - - by {{ video.by }} - on {{ video.createdDate | date:'short' }} -
-
diff --git a/client/angular/videos/components/list/video-miniature.component.scss b/client/angular/videos/components/list/video-miniature.component.scss deleted file mode 100644 index 4488abe22..000000000 --- a/client/angular/videos/components/list/video-miniature.component.scss +++ /dev/null @@ -1,55 +0,0 @@ -.video-miniature { - height: 200px; - display: inline-block; - position: relative; - - .video-miniature-thumbnail { - display: block; - position: relative; - - .video-miniature-duration { - position: absolute; - right: 60px; - bottom: 2px; - display: inline-block; - background-color: rgba(0, 0, 0, 0.8); - color: rgba(255, 255, 255, 0.8); - padding: 2px; - font-size: 11px; - } - } - - .video-miniature-remove { - display: inline-block; - position: absolute; - left: 16px; - background-color: rgba(0, 0, 0, 0.8); - color: rgba(255, 255, 255, 0.8); - padding: 2px; - cursor: pointer; - - &:hover { - color: rgba(255, 255, 255, 0.9); - } - } - - .video-miniature-informations { - margin-left: 3px; - - .video-miniature-name { - display: block; - font-weight: bold; - - &:hover { - text-decoration: none; - } - } - - .video-miniature-author, .video-miniature-created-date { - display: block; - margin-left: 1px; - font-size: 11px; - color: rgba(0, 0, 0, 0.5); - } - } -} diff --git a/client/angular/videos/components/list/video-miniature.component.ts b/client/angular/videos/components/list/video-miniature.component.ts deleted file mode 100644 index 383c2c609..000000000 --- a/client/angular/videos/components/list/video-miniature.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; -import { DatePipe } from '@angular/common'; -import { ROUTER_DIRECTIVES } from '@angular/router-deprecated'; - -import { Video } from '../../video'; -import { VideosService } from '../../videos.service'; -import { User } from '../../../users/models/user'; - -@Component({ - selector: 'my-video-miniature', - styleUrls: [ 'app/angular/videos/components/list/video-miniature.component.css' ], - templateUrl: 'app/angular/videos/components/list/video-miniature.component.html', - directives: [ ROUTER_DIRECTIVES ], - pipes: [ DatePipe ] -}) - -export class VideoMiniatureComponent { - @Output() removed = new EventEmitter(); - - @Input() video: Video; - @Input() user: User; - - hovering: boolean = false; - - constructor(private _videosService: VideosService) {} - - onHover() { - this.hovering = true; - } - - onBlur() { - this.hovering = false; - } - - displayRemoveIcon(): boolean { - return this.hovering && this.video.isRemovableBy(this.user); - } - - removeVideo(id: string) { - if (confirm('Do you really want to remove this video?')) { - this._videosService.removeVideo(id).subscribe( - status => this.removed.emit(true), - error => alert(error) - ); - } - } -} diff --git a/client/angular/videos/components/list/video-sort.component.html b/client/angular/videos/components/list/video-sort.component.html deleted file mode 100644 index 3bece0b22..000000000 --- a/client/angular/videos/components/list/video-sort.component.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/client/angular/videos/components/list/video-sort.component.ts b/client/angular/videos/components/list/video-sort.component.ts deleted file mode 100644 index 0373cea38..000000000 --- a/client/angular/videos/components/list/video-sort.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; - -import { SortField } from './sort'; - -@Component({ - selector: 'my-video-sort', - // styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ], - templateUrl: 'app/angular/videos/components/list/video-sort.component.html' -}) - -export class VideoSortComponent { - @Output() sort = new EventEmitter(); - - @Input() currentSort: SortField; - - sortChoices = { - 'name': 'Name - Asc', - '-name': 'Name - Desc', - 'duration': 'Duration - Asc', - '-duration': 'Duration - Desc', - 'createdDate': 'Created Date - Asc', - '-createdDate': 'Created Date - Desc' - }; - - get choiceKeys() { - return Object.keys(this.sortChoices); - } - - getStringChoice(choiceKey: SortField): string { - return this.sortChoices[choiceKey]; - } - - onSortChange() { - this.sort.emit(this.currentSort); - } -} diff --git a/client/angular/videos/components/list/videos-list.component.html b/client/angular/videos/components/list/videos-list.component.html deleted file mode 100644 index edbbaf3ae..000000000 --- a/client/angular/videos/components/list/videos-list.component.html +++ /dev/null @@ -1,18 +0,0 @@ -
-
{{ pagination.total }} videos
- -
- -
- - -
There is no video.
- - - -
- - diff --git a/client/angular/videos/components/list/videos-list.component.scss b/client/angular/videos/components/list/videos-list.component.scss deleted file mode 100644 index 9441d80c3..000000000 --- a/client/angular/videos/components/list/videos-list.component.scss +++ /dev/null @@ -1,37 +0,0 @@ -.videos-info { - - padding-bottom: 20px; - margin-bottom: 20px; - border-bottom: 1px solid #f1f1f1; - height: 40px; - line-height: 40px; - width: 765px; - margin-left: 15px; - - my-video-sort { - padding-right: 0; - } - - .videos-total-results { - font-size: 13px; - padding-left: 0; - } -} - -.videos-miniatures { - min-height: 600px; - - my-videos-miniature { - display: inline-block; - } - - .no-video { - margin-top: 50px; - text-align: center; - } -} - -pagination { - display: block; - text-align: center; -} diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts deleted file mode 100644 index 56230e331..000000000 --- a/client/angular/videos/components/list/videos-list.component.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ROUTER_DIRECTIVES, RouteParams, Router } from '@angular/router-deprecated'; - -import { PAGINATION_DIRECTIVES } from 'ng2-bootstrap/components/pagination'; - -import { AuthService } from '../../../users/services/auth.service'; -import { Pagination } from '../../pagination'; -import { User } from '../../../users/models/user'; -import { VideosService } from '../../videos.service'; -import { Video } from '../../video'; -import { VideoMiniatureComponent } from './video-miniature.component'; -import { Search, SearchField } from '../../../app/search'; -import { VideoSortComponent } from './video-sort.component'; -import { SortField } from './sort'; -import { LoaderComponent } from '../../loader.component'; - -@Component({ - selector: 'my-videos-list', - styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ], - templateUrl: 'app/angular/videos/components/list/videos-list.component.html', - directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ] -}) - -export class VideosListComponent implements OnInit { - user: User = null; - videos: Video[] = []; - pagination: Pagination = { - currentPage: 1, - itemsPerPage: 9, - total: 0 - }; - sort: SortField; - loading: boolean = false; - - private search: Search; - - constructor( - private _authService: AuthService, - private _videosService: VideosService, - private _routeParams: RouteParams, - private _router: Router - ) { - this.search = { - value: this._routeParams.get('search'), - field: this._routeParams.get('field') - }; - - this.sort = this._routeParams.get('sort') || '-createdDate'; - } - - ngOnInit() { - if (this._authService.isLoggedIn()) { - this.user = User.load(); - } - - this.getVideos(); - } - - getVideos() { - this.loading = true; - this.videos = []; - - let observable = null; - - if (this.search.value !== null) { - observable = this._videosService.searchVideos(this.search, this.pagination, this.sort); - } else { - observable = this._videosService.getVideos(this.pagination, this.sort); - } - - observable.subscribe( - ({ videos, totalVideos }) => { - this.videos = videos; - this.pagination.total = totalVideos; - this.loading = false; - }, - error => alert(error) - ); - } - - onRemoved(video: Video): void { - this.videos.splice(this.videos.indexOf(video), 1); - } - - onSort(sort: SortField) { - this.sort = sort; - - const params: any = { - sort: this.sort - }; - - if (this.search.value) { - params.search = this.search.value; - params.field = this.search.field; - } - - this._router.navigate(['VideosList', params]); - this.getVideos(); - } -} -- cgit v1.2.3