Follow the angular styleguide for the directories structure
This commit is contained in:
parent
157cb9c971
commit
41a2aee38c
|
@ -1,6 +1,8 @@
|
||||||
typings
|
typings
|
||||||
angular/**/*.js
|
app/**/*.js
|
||||||
angular/**/*.map
|
app/**/*.map
|
||||||
angular/**/*.css
|
app/**/*.css
|
||||||
stylesheets/index.css
|
stylesheets/index.css
|
||||||
bundles
|
bundles
|
||||||
|
main.js
|
||||||
|
main.js.map
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated';
|
|
||||||
import { HTTP_PROVIDERS } from '@angular/http';
|
import { HTTP_PROVIDERS } from '@angular/http';
|
||||||
|
import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { VideosAddComponent } from '../videos/components/add/videos-add.component';
|
import { FriendService } from './friends/index';
|
||||||
import { VideosListComponent } from '../videos/components/list/videos-list.component';
|
import { Search, SearchComponent } from './shared/index';
|
||||||
import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component';
|
import {
|
||||||
import { VideosService } from '../videos/videos.service';
|
UserLoginComponent,
|
||||||
import { FriendsService } from '../friends/services/friends.service';
|
AuthService,
|
||||||
import { UserLoginComponent } from '../users/components/login/login.component';
|
AuthStatus
|
||||||
import { AuthService } from '../users/services/auth.service';
|
} from './users/index';
|
||||||
import { AuthStatus } from '../users/models/authStatus';
|
import {
|
||||||
import { SearchComponent } from './search.component';
|
VideoAddComponent,
|
||||||
import { Search } from './search';
|
VideoListComponent,
|
||||||
|
VideoWatchComponent,
|
||||||
|
VideoService
|
||||||
|
} from './videos/index';
|
||||||
|
|
||||||
@RouteConfig([
|
@RouteConfig([
|
||||||
{
|
{
|
||||||
|
@ -22,35 +25,35 @@ import { Search } from './search';
|
||||||
{
|
{
|
||||||
path: '/videos/list',
|
path: '/videos/list',
|
||||||
name: 'VideosList',
|
name: 'VideosList',
|
||||||
component: VideosListComponent,
|
component: VideoListComponent,
|
||||||
useAsDefault: true
|
useAsDefault: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/videos/watch/:id',
|
path: '/videos/watch/:id',
|
||||||
name: 'VideosWatch',
|
name: 'VideosWatch',
|
||||||
component: VideosWatchComponent
|
component: VideoWatchComponent
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/videos/add',
|
path: '/videos/add',
|
||||||
name: 'VideosAdd',
|
name: 'VideosAdd',
|
||||||
component: VideosAddComponent
|
component: VideoAddComponent
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
templateUrl: 'app/angular/app/app.component.html',
|
templateUrl: 'client/app/app.component.html',
|
||||||
styleUrls: [ 'app/angular/app/app.component.css' ],
|
styleUrls: [ 'client/app/app.component.css' ],
|
||||||
directives: [ ROUTER_DIRECTIVES, SearchComponent ],
|
directives: [ ROUTER_DIRECTIVES, SearchComponent ],
|
||||||
providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ]
|
providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideoService, FriendService, AuthService ]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
search_field: string = name;
|
search_field: string = name;
|
||||||
choices = [ ];
|
choices = [ ];
|
||||||
|
|
||||||
constructor(private _friendsService: FriendsService,
|
constructor(private _friendService: FriendService,
|
||||||
private _authService: AuthService,
|
private _authService: AuthService,
|
||||||
private _router: Router
|
private _router: Router
|
||||||
|
|
||||||
|
@ -83,7 +86,7 @@ export class AppComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
makeFriends() {
|
makeFriends() {
|
||||||
this._friendsService.makeFriends().subscribe(
|
this._friendService.makeFriends().subscribe(
|
||||||
status => {
|
status => {
|
||||||
if (status === 409) {
|
if (status === 409) {
|
||||||
alert('Already made friends!');
|
alert('Already made friends!');
|
||||||
|
@ -96,7 +99,7 @@ export class AppComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
quitFriends() {
|
quitFriends() {
|
||||||
this._friendsService.quitFriends().subscribe(
|
this._friendService.quitFriends().subscribe(
|
||||||
status => {
|
status => {
|
||||||
alert('Quit friends!');
|
alert('Quit friends!');
|
||||||
},
|
},
|
|
@ -3,7 +3,7 @@ import { Http, Response } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FriendsService {
|
export class FriendService {
|
||||||
private _baseFriendsUrl = '/api/v1/pods/';
|
private _baseFriendsUrl = '/api/v1/pods/';
|
||||||
|
|
||||||
constructor (private http: Http) {}
|
constructor (private http: Http) {}
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './friend.service';
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './search-field.type';
|
||||||
|
export * from './search.component';
|
||||||
|
export * from './search.model';
|
|
@ -1,6 +1 @@
|
||||||
export type SearchField = "name" | "author" | "podUrl" | "magnetUri";
|
export type SearchField = "name" | "author" | "podUrl" | "magnetUri";
|
||||||
|
|
||||||
export interface Search {
|
|
||||||
field: SearchField;
|
|
||||||
value: string;
|
|
||||||
}
|
|
|
@ -2,11 +2,12 @@ import { Component, EventEmitter, Output } from '@angular/core';
|
||||||
|
|
||||||
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
|
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
|
||||||
|
|
||||||
import { Search, SearchField } from './search';
|
import { Search } from './search.model';
|
||||||
|
import { SearchField } from './search-field.type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-search',
|
selector: 'my-search',
|
||||||
templateUrl: 'app/angular/app/search.component.html',
|
templateUrl: 'client/app/shared/search.component.html',
|
||||||
directives: [ DROPDOWN_DIRECTIVES ]
|
directives: [ DROPDOWN_DIRECTIVES ]
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { SearchField } from './search-field.type';
|
||||||
|
|
||||||
|
export interface Search {
|
||||||
|
field: SearchField;
|
||||||
|
value: string;
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from './login/index';
|
||||||
|
export * from './shared/index';
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './login.component';
|
|
@ -1,14 +1,12 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router-deprecated';
|
import { Router } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { AuthService } from '../../services/auth.service';
|
import { AuthService, AuthStatus, User } from '../shared/index';
|
||||||
import { AuthStatus } from '../../models/authStatus';
|
|
||||||
import { User } from '../../models/user';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-user-login',
|
selector: 'my-user-login',
|
||||||
styleUrls: [ 'app/angular/users/components/login/login.component.css' ],
|
styleUrls: [ 'client/app/users/login/login.component.css' ],
|
||||||
templateUrl: 'app/angular/users/components/login/login.component.html'
|
templateUrl: 'client/app/users/login/login.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class UserLoginComponent {
|
export class UserLoginComponent {
|
|
@ -1,9 +1,9 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http, Response, Headers, URLSearchParams, RequestOptions } from '@angular/http';
|
import { Headers, Http, RequestOptions, Response, URLSearchParams } from '@angular/http';
|
||||||
import { Observable, Subject } from 'rxjs/Rx';
|
import { Observable, Subject } from 'rxjs/Rx';
|
||||||
|
|
||||||
import { AuthStatus } from '../models/authStatus';
|
import { AuthStatus } from './auth-status.model';
|
||||||
import { User } from '../models/user';
|
import { User } from './user.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './auth-status.model';
|
||||||
|
export * from './auth.service';
|
||||||
|
export * from './token.model';
|
||||||
|
export * from './user.model';
|
|
@ -1,4 +1,4 @@
|
||||||
import { Token } from './token';
|
import { Token } from './token.model';
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
username: string;
|
username: string;
|
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './shared/index';
|
||||||
|
export * from './video-add/index';
|
||||||
|
export * from './video-list/index';
|
||||||
|
export * from './video-watch/index';
|
|
@ -0,0 +1,5 @@
|
||||||
|
export * from './loader/index';
|
||||||
|
export * from './pagination.model';
|
||||||
|
export * from './sort-field.type';
|
||||||
|
export * from './video.model';
|
||||||
|
export * from './video.service';
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './loader.component';
|
|
@ -2,8 +2,8 @@ import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-loader',
|
selector: 'my-loader',
|
||||||
styleUrls: [ 'app/angular/videos/loader.component.css' ],
|
styleUrls: [ 'client/app/videos/shared/loader/loader.component.css' ],
|
||||||
templateUrl: 'app/angular/videos/loader.component.html'
|
templateUrl: 'client/app/videos/shared/loader/loader.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class LoaderComponent {
|
export class LoaderComponent {
|
|
@ -2,14 +2,14 @@ import { Injectable } from '@angular/core';
|
||||||
import { Http, Response, URLSearchParams } from '@angular/http';
|
import { Http, Response, URLSearchParams } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
import { Pagination } from './pagination';
|
import { Pagination } from './pagination.model';
|
||||||
import { Video } from './video';
|
import { Search } from '../../shared/index';
|
||||||
import { AuthService } from '../users/services/auth.service';
|
import { SortField } from './sort-field.type';
|
||||||
import { Search } from '../app/search';
|
import { AuthService } from '../../users/index';
|
||||||
import { SortField } from './components/list/sort';
|
import { Video } from './video.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class VideosService {
|
export class VideoService {
|
||||||
private _baseVideoUrl = '/api/v1/videos/';
|
private _baseVideoUrl = '/api/v1/videos/';
|
||||||
|
|
||||||
constructor (private http: Http, private _authService: AuthService) {}
|
constructor (private http: Http, private _authService: AuthService) {}
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './video-add.component';
|
|
@ -1,24 +1,23 @@
|
||||||
import { Component, ElementRef, OnInit } from '@angular/core';
|
import { Component, ElementRef, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router-deprecated';
|
import { Router } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
|
|
||||||
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
||||||
|
import { PROGRESSBAR_DIRECTIVES } from 'ng2-bootstrap/components/progressbar';
|
||||||
|
|
||||||
import { AuthService } from '../../../users/services/auth.service';
|
import { AuthService, User } from '../../users/index';
|
||||||
import { User } from '../../../users/models/user';
|
|
||||||
|
|
||||||
// TODO: import it with systemjs
|
// TODO: import it with systemjs
|
||||||
declare var jQuery:any;
|
declare var jQuery:any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-videos-add',
|
selector: 'my-videos-add',
|
||||||
styleUrls: [ 'app/angular/videos/components/add/videos-add.component.css' ],
|
styleUrls: [ 'client/app/videos/video-add/video-add.component.css' ],
|
||||||
templateUrl: 'app/angular/videos/components/add/videos-add.component.html',
|
templateUrl: 'client/app/videos/video-add/video-add.component.html',
|
||||||
directives: [ PROGRESSBAR_DIRECTIVES ],
|
directives: [ PROGRESSBAR_DIRECTIVES ],
|
||||||
pipes: [ BytesPipe ]
|
pipes: [ BytesPipe ]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class VideosAddComponent implements OnInit {
|
export class VideoAddComponent implements OnInit {
|
||||||
user: User;
|
user: User;
|
||||||
fileToUpload: any;
|
fileToUpload: any;
|
||||||
progressBar: { value: number; max: number; } = { value: 0, max: 0 };
|
progressBar: { value: number; max: number; } = { value: 0, max: 0 };
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './video-list.component';
|
||||||
|
export * from './video-miniature.component';
|
||||||
|
export * from './video-sort.component';
|
|
@ -1,27 +1,28 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ROUTER_DIRECTIVES, RouteParams, Router } from '@angular/router-deprecated';
|
import { Router, ROUTER_DIRECTIVES, RouteParams } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { PAGINATION_DIRECTIVES } from 'ng2-bootstrap/components/pagination';
|
import { PAGINATION_DIRECTIVES } from 'ng2-bootstrap/components/pagination';
|
||||||
|
|
||||||
import { AuthService } from '../../../users/services/auth.service';
|
import {
|
||||||
import { Pagination } from '../../pagination';
|
LoaderComponent,
|
||||||
import { User } from '../../../users/models/user';
|
Pagination,
|
||||||
import { VideosService } from '../../videos.service';
|
SortField,
|
||||||
import { Video } from '../../video';
|
Video,
|
||||||
|
VideoService
|
||||||
|
} from '../shared/index';
|
||||||
|
import { Search, SearchField } from '../../shared/index';
|
||||||
|
import { AuthService, User } from '../../users/index';
|
||||||
import { VideoMiniatureComponent } from './video-miniature.component';
|
import { VideoMiniatureComponent } from './video-miniature.component';
|
||||||
import { Search, SearchField } from '../../../app/search';
|
|
||||||
import { VideoSortComponent } from './video-sort.component';
|
import { VideoSortComponent } from './video-sort.component';
|
||||||
import { SortField } from './sort';
|
|
||||||
import { LoaderComponent } from '../../loader.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-videos-list',
|
selector: 'my-videos-list',
|
||||||
styleUrls: [ 'app/angular/videos/components/list/videos-list.component.css' ],
|
styleUrls: [ 'client/app/videos/video-list/video-list.component.css' ],
|
||||||
templateUrl: 'app/angular/videos/components/list/videos-list.component.html',
|
templateUrl: 'client/app/videos/video-list/video-list.component.html',
|
||||||
directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ]
|
directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class VideosListComponent implements OnInit {
|
export class VideoListComponent implements OnInit {
|
||||||
user: User = null;
|
user: User = null;
|
||||||
videos: Video[] = [];
|
videos: Video[] = [];
|
||||||
pagination: Pagination = {
|
pagination: Pagination = {
|
||||||
|
@ -36,7 +37,7 @@ export class VideosListComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _authService: AuthService,
|
private _authService: AuthService,
|
||||||
private _videosService: VideosService,
|
private _videoService: VideoService,
|
||||||
private _routeParams: RouteParams,
|
private _routeParams: RouteParams,
|
||||||
private _router: Router
|
private _router: Router
|
||||||
) {
|
) {
|
||||||
|
@ -63,9 +64,9 @@ export class VideosListComponent implements OnInit {
|
||||||
let observable = null;
|
let observable = null;
|
||||||
|
|
||||||
if (this.search.value !== null) {
|
if (this.search.value !== null) {
|
||||||
observable = this._videosService.searchVideos(this.search, this.pagination, this.sort);
|
observable = this._videoService.searchVideos(this.search, this.pagination, this.sort);
|
||||||
} else {
|
} else {
|
||||||
observable = this._videosService.getVideos(this.pagination, this.sort);
|
observable = this._videoService.getVideos(this.pagination, this.sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
observable.subscribe(
|
observable.subscribe(
|
|
@ -1,15 +1,14 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
|
import { ROUTER_DIRECTIVES } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { Video } from '../../video';
|
import { Video, VideoService } from '../shared/index';
|
||||||
import { VideosService } from '../../videos.service';
|
import { User } from '../../users/index';
|
||||||
import { User } from '../../../users/models/user';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-miniature',
|
selector: 'my-video-miniature',
|
||||||
styleUrls: [ 'app/angular/videos/components/list/video-miniature.component.css' ],
|
styleUrls: [ 'client/app/videos/video-list/video-miniature.component.css' ],
|
||||||
templateUrl: 'app/angular/videos/components/list/video-miniature.component.html',
|
templateUrl: 'client/app/videos/video-list/video-miniature.component.html',
|
||||||
directives: [ ROUTER_DIRECTIVES ],
|
directives: [ ROUTER_DIRECTIVES ],
|
||||||
pipes: [ DatePipe ]
|
pipes: [ DatePipe ]
|
||||||
})
|
})
|
||||||
|
@ -22,7 +21,7 @@ export class VideoMiniatureComponent {
|
||||||
|
|
||||||
hovering: boolean = false;
|
hovering: boolean = false;
|
||||||
|
|
||||||
constructor(private _videosService: VideosService) {}
|
constructor(private _videoService: VideoService) {}
|
||||||
|
|
||||||
onHover() {
|
onHover() {
|
||||||
this.hovering = true;
|
this.hovering = true;
|
||||||
|
@ -38,7 +37,7 @@ export class VideoMiniatureComponent {
|
||||||
|
|
||||||
removeVideo(id: string) {
|
removeVideo(id: string) {
|
||||||
if (confirm('Do you really want to remove this video?')) {
|
if (confirm('Do you really want to remove this video?')) {
|
||||||
this._videosService.removeVideo(id).subscribe(
|
this._videoService.removeVideo(id).subscribe(
|
||||||
status => this.removed.emit(true),
|
status => this.removed.emit(true),
|
||||||
error => alert(error)
|
error => alert(error)
|
||||||
);
|
);
|
|
@ -1,11 +1,11 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
|
|
||||||
import { SortField } from './sort';
|
import { SortField } from '../shared/index';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-sort',
|
selector: 'my-video-sort',
|
||||||
// styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ],
|
// styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ],
|
||||||
templateUrl: 'app/angular/videos/components/list/video-sort.component.html'
|
templateUrl: 'client/app/videos/video-list/video-sort.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class VideoSortComponent {
|
export class VideoSortComponent {
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './video-watch.component';
|
|
@ -1,25 +1,22 @@
|
||||||
import { Component, OnInit, ElementRef } from '@angular/core';
|
import { Component, ElementRef, OnInit } from '@angular/core';
|
||||||
import { RouteParams, CanDeactivate, ComponentInstruction } from '@angular/router-deprecated';
|
import { CanDeactivate, ComponentInstruction, RouteParams } from '@angular/router-deprecated';
|
||||||
|
|
||||||
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe';
|
||||||
|
|
||||||
import { LoaderComponent } from '../../loader.component';
|
import { LoaderComponent, Video, VideoService } from '../shared/index';
|
||||||
|
|
||||||
// TODO import it with systemjs
|
// TODO import it with systemjs
|
||||||
declare var WebTorrent: any;
|
declare var WebTorrent: any;
|
||||||
|
|
||||||
import { Video } from '../../video';
|
|
||||||
import { VideosService } from '../../videos.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-watch',
|
selector: 'my-video-watch',
|
||||||
templateUrl: 'app/angular/videos/components/watch/videos-watch.component.html',
|
templateUrl: 'client/app/videos/video-watch/video-watch.component.html',
|
||||||
styleUrls: [ 'app/angular/videos/components/watch/videos-watch.component.css' ],
|
styleUrls: [ 'client/app/videos/video-watch/video-watch.component.css' ],
|
||||||
directives: [ LoaderComponent ],
|
directives: [ LoaderComponent ],
|
||||||
pipes: [ BytesPipe ]
|
pipes: [ BytesPipe ]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class VideosWatchComponent implements OnInit, CanDeactivate {
|
export class VideoWatchComponent implements OnInit, CanDeactivate {
|
||||||
video: Video;
|
video: Video;
|
||||||
downloadSpeed: number;
|
downloadSpeed: number;
|
||||||
uploadSpeed: number;
|
uploadSpeed: number;
|
||||||
|
@ -30,7 +27,7 @@ export class VideosWatchComponent implements OnInit, CanDeactivate {
|
||||||
private client: any;
|
private client: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _videosService: VideosService,
|
private _videoService: VideoService,
|
||||||
private _routeParams: RouteParams,
|
private _routeParams: RouteParams,
|
||||||
private _elementRef: ElementRef
|
private _elementRef: ElementRef
|
||||||
) {
|
) {
|
||||||
|
@ -40,7 +37,7 @@ export class VideosWatchComponent implements OnInit, CanDeactivate {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let id = this._routeParams.get('id');
|
let id = this._routeParams.get('id');
|
||||||
this._videosService.getVideo(id).subscribe(
|
this._videoService.getVideo(id).subscribe(
|
||||||
video => this.loadVideo(video),
|
video => this.loadVideo(video),
|
||||||
error => alert(error)
|
error => alert(error)
|
||||||
);
|
);
|
|
@ -7,27 +7,27 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/app/stylesheets/index.css">
|
<link rel="stylesheet" href="client/stylesheets/index.css">
|
||||||
|
|
||||||
<!-- 1. Load libraries -->
|
<!-- 1. Load libraries -->
|
||||||
<!-- IE required polyfills, in this exact order -->
|
<!-- IE required polyfills, in this exact order -->
|
||||||
<script src="/app/node_modules/es6-shim/es6-shim.min.js"></script>
|
<script src="client/node_modules/es6-shim/es6-shim.min.js"></script>
|
||||||
<script src="/app/node_modules/zone.js/dist/zone.js"></script>
|
<script src="client/node_modules/zone.js/dist/zone.js"></script>
|
||||||
<script src="/app/node_modules/reflect-metadata/Reflect.js"></script>
|
<script src="client/node_modules/reflect-metadata/Reflect.js"></script>
|
||||||
<script src="/app/node_modules/systemjs/dist/system.src.js"></script>
|
<script src="client/node_modules/systemjs/dist/system.src.js"></script>
|
||||||
|
|
||||||
<script src="/app/node_modules/jquery/dist/jquery.js"></script>
|
<script src="client/node_modules/jquery/dist/jquery.js"></script>
|
||||||
<script src="/app/node_modules/jquery.ui.widget/jquery.ui.widget.js"></script>
|
<script src="client/node_modules/jquery.ui.widget/jquery.ui.widget.js"></script>
|
||||||
<script src="/app/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script>
|
<script src="client/node_modules/blueimp-file-upload/js/jquery.fileupload.js"></script>
|
||||||
|
|
||||||
<script src="/app/node_modules/webtorrent/webtorrent.min.js"></script>
|
<script src="client/node_modules/webtorrent/webtorrent.min.js"></script>
|
||||||
|
|
||||||
<script src="/app/node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js"></script>
|
<script src="client/node_modules/ng2-bootstrap/bundles/ng2-bootstrap.min.js"></script>
|
||||||
|
|
||||||
<!-- 2. Configure SystemJS -->
|
<!-- 2. Configure SystemJS -->
|
||||||
<script src="/app/systemjs.config.js"></script>
|
<script src="client/systemjs.config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
System.import('app').catch(function(err){ console.error(err); });
|
System.import('client').catch(function(err){ console.error(err); });
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppComponent } from './app/app.component';
|
import { AppComponent } from './app/app.component';
|
||||||
|
|
||||||
bootstrap(AppComponent);
|
bootstrap(AppComponent);
|
|
@ -1,4 +1,4 @@
|
||||||
$icon-font-path: "/app/node_modules/bootstrap-sass/assets/fonts/bootstrap/";
|
$icon-font-path: "/client/node_modules/bootstrap-sass/assets/fonts/bootstrap/";
|
||||||
|
|
||||||
@import "bootstrap-variables";
|
@import "bootstrap-variables";
|
||||||
@import "_bootstrap";
|
@import "_bootstrap";
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
;(function (global) {
|
;(function (global) {
|
||||||
var map = {
|
var map = {
|
||||||
'app': 'app/angular',
|
'angular-pipes': 'client/node_modules/angular-pipes',
|
||||||
'angular-pipes': 'app/node_modules/angular-pipes',
|
'ng2-bootstrap': 'client/node_modules/ng2-bootstrap',
|
||||||
'ng2-bootstrap': 'app/node_modules/ng2-bootstrap',
|
'angular-rxjs.bundle': 'client/bundles/angular-rxjs.bundle.js'
|
||||||
'angular-rxjs.bundle': 'app/bundles/angular-rxjs.bundle.js'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var packages = {
|
var packages = {
|
||||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
'client': { main: 'main.js', defaultExtension: 'js' },
|
||||||
'ng2-bootstrap': { defaultExtension: 'js' },
|
'ng2-bootstrap': { defaultExtension: 'js' },
|
||||||
'rxjs': { defaultExtension: 'js' }
|
'rxjs': { defaultExtension: 'js' }
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,26 +20,38 @@
|
||||||
],
|
],
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"files": [
|
"files": [
|
||||||
"angular/app/app.component.ts",
|
"app/app.component.ts",
|
||||||
"angular/app/search.component.ts",
|
"app/friends/friend.service.ts",
|
||||||
"angular/app/search.ts",
|
"app/friends/index.ts",
|
||||||
"angular/friends/services/friends.service.ts",
|
"app/shared/index.ts",
|
||||||
"angular/main.ts",
|
"app/shared/search-field.type.ts",
|
||||||
"angular/users/components/login/login.component.ts",
|
"app/shared/search.component.ts",
|
||||||
"angular/users/models/authStatus.ts",
|
"app/shared/search.model.ts",
|
||||||
"angular/users/models/token.ts",
|
"app/users/index.ts",
|
||||||
"angular/users/models/user.ts",
|
"app/users/login/index.ts",
|
||||||
"angular/users/services/auth.service.ts",
|
"app/users/login/login.component.ts",
|
||||||
"angular/videos/components/add/videos-add.component.ts",
|
"app/users/shared/auth-status.model.ts",
|
||||||
"angular/videos/components/list/sort.ts",
|
"app/users/shared/auth.service.ts",
|
||||||
"angular/videos/components/list/video-miniature.component.ts",
|
"app/users/shared/index.ts",
|
||||||
"angular/videos/components/list/video-sort.component.ts",
|
"app/users/shared/token.model.ts",
|
||||||
"angular/videos/components/list/videos-list.component.ts",
|
"app/users/shared/user.model.ts",
|
||||||
"angular/videos/components/watch/videos-watch.component.ts",
|
"app/videos/index.ts",
|
||||||
"angular/videos/loader.component.ts",
|
"app/videos/shared/index.ts",
|
||||||
"angular/videos/pagination.ts",
|
"app/videos/shared/loader/index.ts",
|
||||||
"angular/videos/video.ts",
|
"app/videos/shared/loader/loader.component.ts",
|
||||||
"angular/videos/videos.service.ts",
|
"app/videos/shared/pagination.model.ts",
|
||||||
|
"app/videos/shared/sort-field.type.ts",
|
||||||
|
"app/videos/shared/video.model.ts",
|
||||||
|
"app/videos/shared/video.service.ts",
|
||||||
|
"app/videos/video-add/index.ts",
|
||||||
|
"app/videos/video-add/video-add.component.ts",
|
||||||
|
"app/videos/video-list/index.ts",
|
||||||
|
"app/videos/video-list/video-list.component.ts",
|
||||||
|
"app/videos/video-list/video-miniature.component.ts",
|
||||||
|
"app/videos/video-list/video-sort.component.ts",
|
||||||
|
"app/videos/video-watch/index.ts",
|
||||||
|
"app/videos/video-watch/video-watch.component.ts",
|
||||||
|
"main.ts",
|
||||||
"typings/globals/es6-shim/index.d.ts",
|
"typings/globals/es6-shim/index.d.ts",
|
||||||
"typings/globals/jasmine/index.d.ts",
|
"typings/globals/jasmine/index.d.ts",
|
||||||
"typings/globals/node/index.d.ts",
|
"typings/globals/node/index.d.ts",
|
||||||
|
|
|
@ -6,4 +6,4 @@ cd client || exit -1
|
||||||
# Compile index and angular files
|
# Compile index and angular files
|
||||||
concurrently \
|
concurrently \
|
||||||
"node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
|
"node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
|
||||||
"node-sass angular/ --output angular/"
|
"node-sass app/ --output app/"
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
cd client || exit -1
|
cd client || exit -1
|
||||||
rm -f stylesheets/index.css
|
rm -f stylesheets/index.css
|
||||||
find angular -regextype posix-egrep -regex ".*\.(css)$" -exec rm -f {} \;
|
find app -regextype posix-egrep -regex ".*\.(css)$" -exec rm -f {} \;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
cd client || exit -1
|
cd client || exit -1
|
||||||
find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;
|
find app -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \;
|
||||||
rm -rf ./bundles
|
rm -rf ./bundles
|
||||||
|
rm -f main.js main.js.map
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
livereload client/angular -e scss
|
livereload client/app -e scss
|
||||||
|
|
|
@ -4,4 +4,4 @@ cd client || exit -1
|
||||||
|
|
||||||
concurrently \
|
concurrently \
|
||||||
"node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
|
"node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \
|
||||||
"node-sass -w angular/ --output angular/"
|
"node-sass -w app/ --output app/"
|
||||||
|
|
|
@ -64,9 +64,9 @@ const apiRoute = '/api/' + constants.API_VERSION
|
||||||
app.use(apiRoute, routes.api)
|
app.use(apiRoute, routes.api)
|
||||||
|
|
||||||
// Static files
|
// Static files
|
||||||
app.use('/app', express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
|
app.use('/client', express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
|
||||||
// 404 for static files not found
|
// 404 for static files not found
|
||||||
app.use('/app/*', function (req, res, next) {
|
app.use('/client/*', function (req, res, next) {
|
||||||
res.sendStatus(404)
|
res.sendStatus(404)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue