diff options
Diffstat (limited to 'client/angular/app')
-rw-r--r-- | client/angular/app/app.component.html | 60 | ||||
-rw-r--r-- | client/angular/app/app.component.scss | 32 | ||||
-rw-r--r-- | client/angular/app/app.component.ts | 106 | ||||
-rw-r--r-- | client/angular/app/search.component.html | 17 | ||||
-rw-r--r-- | client/angular/app/search.component.ts | 46 | ||||
-rw-r--r-- | client/angular/app/search.ts | 6 |
6 files changed, 0 insertions, 267 deletions
diff --git a/client/angular/app/app.component.html b/client/angular/app/app.component.html deleted file mode 100644 index 48e97d523..000000000 --- a/client/angular/app/app.component.html +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | <div class="container"> | ||
2 | |||
3 | <header class="row"> | ||
4 | <div class="col-md-2"> | ||
5 | <h4>PeerTube</h4> | ||
6 | </div> | ||
7 | |||
8 | <div class="col-md-9"> | ||
9 | <my-search (search)="onSearch($event)"></my-search> | ||
10 | </div> | ||
11 | </header> | ||
12 | |||
13 | |||
14 | <div class="row"> | ||
15 | |||
16 | <menu class="col-md-2 col-xs-3"> | ||
17 | <div class="panel_block"> | ||
18 | <div id="panel_user_login" class="panel_button"> | ||
19 | <span class="glyphicon glyphicon-user"></span> | ||
20 | <a *ngIf="!isLoggedIn" [routerLink]="['UserLogin']">Login</a> | ||
21 | <a *ngIf="isLoggedIn" (click)="logout()">Logout</a> | ||
22 | </div> | ||
23 | </div> | ||
24 | |||
25 | <div class="panel_block"> | ||
26 | <div id="panel_get_videos" class="panel_button"> | ||
27 | <span class="glyphicon glyphicon-list"></span> | ||
28 | <a [routerLink]="['VideosList']">Get videos</a> | ||
29 | </div> | ||
30 | |||
31 | <div id="panel_upload_video" class="panel_button" *ngIf="isLoggedIn"> | ||
32 | <span class="glyphicon glyphicon-cloud-upload"></span> | ||
33 | <a [routerLink]="['VideosAdd']">Upload a video</a> | ||
34 | </div> | ||
35 | </div> | ||
36 | |||
37 | <div class="panel_block" *ngIf="isLoggedIn"> | ||
38 | <div id="panel_make_friends" class="panel_button"> | ||
39 | <span class="glyphicon glyphicon-cloud"></span> | ||
40 | <a (click)='makeFriends()'>Make friends</a> | ||
41 | </div> | ||
42 | |||
43 | <div id="panel_quit_friends" class="panel_button"> | ||
44 | <span class="glyphicon glyphicon-plane"></span> | ||
45 | <a (click)='quitFriends()'>Quit friends</a> | ||
46 | </div> | ||
47 | </div> | ||
48 | </menu> | ||
49 | |||
50 | <div class="col-md-9 col-xs-8 router_outler_container"> | ||
51 | <router-outlet></router-outlet> | ||
52 | </div> | ||
53 | |||
54 | </div> | ||
55 | |||
56 | |||
57 | <footer> | ||
58 | PeerTube, CopyLeft 2015-2016 | ||
59 | </footer> | ||
60 | </div> | ||
diff --git a/client/angular/app/app.component.scss b/client/angular/app/app.component.scss deleted file mode 100644 index e02c2d5b0..000000000 --- a/client/angular/app/app.component.scss +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | header div { | ||
2 | line-height: 25px; | ||
3 | margin-bottom: 30px; | ||
4 | } | ||
5 | |||
6 | menu { | ||
7 | min-height: 600px; | ||
8 | margin-right: 20px; | ||
9 | border-right: 1px solid rgba(0, 0, 0, 0.2); | ||
10 | |||
11 | .panel_button { | ||
12 | margin: 8px; | ||
13 | cursor: pointer; | ||
14 | transition: margin 0.2s; | ||
15 | |||
16 | &:hover { | ||
17 | margin-left: 15px; | ||
18 | } | ||
19 | |||
20 | a { | ||
21 | color: #333333; | ||
22 | } | ||
23 | } | ||
24 | |||
25 | .glyphicon { | ||
26 | margin: 5px; | ||
27 | } | ||
28 | } | ||
29 | |||
30 | .panel_block:not(:last-child) { | ||
31 | border-bottom: 1px solid rgba(0, 0, 0, 0.1); | ||
32 | } | ||
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts deleted file mode 100644 index 722d0dca0..000000000 --- a/client/angular/app/app.component.ts +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | import { Component } from '@angular/core'; | ||
2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router } from '@angular/router-deprecated'; | ||
3 | import { HTTP_PROVIDERS } from '@angular/http'; | ||
4 | |||
5 | import { VideosAddComponent } from '../videos/components/add/videos-add.component'; | ||
6 | import { VideosListComponent } from '../videos/components/list/videos-list.component'; | ||
7 | import { VideosWatchComponent } from '../videos/components/watch/videos-watch.component'; | ||
8 | import { VideosService } from '../videos/videos.service'; | ||
9 | import { FriendsService } from '../friends/services/friends.service'; | ||
10 | import { UserLoginComponent } from '../users/components/login/login.component'; | ||
11 | import { AuthService } from '../users/services/auth.service'; | ||
12 | import { AuthStatus } from '../users/models/authStatus'; | ||
13 | import { SearchComponent } from './search.component'; | ||
14 | import { Search } from './search'; | ||
15 | |||
16 | @RouteConfig([ | ||
17 | { | ||
18 | path: '/users/login', | ||
19 | name: 'UserLogin', | ||
20 | component: UserLoginComponent | ||
21 | }, | ||
22 | { | ||
23 | path: '/videos/list', | ||
24 | name: 'VideosList', | ||
25 | component: VideosListComponent, | ||
26 | useAsDefault: true | ||
27 | }, | ||
28 | { | ||
29 | path: '/videos/watch/:id', | ||
30 | name: 'VideosWatch', | ||
31 | component: VideosWatchComponent | ||
32 | }, | ||
33 | { | ||
34 | path: '/videos/add', | ||
35 | name: 'VideosAdd', | ||
36 | component: VideosAddComponent | ||
37 | } | ||
38 | ]) | ||
39 | |||
40 | @Component({ | ||
41 | selector: 'my-app', | ||
42 | templateUrl: 'app/angular/app/app.component.html', | ||
43 | styleUrls: [ 'app/angular/app/app.component.css' ], | ||
44 | directives: [ ROUTER_DIRECTIVES, SearchComponent ], | ||
45 | providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, VideosService, FriendsService, AuthService ] | ||
46 | }) | ||
47 | |||
48 | export class AppComponent { | ||
49 | isLoggedIn: boolean; | ||
50 | search_field: string = name; | ||
51 | choices = [ ]; | ||
52 | |||
53 | constructor(private _friendsService: FriendsService, | ||
54 | private _authService: AuthService, | ||
55 | private _router: Router | ||
56 | |||
57 | ) { | ||
58 | this.isLoggedIn = this._authService.isLoggedIn(); | ||
59 | |||
60 | this._authService.loginChanged$.subscribe( | ||
61 | status => { | ||
62 | if (status === AuthStatus.LoggedIn) { | ||
63 | this.isLoggedIn = true; | ||
64 | } | ||
65 | } | ||
66 | ); | ||
67 | } | ||
68 | |||
69 | onSearch(search: Search) { | ||
70 | if (search.value !== '') { | ||
71 | const params = { | ||
72 | search: search.value, | ||
73 | field: search.field | ||
74 | }; | ||
75 | this._router.navigate(['VideosList', params]); | ||
76 | } else { | ||
77 | this._router.navigate(['VideosList']); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | logout() { | ||
82 | // this._authService.logout(); | ||
83 | } | ||
84 | |||
85 | makeFriends() { | ||
86 | this._friendsService.makeFriends().subscribe( | ||
87 | status => { | ||
88 | if (status === 409) { | ||
89 | alert('Already made friends!'); | ||
90 | } else { | ||
91 | alert('Made friends!'); | ||
92 | } | ||
93 | }, | ||
94 | error => alert(error) | ||
95 | ); | ||
96 | } | ||
97 | |||
98 | quitFriends() { | ||
99 | this._friendsService.quitFriends().subscribe( | ||
100 | status => { | ||
101 | alert('Quit friends!'); | ||
102 | }, | ||
103 | error => alert(error) | ||
104 | ); | ||
105 | } | ||
106 | } | ||
diff --git a/client/angular/app/search.component.html b/client/angular/app/search.component.html deleted file mode 100644 index fb13ac72e..000000000 --- a/client/angular/app/search.component.html +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | <div class="input-group"> | ||
2 | <div class="input-group-btn" dropdown> | ||
3 | <button id="simple-btn-keyboard-nav" type="button" class="btn btn-default" dropdownToggle> | ||
4 | {{ getStringChoice(searchCriterias.field) }} <span class="caret"></span> | ||
5 | </button> | ||
6 | <ul class="dropdown-menu" role="menu" aria-labelledby="simple-btn-keyboard-nav"> | ||
7 | <li *ngFor="let choice of choiceKeys" class="dropdown-item"> | ||
8 | <a class="dropdown-item" href="#" (click)="choose($event, choice)">{{ getStringChoice(choice) }}</a> | ||
9 | </li> | ||
10 | </ul> | ||
11 | </div> | ||
12 | |||
13 | <input | ||
14 | type="text" id="search-video" name="search-video" class="form-control" placeholder="Search a video..." class="form-control" | ||
15 | [(ngModel)]="searchCriterias.value" (keyup.enter)="doSearch()" | ||
16 | > | ||
17 | </div> | ||
diff --git a/client/angular/app/search.component.ts b/client/angular/app/search.component.ts deleted file mode 100644 index e21b91fce..000000000 --- a/client/angular/app/search.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, EventEmitter, Output } from '@angular/core'; | ||
2 | |||
3 | import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown'; | ||
4 | |||
5 | import { Search, SearchField } from './search'; | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-search', | ||
9 | templateUrl: 'app/angular/app/search.component.html', | ||
10 | directives: [ DROPDOWN_DIRECTIVES ] | ||
11 | }) | ||
12 | |||
13 | export class SearchComponent { | ||
14 | @Output() search: EventEmitter<Search> = new EventEmitter<Search>(); | ||
15 | |||
16 | searchCriterias: Search = { | ||
17 | field: 'name', | ||
18 | value: '' | ||
19 | }; | ||
20 | fieldChoices = { | ||
21 | name: 'Name', | ||
22 | author: 'Author', | ||
23 | podUrl: 'Pod Url', | ||
24 | magnetUri: 'Magnet Uri' | ||
25 | }; | ||
26 | |||
27 | get choiceKeys() { | ||
28 | return Object.keys(this.fieldChoices); | ||
29 | } | ||
30 | |||
31 | getStringChoice(choiceKey: SearchField): string { | ||
32 | return this.fieldChoices[choiceKey]; | ||
33 | } | ||
34 | |||
35 | choose($event:MouseEvent, choice: SearchField) { | ||
36 | $event.preventDefault(); | ||
37 | $event.stopPropagation(); | ||
38 | |||
39 | this.searchCriterias.field = choice; | ||
40 | } | ||
41 | |||
42 | doSearch(): void { | ||
43 | this.search.emit(this.searchCriterias); | ||
44 | } | ||
45 | |||
46 | } | ||
diff --git a/client/angular/app/search.ts b/client/angular/app/search.ts deleted file mode 100644 index c4e771b47..000000000 --- a/client/angular/app/search.ts +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | export type SearchField = "name" | "author" | "podUrl" | "magnetUri"; | ||
2 | |||
3 | export interface Search { | ||
4 | field: SearchField; | ||
5 | value: string; | ||
6 | } | ||