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 --- .../components/add/videos-add.component.html | 41 ------------- .../components/add/videos-add.component.scss | 33 ----------- .../videos/components/add/videos-add.component.ts | 69 ---------------------- 3 files changed, 143 deletions(-) delete mode 100644 client/angular/videos/components/add/videos-add.component.html delete mode 100644 client/angular/videos/components/add/videos-add.component.scss delete mode 100644 client/angular/videos/components/add/videos-add.component.ts (limited to 'client/angular/videos/components/add') diff --git a/client/angular/videos/components/add/videos-add.component.html b/client/angular/videos/components/add/videos-add.component.html deleted file mode 100644 index 80d229cb8..000000000 --- a/client/angular/videos/components/add/videos-add.component.html +++ /dev/null @@ -1,41 +0,0 @@ -

Upload a video

- -
-
- - -
- Name is required -
-
- -
-
- Select the video... - -
- - {{ fileToUpload.name }} -
- -
- - -
- A description is required -
-
- -
- {{ progressBar.value | bytes }} / {{ progressBar.max | bytes }} -
- - -
diff --git a/client/angular/videos/components/add/videos-add.component.scss b/client/angular/videos/components/add/videos-add.component.scss deleted file mode 100644 index 01195f017..000000000 --- a/client/angular/videos/components/add/videos-add.component.scss +++ /dev/null @@ -1,33 +0,0 @@ -.btn-file { - position: relative; - overflow: hidden; -} - -.btn-file input[type=file] { - position: absolute; - top: 0; - right: 0; - min-width: 100%; - min-height: 100%; - font-size: 100px; - text-align: right; - filter: alpha(opacity=0); - opacity: 0; - outline: none; - background: white; - cursor: inherit; - display: block; -} - -.name_file { - display: inline-block; - margin-left: 10px; -} - -.form-group { - margin-bottom: 10px; -} - -#progress { - margin-bottom: 10px; -} diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts deleted file mode 100644 index f1652be19..000000000 --- a/client/angular/videos/components/add/videos-add.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component, ElementRef, OnInit } from '@angular/core'; -import { Router } from '@angular/router-deprecated'; - -import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar'; -import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'; - -import { AuthService } from '../../../users/services/auth.service'; -import { User } from '../../../users/models/user'; - -// TODO: import it with systemjs -declare var jQuery:any; - -@Component({ - selector: 'my-videos-add', - styleUrls: [ 'app/angular/videos/components/add/videos-add.component.css' ], - templateUrl: 'app/angular/videos/components/add/videos-add.component.html', - directives: [ PROGRESSBAR_DIRECTIVES ], - pipes: [ BytesPipe ] -}) - -export class VideosAddComponent implements OnInit { - user: User; - fileToUpload: any; - progressBar: { value: number; max: number; } = { value: 0, max: 0 }; - - private _form: any; - - constructor( - private _router: Router, private _elementRef: ElementRef, - private _authService: AuthService - ) {} - - ngOnInit() { - this.user = User.load(); - jQuery(this._elementRef.nativeElement).find('#videofile').fileupload({ - url: '/api/v1/videos', - dataType: 'json', - singleFileUploads: true, - multipart: true, - autoupload: false, - - add: (e, data) => { - this._form = data; - this.fileToUpload = data['files'][0]; - }, - - progressall: (e, data) => { - this.progressBar.value = data.loaded; - // The server is a little bit slow to answer (has to seed the video) - // So we add more time to the progress bar (+10%) - this.progressBar.max = data.total + (0.1 * data.total); - }, - - done: (e, data) => { - this.progressBar.value = this.progressBar.max; - console.log('Video uploaded.'); - - // Print all the videos once it's finished - this._router.navigate(['VideosList']); - } - }); - } - - uploadFile() { - this._form.headers = this._authService.getRequestHeader().toJSON(); - this._form.formData = jQuery(this._elementRef.nativeElement).find('form').serializeArray(); - this._form.submit(); - } -} -- cgit v1.2.3