]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix terms/code of conduct link toggle
authorChocobozzz <me@florianbigard.com>
Wed, 12 Jul 2023 08:22:43 +0000 (10:22 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 12 Jul 2023 08:22:43 +0000 (10:22 +0200)
client/src/app/+login/login.component.html
client/src/app/+login/login.component.ts
client/src/app/+signup/+register/register.component.html
client/src/app/+signup/+register/register.component.ts
client/src/app/shared/shared-instance/instance-about-accordion.component.html
client/src/app/shared/shared-instance/instance-about-accordion.component.ts

index 8ccc7361797292c720dd35a5d310c23438e4e00e..5d267f168e9b6cc813e17b10ec8a574ac73c9825 100644 (file)
 
       <div #instanceInformation class="instance-information">
         <my-instance-about-accordion
+          #instanceAboutAccordion
           [displayInstanceName]="false"
           (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
           pluginScope="login" pluginHook="filter:login.instance-about-plugin-panels.create.result"
index a414a21210b7ba4d2440fd3ccc845662ca69dbfe..e486df61dd4bac37bb3b9573de2b5446be97718f 100644 (file)
@@ -22,6 +22,7 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
 
   @ViewChild('forgotPasswordModal', { static: true }) forgotPasswordModal: ElementRef
   @ViewChild('otpTokenInput') otpTokenInput: InputTextComponent
+  @ViewChild('instanceAboutAccordion') instanceAboutAccordion: InstanceAboutAccordionComponent
 
   accordion: NgbAccordionDirective
   error: string = null
@@ -70,8 +71,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni
   onTermsClick (event: Event, instanceInformation: HTMLElement) {
     event.preventDefault()
 
-    if (this.accordion) {
-      this.accordion.expand('terms')
+    if (this.instanceAboutAccordion) {
+      this.instanceAboutAccordion.expandTerms()
       instanceInformation.scrollIntoView({ behavior: 'smooth' })
     }
   }
index 71bca63e3b4b37bedf97a24643d1a4538ae9ecf0..23adee02d8895dd38f5ce4cddb02145e3256e2bc 100644 (file)
@@ -43,6 +43,7 @@
           </my-signup-step-title>
 
           <my-instance-about-accordion
+            #instanceAboutAccordion
             [displayInstanceName]="false"
             (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"
             pluginScope="signup" pluginHook="filter:signup.instance-about-plugin-panels.create.result"
index c17a3f380aedee1d1f8c6e2cf69d1fd2321e81b8..be51c36d1c0039795f9bd27e8a849c50c54fb6f4 100644 (file)
@@ -5,7 +5,6 @@ import { ActivatedRoute } from '@angular/router'
 import { AuthService } from '@app/core'
 import { HooksService } from '@app/core/plugins/hooks.service'
 import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance'
-import { NgbAccordionDirective } from '@ng-bootstrap/ng-bootstrap'
 import { UserRegister } from '@shared/models'
 import { ServerConfig } from '@shared/models/server'
 import { SignupService } from '../shared/signup.service'
@@ -17,8 +16,7 @@ import { SignupService } from '../shared/signup.service'
 })
 export class RegisterComponent implements OnInit {
   @ViewChild('lastStep') lastStep: CdkStep
-
-  accordion: NgbAccordionDirective
+  @ViewChild('instanceAboutAccordion') instanceAboutAccordion: InstanceAboutAccordionComponent
 
   signupError: string
   signupSuccess = false
@@ -121,15 +119,14 @@ export class RegisterComponent implements OnInit {
   }
 
   onTermsClick () {
-    if (this.accordion) this.accordion.toggle('terms')
+    this.instanceAboutAccordion.expandTerms()
   }
 
   onCodeOfConductClick () {
-    if (this.accordion) this.accordion.toggle('code-of-conduct')
+    this.instanceAboutAccordion.expandCodeOfConduct()
   }
 
   onInstanceAboutAccordionInit (instanceAboutAccordion: InstanceAboutAccordionComponent) {
-    this.accordion = instanceAboutAccordion.accordion
     this.aboutHtml = instanceAboutAccordion.aboutHtml
   }
 
index 5c679685b5f9d2efb945754df464db862970edce..5d27bc437ce992020ca748c3a021fc0c39036695 100644 (file)
@@ -3,7 +3,7 @@
 <div *ngIf="displayInstanceShortDescription" class="instance-short-description ellipsis-multiline-3">{{ about?.instance.shortDescription }}</div>
 
 <div ngbAccordion #accordion="ngbAccordion" [closeOthers]="true">
-  <div ngbAccordionItem *ngIf="panels.features" id="instance-features">
+  <div ngbAccordionItem="instance-features" *ngIf="panels.features">
     <div ngbAccordionHeader>
       <button ngbAccordionButton>
         <my-global-icon iconName="playlists"></my-global-icon>
@@ -53,7 +53,7 @@
       </div>
     </div>
 
-    <div ngbAccordionItem *ngIf="termsPanel" id="terms">
+    <div ngbAccordionItem="terms" *ngIf="termsPanel">
       <div ngbAccordionHeader>
         <button ngbAccordionButton>
           <my-global-icon iconName="playlists"></my-global-icon>
@@ -71,7 +71,7 @@
       </div>
     </div>
 
-    <div ngbAccordionItem *ngIf="moderationPanel" id="moderation-information">
+    <div ngbAccordionItem="moderation-information" *ngIf="moderationPanel">
       <div ngbAccordionHeader>
         <button ngbAccordionButton>
           <my-global-icon iconName="playlists"></my-global-icon>
@@ -89,7 +89,7 @@
       </div>
     </div>
 
-    <div ngbAccordionItem *ngIf="codeOfConductPanel" id="code-of-conduct">
+    <div ngbAccordionItem="code-of-conduct" *ngIf="codeOfConductPanel">
       <div ngbAccordionHeader>
         <button ngbAccordionButton>
           <my-global-icon iconName="playlists"></my-global-icon>
index e299a64a3edff41e8e8b5d986eb652bae0b4ea24..a7c521876095a625b394e7191ac33309267d3210 100644 (file)
@@ -62,6 +62,14 @@ export class InstanceAboutAccordionComponent implements OnInit {
     this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook)
   }
 
+  expandTerms () {
+    this.accordion.expand('terms')
+  }
+
+  expandCodeOfConduct () {
+    this.accordion.expand('code-of-conduct')
+  }
+
   getAdministratorsPanel () {
     if (!this.about) return false
     if (!this.panels.administrators) return false