aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+about
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/+about
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/+about')
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.html5
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.ts11
2 files changed, 10 insertions, 6 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html
index 043f63354..1df1ef2ad 100644
--- a/client/src/app/+about/about-instance/about-instance.component.html
+++ b/client/src/app/+about/about-instance/about-instance.component.html
@@ -96,9 +96,8 @@
96 </div> 96 </div>
97 97
98 <div class="col"> 98 <div class="col">
99 <div id="statistics" i18n class="middle-title"> 99 <div class="anchor" id="statistics"></div>
100 STATISTICS 100 <div i18n class="middle-title">STATISTICS</div>
101 </div>
102 <my-instance-statistics></my-instance-statistics> 101 <my-instance-statistics></my-instance-statistics>
103 </div> 102 </div>
104</div> 103</div>
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts
index c8c156105..e1809d7b7 100644
--- a/client/src/app/+about/about-instance/about-instance.component.ts
+++ b/client/src/app/+about/about-instance/about-instance.component.ts
@@ -1,17 +1,18 @@
1import { Component, OnInit, ViewChild } from '@angular/core' 1import { Component, OnInit, ViewChild, AfterViewChecked } from '@angular/core'
2import { Notifier, ServerService } from '@app/core' 2import { Notifier, ServerService } from '@app/core'
3import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' 3import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
4import { InstanceService } from '@app/shared/instance/instance.service' 4import { InstanceService } from '@app/shared/instance/instance.service'
5import { ServerConfig } from '@shared/models' 5import { ServerConfig } from '@shared/models'
6import { ActivatedRoute } from '@angular/router' 6import { ActivatedRoute } from '@angular/router'
7import { ResolverData } from './about-instance.resolver' 7import { ResolverData } from './about-instance.resolver'
8import { ViewportScroller } from '@angular/common'
8 9
9@Component({ 10@Component({
10 selector: 'my-about-instance', 11 selector: 'my-about-instance',
11 templateUrl: './about-instance.component.html', 12 templateUrl: './about-instance.component.html',
12 styleUrls: [ './about-instance.component.scss' ] 13 styleUrls: [ './about-instance.component.scss' ]
13}) 14})
14export class AboutInstanceComponent implements OnInit { 15export class AboutInstanceComponent implements OnInit, AfterViewChecked {
15 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent 16 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent
16 17
17 shortDescription = '' 18 shortDescription = ''
@@ -35,8 +36,8 @@ export class AboutInstanceComponent implements OnInit {
35 serverConfig: ServerConfig 36 serverConfig: ServerConfig
36 37
37 constructor ( 38 constructor (
39 private viewportScroller: ViewportScroller,
38 private route: ActivatedRoute, 40 private route: ActivatedRoute,
39 private notifier: Notifier,
40 private serverService: ServerService, 41 private serverService: ServerService,
41 private instanceService: InstanceService 42 private instanceService: InstanceService
42 ) {} 43 ) {}
@@ -72,6 +73,10 @@ export class AboutInstanceComponent implements OnInit {
72 this.html = await this.instanceService.buildHtml(about) 73 this.html = await this.instanceService.buildHtml(about)
73 } 74 }
74 75
76 ngAfterViewChecked () {
77 if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))
78 }
79
75 openContactModal () { 80 openContactModal () {
76 return this.contactAdminModal.show() 81 return this.contactAdminModal.show()
77 } 82 }