aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/follows.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 10:10:41 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit51548b31815c6f96f314ae96588a9adca150519d (patch)
treeb3298447b7ac128823016fdec92d083e07d9432e /client/src/app/+admin/follows/follows.component.ts
parent350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (diff)
downloadPeerTube-51548b31815c6f96f314ae96588a9adca150519d.tar.gz
PeerTube-51548b31815c6f96f314ae96588a9adca150519d.tar.zst
PeerTube-51548b31815c6f96f314ae96588a9adca150519d.zip
Add follow tabs
Following Follow Followers
Diffstat (limited to 'client/src/app/+admin/follows/follows.component.ts')
-rw-r--r--client/src/app/+admin/follows/follows.component.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/client/src/app/+admin/follows/follows.component.ts b/client/src/app/+admin/follows/follows.component.ts
new file mode 100644
index 000000000..97422a41b
--- /dev/null
+++ b/client/src/app/+admin/follows/follows.component.ts
@@ -0,0 +1,43 @@
1import { AfterViewInit, Component, ViewChild } from '@angular/core'
2import { TabsetComponent } from 'ngx-bootstrap/tabs'
3
4@Component({
5 templateUrl: './follows.component.html',
6 styleUrls: [ './follows.component.scss' ]
7})
8export class FollowsComponent implements AfterViewInit {
9 @ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent
10
11 links = [
12 {
13 path: 'following-list',
14 title: 'Following'
15 },
16 {
17 path: 'following-add',
18 title: 'Follow'
19 },
20 {
21 path: 'followers-list',
22 title: 'Followers'
23 }
24 ]
25
26 ngAfterViewInit () {
27 // Avoid issue with change detector
28 setTimeout(() => this.updateActiveTab())
29 }
30
31 private updateActiveTab () {
32 const url = window.location.pathname
33
34 for (let i = 0; i < this.links.length; i++) {
35 const path = this.links[i].path
36
37 if (url.endsWith(path) === true) {
38 this.followsMenuTabs.tabs[i].active = true
39 return
40 }
41 }
42 }
43}