aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-12 10:22:43 +0200
committerChocobozzz <me@florianbigard.com>2023-07-12 10:22:43 +0200
commited22eaabfac0d53550cd838c12b7d80e01bcc7b5 (patch)
tree8b817a5ca9d53951acda1661c215a90dced755f2
parentd98909f69070c81e87da723e414d91c6a2a6f343 (diff)
downloadPeerTube-ed22eaabfac0d53550cd838c12b7d80e01bcc7b5.tar.gz
PeerTube-ed22eaabfac0d53550cd838c12b7d80e01bcc7b5.tar.zst
PeerTube-ed22eaabfac0d53550cd838c12b7d80e01bcc7b5.zip
Fix terms/code of conduct link toggle
-rw-r--r--client/src/app/+login/login.component.html1
-rw-r--r--client/src/app/+login/login.component.ts5
-rw-r--r--client/src/app/+signup/+register/register.component.html1
-rw-r--r--client/src/app/+signup/+register/register.component.ts9
-rw-r--r--client/src/app/shared/shared-instance/instance-about-accordion.component.html8
-rw-r--r--client/src/app/shared/shared-instance/instance-about-accordion.component.ts8
6 files changed, 20 insertions, 12 deletions
diff --git a/client/src/app/+login/login.component.html b/client/src/app/+login/login.component.html
index 8ccc73617..5d267f168 100644
--- a/client/src/app/+login/login.component.html
+++ b/client/src/app/+login/login.component.html
@@ -105,6 +105,7 @@
105 105
106 <div #instanceInformation class="instance-information"> 106 <div #instanceInformation class="instance-information">
107 <my-instance-about-accordion 107 <my-instance-about-accordion
108 #instanceAboutAccordion
108 [displayInstanceName]="false" 109 [displayInstanceName]="false"
109 (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels" 110 (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
110 pluginScope="login" pluginHook="filter:login.instance-about-plugin-panels.create.result" 111 pluginScope="login" pluginHook="filter:login.instance-about-plugin-panels.create.result"
diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts
index a414a2121..e486df61d 100644
--- a/client/src/app/+login/login.component.ts
+++ b/client/src/app/+login/login.component.ts
@@ -22,6 +22,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
22 22
23 @ViewChild('forgotPasswordModal', { static: true }) forgotPasswordModal: ElementRef 23 @ViewChild('forgotPasswordModal', { static: true }) forgotPasswordModal: ElementRef
24 @ViewChild('otpTokenInput') otpTokenInput: InputTextComponent 24 @ViewChild('otpTokenInput') otpTokenInput: InputTextComponent
25 @ViewChild('instanceAboutAccordion') instanceAboutAccordion: InstanceAboutAccordionComponent
25 26
26 accordion: NgbAccordionDirective 27 accordion: NgbAccordionDirective
27 error: string = null 28 error: string = null
@@ -70,8 +71,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
70 onTermsClick (event: Event, instanceInformation: HTMLElement) { 71 onTermsClick (event: Event, instanceInformation: HTMLElement) {
71 event.preventDefault() 72 event.preventDefault()
72 73
73 if (this.accordion) { 74 if (this.instanceAboutAccordion) {
74 this.accordion.expand('terms') 75 this.instanceAboutAccordion.expandTerms()
75 instanceInformation.scrollIntoView({ behavior: 'smooth' }) 76 instanceInformation.scrollIntoView({ behavior: 'smooth' })
76 } 77 }
77 } 78 }
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html
index 71bca63e3..23adee02d 100644
--- a/client/src/app/+signup/+register/register.component.html
+++ b/client/src/app/+signup/+register/register.component.html
@@ -43,6 +43,7 @@
43 </my-signup-step-title> 43 </my-signup-step-title>
44 44
45 <my-instance-about-accordion 45 <my-instance-about-accordion
46 #instanceAboutAccordion
46 [displayInstanceName]="false" 47 [displayInstanceName]="false"
47 (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels" 48 (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
48 pluginScope="signup" pluginHook="filter:signup.instance-about-plugin-panels.create.result" 49 pluginScope="signup" pluginHook="filter:signup.instance-about-plugin-panels.create.result"
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts
index c17a3f380..be51c36d1 100644
--- a/client/src/app/+signup/+register/register.component.ts
+++ b/client/src/app/+signup/+register/register.component.ts
@@ -5,7 +5,6 @@ import { ActivatedRoute } from '@angular/router'
5import { AuthService } from '@app/core' 5import { AuthService } from '@app/core'
6import { HooksService } from '@app/core/plugins/hooks.service' 6import { HooksService } from '@app/core/plugins/hooks.service'
7import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance' 7import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance'
8import { NgbAccordionDirective } from '@ng-bootstrap/ng-bootstrap'
9import { UserRegister } from '@shared/models' 8import { UserRegister } from '@shared/models'
10import { ServerConfig } from '@shared/models/server' 9import { ServerConfig } from '@shared/models/server'
11import { SignupService } from '../shared/signup.service' 10import { SignupService } from '../shared/signup.service'
@@ -17,8 +16,7 @@ import { SignupService } from '../shared/signup.service'
17}) 16})
18export class RegisterComponent implements OnInit { 17export class RegisterComponent implements OnInit {
19 @ViewChild('lastStep') lastStep: CdkStep 18 @ViewChild('lastStep') lastStep: CdkStep
20 19 @ViewChild('instanceAboutAccordion') instanceAboutAccordion: InstanceAboutAccordionComponent
21 accordion: NgbAccordionDirective
22 20
23 signupError: string 21 signupError: string
24 signupSuccess = false 22 signupSuccess = false
@@ -121,15 +119,14 @@ export class RegisterComponent implements OnInit {
121 } 119 }
122 120
123 onTermsClick () { 121 onTermsClick () {
124 if (this.accordion) this.accordion.toggle('terms') 122 this.instanceAboutAccordion.expandTerms()
125 } 123 }
126 124
127 onCodeOfConductClick () { 125 onCodeOfConductClick () {
128 if (this.accordion) this.accordion.toggle('code-of-conduct') 126 this.instanceAboutAccordion.expandCodeOfConduct()
129 } 127 }
130 128
131 onInstanceAboutAccordionInit (instanceAboutAccordion: InstanceAboutAccordionComponent) { 129 onInstanceAboutAccordionInit (instanceAboutAccordion: InstanceAboutAccordionComponent) {
132 this.accordion = instanceAboutAccordion.accordion
133 this.aboutHtml = instanceAboutAccordion.aboutHtml 130 this.aboutHtml = instanceAboutAccordion.aboutHtml
134 } 131 }
135 132
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.html b/client/src/app/shared/shared-instance/instance-about-accordion.component.html
index 5c679685b..5d27bc437 100644
--- a/client/src/app/shared/shared-instance/instance-about-accordion.component.html
+++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.html
@@ -3,7 +3,7 @@
3<div *ngIf="displayInstanceShortDescription" class="instance-short-description ellipsis-multiline-3">{{ about?.instance.shortDescription }}</div> 3<div *ngIf="displayInstanceShortDescription" class="instance-short-description ellipsis-multiline-3">{{ about?.instance.shortDescription }}</div>
4 4
5<div ngbAccordion #accordion="ngbAccordion" [closeOthers]="true"> 5<div ngbAccordion #accordion="ngbAccordion" [closeOthers]="true">
6 <div ngbAccordionItem *ngIf="panels.features" id="instance-features"> 6 <div ngbAccordionItem="instance-features" *ngIf="panels.features">
7 <div ngbAccordionHeader> 7 <div ngbAccordionHeader>
8 <button ngbAccordionButton> 8 <button ngbAccordionButton>
9 <my-global-icon iconName="playlists"></my-global-icon> 9 <my-global-icon iconName="playlists"></my-global-icon>
@@ -53,7 +53,7 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 55
56 <div ngbAccordionItem *ngIf="termsPanel" id="terms"> 56 <div ngbAccordionItem="terms" *ngIf="termsPanel">
57 <div ngbAccordionHeader> 57 <div ngbAccordionHeader>
58 <button ngbAccordionButton> 58 <button ngbAccordionButton>
59 <my-global-icon iconName="playlists"></my-global-icon> 59 <my-global-icon iconName="playlists"></my-global-icon>
@@ -71,7 +71,7 @@
71 </div> 71 </div>
72 </div> 72 </div>
73 73
74 <div ngbAccordionItem *ngIf="moderationPanel" id="moderation-information"> 74 <div ngbAccordionItem="moderation-information" *ngIf="moderationPanel">
75 <div ngbAccordionHeader> 75 <div ngbAccordionHeader>
76 <button ngbAccordionButton> 76 <button ngbAccordionButton>
77 <my-global-icon iconName="playlists"></my-global-icon> 77 <my-global-icon iconName="playlists"></my-global-icon>
@@ -89,7 +89,7 @@
89 </div> 89 </div>
90 </div> 90 </div>
91 91
92 <div ngbAccordionItem *ngIf="codeOfConductPanel" id="code-of-conduct"> 92 <div ngbAccordionItem="code-of-conduct" *ngIf="codeOfConductPanel">
93 <div ngbAccordionHeader> 93 <div ngbAccordionHeader>
94 <button ngbAccordionButton> 94 <button ngbAccordionButton>
95 <my-global-icon iconName="playlists"></my-global-icon> 95 <my-global-icon iconName="playlists"></my-global-icon>
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
index e299a64a3..a7c521876 100644
--- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
+++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
@@ -62,6 +62,14 @@ export class InstanceAboutAccordionComponent implements OnInit {
62 this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook) 62 this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook)
63 } 63 }
64 64
65 expandTerms () {
66 this.accordion.expand('terms')
67 }
68
69 expandCodeOfConduct () {
70 this.accordion.expand('code-of-conduct')
71 }
72
65 getAdministratorsPanel () { 73 getAdministratorsPanel () {
66 if (!this.about) return false 74 if (!this.about) return false
67 if (!this.panels.administrators) return false 75 if (!this.panels.administrators) return false