diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-14 13:50:19 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-14 13:50:19 +0100 |
commit | dc8bc31be517a53e8fbe7100cfe45cd73f596de0 (patch) | |
tree | c0b0d6641dd352dafff93b8fd33ddb262b59aa47 /client/angular/app | |
parent | bd324a669218f9ed302f7f54b36ee535d25c9733 (diff) | |
download | PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.gz PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.tar.zst PeerTube-dc8bc31be517a53e8fbe7100cfe45cd73f596de0.zip |
Angular application :first draft
Diffstat (limited to 'client/angular/app')
-rw-r--r-- | client/angular/app/app.component.html | 37 | ||||
-rw-r--r-- | client/angular/app/app.component.scss | 28 | ||||
-rw-r--r-- | client/angular/app/app.component.ts | 63 |
3 files changed, 128 insertions, 0 deletions
diff --git a/client/angular/app/app.component.html b/client/angular/app/app.component.html new file mode 100644 index 000000000..590efa0d6 --- /dev/null +++ b/client/angular/app/app.component.html | |||
@@ -0,0 +1,37 @@ | |||
1 | <div class="container"> | ||
2 | |||
3 | <div class="row"> | ||
4 | |||
5 | <menu class="col-md-2"> | ||
6 | <div id="panel_get_videos" class="panel_button"> | ||
7 | <span class="glyphicon glyphicon-list"></span> | ||
8 | <a [routerLink]="['VideosList']">Get videos</a> | ||
9 | </div> | ||
10 | |||
11 | <div id="panel_upload_video" class="panel_button"> | ||
12 | <span class="glyphicon glyphicon-cloud-upload"></span> | ||
13 | <a [routerLink]="['VideosAdd']">Upload a video</a> | ||
14 | </div> | ||
15 | |||
16 | <div id="panel_make_friends" class="panel_button"> | ||
17 | <span class="glyphicon glyphicon-user"></span> | ||
18 | <a (click)='makeFriends()'>Make friends</a> | ||
19 | </div> | ||
20 | |||
21 | <div id="panel_quit_friends" class="panel_button"> | ||
22 | <span class="glyphicon glyphicon-plane"></span> | ||
23 | <a (click)='quitFriends()'>Quit friends</a> | ||
24 | </div> | ||
25 | </menu> | ||
26 | |||
27 | <div class="col-md-9 router_outler_container"> | ||
28 | <router-outlet></router-outlet> | ||
29 | </div> | ||
30 | |||
31 | </div> | ||
32 | |||
33 | |||
34 | <footer> | ||
35 | PeerTube, CopyLeft 2015-2016 | ||
36 | </footer> | ||
37 | </div> | ||
diff --git a/client/angular/app/app.component.scss b/client/angular/app/app.component.scss new file mode 100644 index 000000000..03ecba8f2 --- /dev/null +++ b/client/angular/app/app.component.scss | |||
@@ -0,0 +1,28 @@ | |||
1 | menu { | ||
2 | min-height: 300px; | ||
3 | height: 100%; | ||
4 | margin-right: 20px; | ||
5 | border-right: 1px solid rgba(0, 0, 0, 0.2); | ||
6 | |||
7 | .panel_button { | ||
8 | margin: 8px; | ||
9 | cursor: pointer; | ||
10 | transition: margin 0.2s; | ||
11 | |||
12 | &:hover { | ||
13 | margin-left: 15px; | ||
14 | } | ||
15 | |||
16 | a { | ||
17 | color: #333333; | ||
18 | } | ||
19 | } | ||
20 | |||
21 | .glyphicon { | ||
22 | margin: 5px; | ||
23 | } | ||
24 | } | ||
25 | |||
26 | footer { | ||
27 | margin-top: 30px; | ||
28 | } | ||
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts new file mode 100644 index 000000000..3d41183f2 --- /dev/null +++ b/client/angular/app/app.component.ts | |||
@@ -0,0 +1,63 @@ | |||
1 | import { Component, ElementRef } from 'angular2/core'; | ||
2 | import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from 'angular2/router'; | ||
3 | import {HTTP_PROVIDERS} from 'angular2/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/services/videos.service'; | ||
9 | import { FriendsService } from '../friends/services/friends.service'; | ||
10 | |||
11 | @RouteConfig([ | ||
12 | { | ||
13 | path: '/videos/list', | ||
14 | name: 'VideosList', | ||
15 | component: VideosListComponent, | ||
16 | useAsDefault: true | ||
17 | }, | ||
18 | { | ||
19 | path: '/videos/watch/:id', | ||
20 | name: 'VideosWatch', | ||
21 | component: VideosWatchComponent | ||
22 | }, | ||
23 | { | ||
24 | path: '/videos/add', | ||
25 | name: 'VideosAdd', | ||
26 | component: VideosAddComponent | ||
27 | } | ||
28 | ]) | ||
29 | |||
30 | @Component({ | ||
31 | selector: 'my-app', | ||
32 | templateUrl: 'app/angular/app/app.component.html', | ||
33 | styleUrls: [ 'app/angular/app/app.component.css' ], | ||
34 | directives: [ ROUTER_DIRECTIVES ], | ||
35 | providers: [ ROUTER_PROVIDERS, HTTP_PROVIDERS, ElementRef, VideosService, FriendsService ] | ||
36 | }) | ||
37 | |||
38 | export class AppComponent { | ||
39 | constructor(private _friendsService: FriendsService) {} | ||
40 | |||
41 | makeFriends() { | ||
42 | this._friendsService.makeFriends().subscribe( | ||
43 | status => { | ||
44 | if (status === 409) { | ||
45 | alert('Already made friends!'); | ||
46 | } | ||
47 | else { | ||
48 | alert('Made friends!'); | ||
49 | } | ||
50 | }, | ||
51 | error => alert(error) | ||
52 | ) | ||
53 | } | ||
54 | |||
55 | quitFriends() { | ||
56 | this._friendsService.quitFriends().subscribe( | ||
57 | status => { | ||
58 | alert('Quit friends!'); | ||
59 | }, | ||
60 | error => alert(error) | ||
61 | ) | ||
62 | } | ||
63 | } | ||