diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-12 18:22:58 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-12 18:22:58 +0200 |
commit | e2f555cab7563cd74fa790cea5fc65f2e31b0dc0 (patch) | |
tree | 73b68f28c3d8b4521612e5c6de120d2d2614dd70 /client/src/app/admin/friends/friend-list | |
parent | c323efb9cdc6a605242d112ac0c9db9f67eabaad (diff) | |
download | PeerTube-e2f555cab7563cd74fa790cea5fc65f2e31b0dc0.tar.gz PeerTube-e2f555cab7563cd74fa790cea5fc65f2e31b0dc0.tar.zst PeerTube-e2f555cab7563cd74fa790cea5fc65f2e31b0dc0.zip |
Client: add friends page
Diffstat (limited to 'client/src/app/admin/friends/friend-list')
4 files changed, 71 insertions, 0 deletions
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.html b/client/src/app/admin/friends/friend-list/friend-list.component.html new file mode 100644 index 000000000..860bd2c07 --- /dev/null +++ b/client/src/app/admin/friends/friend-list/friend-list.component.html | |||
@@ -0,0 +1,21 @@ | |||
1 | <table class="table table-hover"> | ||
2 | <thead> | ||
3 | <tr> | ||
4 | <th>Url</th> | ||
5 | </tr> | ||
6 | </thead> | ||
7 | |||
8 | <tbody> | ||
9 | <tr *ngFor="let friend of friends"> | ||
10 | <td>{{ friend.url }}</td> | ||
11 | </tr> | ||
12 | </tbody> | ||
13 | </table> | ||
14 | |||
15 | <a class="add-user btn btn-danger pull-left" (click)="quitFriends()"> | ||
16 | Quit friends | ||
17 | </a> | ||
18 | |||
19 | <a class="add-user btn btn-success pull-right" (click)="makeFriends()"> | ||
20 | Make friends | ||
21 | </a> | ||
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.scss b/client/src/app/admin/friends/friend-list/friend-list.component.scss new file mode 100644 index 000000000..cb597e12b --- /dev/null +++ b/client/src/app/admin/friends/friend-list/friend-list.component.scss | |||
@@ -0,0 +1,3 @@ | |||
1 | table { | ||
2 | margin-bottom: 40px; | ||
3 | } | ||
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.ts b/client/src/app/admin/friends/friend-list/friend-list.component.ts new file mode 100644 index 000000000..bf66d3ff1 --- /dev/null +++ b/client/src/app/admin/friends/friend-list/friend-list.component.ts | |||
@@ -0,0 +1,46 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | ||
2 | |||
3 | import { Friend, FriendService } from '../shared'; | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-friend-list', | ||
7 | template: require('./friend-list.component.html'), | ||
8 | styles: [ require('./friend-list.component.scss') ] | ||
9 | }) | ||
10 | export class FriendListComponent implements OnInit { | ||
11 | friends: Friend[]; | ||
12 | |||
13 | constructor(private friendService: FriendService) { } | ||
14 | |||
15 | ngOnInit() { | ||
16 | this.friendService.getFriends().subscribe( | ||
17 | friends => this.friends = friends, | ||
18 | |||
19 | err => alert(err) | ||
20 | ); | ||
21 | } | ||
22 | |||
23 | makeFriends() { | ||
24 | this.friendService.makeFriends().subscribe( | ||
25 | status => { | ||
26 | if (status === 409) { | ||
27 | alert('Already made friends!'); | ||
28 | } else { | ||
29 | alert('Made friends!'); | ||
30 | } | ||
31 | }, | ||
32 | error => alert(error) | ||
33 | ); | ||
34 | } | ||
35 | |||
36 | quitFriends() { | ||
37 | if (!confirm('Are you sure?')) return; | ||
38 | |||
39 | this.friendService.quitFriends().subscribe( | ||
40 | status => { | ||
41 | alert('Quit friends!'); | ||
42 | }, | ||
43 | error => alert(error) | ||
44 | ); | ||
45 | } | ||
46 | } | ||
diff --git a/client/src/app/admin/friends/friend-list/index.ts b/client/src/app/admin/friends/friend-list/index.ts new file mode 100644 index 000000000..354c978a4 --- /dev/null +++ b/client/src/app/admin/friends/friend-list/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './friend-list.component'; | |||