aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-03-11 19:38:17 +0100
committerRigel Kent <sendmemail@rigelk.eu>2020-03-11 19:38:17 +0100
commit45e0d6697c107d77dce73d8e354867dc1959741d (patch)
tree6acff1e8fdc59ed396a3da4439461d4a475ee8b5 /client/src/app/+my-account
parent111fdc267b36201cf1be1fdf91017005102b4a5e (diff)
downloadPeerTube-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.html1
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.ts10
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 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit, AfterViewChecked } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier } from '@app/core'
3import { BytesPipe } from 'ngx-pipes' 3import { BytesPipe } from 'ngx-pipes'
4import { AuthService } from '../../core' 4import { AuthService } from '../../core'
5import { User } from '../../shared' 5import { User } from '../../shared'
6import { UserService } from '../../shared/users' 6import { UserService } from '../../shared/users'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { 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})
14export class MyAccountSettingsComponent implements OnInit { 15export 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(