From 65b247ddc75aa9f131af86dde21c8d958f7f4b39 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Aug 2018 16:01:54 +0200 Subject: Improve follow component routing --- .../src/app/+admin/follows/follows.component.html | 14 +++--- client/src/app/+admin/follows/follows.component.ts | 58 +--------------------- 2 files changed, 8 insertions(+), 64 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/follows.component.html b/client/src/app/+admin/follows/follows.component.html index 8eabb3392..21d477132 100644 --- a/client/src/app/+admin/follows/follows.component.html +++ b/client/src/app/+admin/follows/follows.component.html @@ -1,15 +1,13 @@
Manage follows
- +
- + \ No newline at end of file diff --git a/client/src/app/+admin/follows/follows.component.ts b/client/src/app/+admin/follows/follows.component.ts index b6f7715b3..1ec7e598b 100644 --- a/client/src/app/+admin/follows/follows.component.ts +++ b/client/src/app/+admin/follows/follows.component.ts @@ -1,62 +1,8 @@ -import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' -import { NavigationEnd, Router } from '@angular/router' -import { I18n } from '@ngx-translate/i18n-polyfill' -import { NgbTabset } from '@ng-bootstrap/ng-bootstrap' +import { Component } from '@angular/core' @Component({ templateUrl: './follows.component.html', styleUrls: [ './follows.component.scss' ] }) -export class FollowsComponent implements OnInit, AfterViewInit { - @ViewChild('followsMenuTabs') followsMenuTabs: NgbTabset - - links: { path: string, title: string }[] = [] - - constructor ( - private i18n: I18n, - private router: Router - ) { - this.links = [ - { - path: 'following-list', - title: this.i18n('Following') - }, - { - path: 'following-add', - title: this.i18n('Follow') - }, - { - path: 'followers-list', - title: this.i18n('Followers') - } - ] - } - - ngOnInit () { - this.router.events.subscribe( - event => { - if (event instanceof NavigationEnd) { - this.updateActiveTab() - } - } - ) - } - - ngAfterViewInit () { - // Avoid issue with change detector - setTimeout(() => this.updateActiveTab()) - } - - private updateActiveTab () { - const url = window.location.pathname - - for (let i = 0; i < this.links.length; i++) { - const path = this.links[i].path - - if (url.endsWith(path) === true) { - this.followsMenuTabs.select(path) - return - } - } - } +export class FollowsComponent { } -- cgit v1.2.3