diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-03-11 19:38:17 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-03-11 19:38:17 +0100 |
commit | 45e0d6697c107d77dce73d8e354867dc1959741d (patch) | |
tree | 6acff1e8fdc59ed396a3da4439461d4a475ee8b5 /client/src/app/+my-account | |
parent | 111fdc267b36201cf1be1fdf91017005102b4a5e (diff) | |
download | PeerTube-45e0d6697c107d77dce73d8e354867dc1959741d.tar.gz PeerTube-45e0d6697c107d77dce73d8e354867dc1959741d.tar.zst PeerTube-45e0d6697c107d77dce73d8e354867dc1959741d.zip |
Properly scroll to anchors in links, especially in admin config
Diffstat (limited to 'client/src/app/+my-account')
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-settings.component.html | 1 | ||||
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index 164afb4ea..87296bc19 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | <div class="form-row mt-5"> <!-- notifications grid --> | 35 | <div class="form-row mt-5"> <!-- notifications grid --> |
36 | <div class="form-group col-12 col-lg-4 col-xl-3"> | 36 | <div class="form-group col-12 col-lg-4 col-xl-3"> |
37 | <div class="anchor" id="notifications"></div> <!-- notifications anchor --> | ||
37 | <div i18n class="account-title">NOTIFICATIONS</div> | 38 | <div i18n class="account-title">NOTIFICATIONS</div> |
38 | </div> | 39 | </div> |
39 | 40 | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index e314cdbea..ada98401c 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -1,17 +1,18 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, AfterViewChecked } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { BytesPipe } from 'ngx-pipes' | 3 | import { BytesPipe } from 'ngx-pipes' |
4 | import { AuthService } from '../../core' | 4 | import { AuthService } from '../../core' |
5 | import { User } from '../../shared' | 5 | import { User } from '../../shared' |
6 | import { UserService } from '../../shared/users' | 6 | import { UserService } from '../../shared/users' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { ViewportScroller } from '@angular/common' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-account-settings', | 11 | selector: 'my-account-settings', |
11 | templateUrl: './my-account-settings.component.html', | 12 | templateUrl: './my-account-settings.component.html', |
12 | styleUrls: [ './my-account-settings.component.scss' ] | 13 | styleUrls: [ './my-account-settings.component.scss' ] |
13 | }) | 14 | }) |
14 | export class MyAccountSettingsComponent implements OnInit { | 15 | export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { |
15 | user: User = null | 16 | user: User = null |
16 | 17 | ||
17 | userVideoQuota = '0' | 18 | userVideoQuota = '0' |
@@ -21,6 +22,7 @@ export class MyAccountSettingsComponent implements OnInit { | |||
21 | userVideoQuotaUsedDaily = 0 | 22 | userVideoQuotaUsedDaily = 0 |
22 | 23 | ||
23 | constructor ( | 24 | constructor ( |
25 | private viewportScroller: ViewportScroller, | ||
24 | private userService: UserService, | 26 | private userService: UserService, |
25 | private authService: AuthService, | 27 | private authService: AuthService, |
26 | private notifier: Notifier, | 28 | private notifier: Notifier, |
@@ -57,6 +59,10 @@ export class MyAccountSettingsComponent implements OnInit { | |||
57 | }) | 59 | }) |
58 | } | 60 | } |
59 | 61 | ||
62 | ngAfterViewChecked () { | ||
63 | if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) | ||
64 | } | ||
65 | |||
60 | onAvatarChange (formData: FormData) { | 66 | onAvatarChange (formData: FormData) { |
61 | this.userService.changeAvatar(formData) | 67 | this.userService.changeAvatar(formData) |
62 | .subscribe( | 68 | .subscribe( |