aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
authorKim <1877318+kimsible@users.noreply.github.com>2020-04-15 15:35:41 +0200
committerGitHub <noreply@github.com>2020-04-15 15:35:41 +0200
commit437e8e06eb32ffe21111f0946115aae0e4c33381 (patch)
treec221f0c41b4d29de00f4a3318393c32a83b02fe5 /client/src/app/app.component.ts
parent45c14ae1b2884e75c6341117489ea39ae0e1a3bc (diff)
downloadPeerTube-437e8e06eb32ffe21111f0946115aae0e4c33381.tar.gz
PeerTube-437e8e06eb32ffe21111f0946115aae0e4c33381.tar.zst
PeerTube-437e8e06eb32ffe21111f0946115aae0e4c33381.zip
Add custom modal to plugin helpers (#2631)
* Add custom modal component * Add custom modal to app and plugins helpers * Fixes custom modal component * Add doc for custom modal * Fix newline end of file html and scss files * Move my-custom-modal component outside component for UserLoggedIn modals * Move initializeCustomModal to ngAfterViewInit() * Wrap events and conditionnals * Replace ng-show with ngIf* * Add modalRef to open only one modal + onCloseClick * Refacto + Fix access methods of custom modal * Fix methods names custom-modal.component * Fix implement AfterViewInit & no default boolean Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 1d077646c..12c0efd8a 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,4 +1,4 @@
1import { Component, OnInit, ViewChild } from '@angular/core' 1import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
3import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router' 3import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router'
4import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' 4import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core'
@@ -14,6 +14,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
14import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' 14import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants'
15import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' 15import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
16import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' 16import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
17import { CustomModalComponent } from '@app/modal/custom-modal.component'
17import { ServerConfig, UserRole } from '@shared/models' 18import { ServerConfig, UserRole } from '@shared/models'
18import { User } from '@app/shared' 19import { User } from '@app/shared'
19import { InstanceService } from '@app/shared/instance/instance.service' 20import { InstanceService } from '@app/shared/instance/instance.service'
@@ -24,9 +25,10 @@ import { MenuService } from './core/menu/menu.service'
24 templateUrl: './app.component.html', 25 templateUrl: './app.component.html',
25 styleUrls: [ './app.component.scss' ] 26 styleUrls: [ './app.component.scss' ]
26}) 27})
27export class AppComponent implements OnInit { 28export class AppComponent implements OnInit, AfterViewInit {
28 @ViewChild('welcomeModal') welcomeModal: WelcomeModalComponent 29 @ViewChild('welcomeModal') welcomeModal: WelcomeModalComponent
29 @ViewChild('instanceConfigWarningModal') instanceConfigWarningModal: InstanceConfigWarningModalComponent 30 @ViewChild('instanceConfigWarningModal') instanceConfigWarningModal: InstanceConfigWarningModalComponent
31 @ViewChild('customModal') customModal: CustomModalComponent
30 32
31 customCSS: SafeHtml 33 customCSS: SafeHtml
32 34
@@ -87,6 +89,10 @@ export class AppComponent implements OnInit {
87 this.openModalsIfNeeded() 89 this.openModalsIfNeeded()
88 } 90 }
89 91
92 ngAfterViewInit () {
93 this.pluginService.initializeCustomModal(this.customModal)
94 }
95
90 isUserLoggedIn () { 96 isUserLoggedIn () {
91 return this.authService.isLoggedIn() 97 return this.authService.isLoggedIn()
92 } 98 }