diff options
author | Kim <1877318+kimsible@users.noreply.github.com> | 2020-04-15 15:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 15:35:41 +0200 |
commit | 437e8e06eb32ffe21111f0946115aae0e4c33381 (patch) | |
tree | c221f0c41b4d29de00f4a3318393c32a83b02fe5 /client/src/app/app.component.ts | |
parent | 45c14ae1b2884e75c6341117489ea39ae0e1a3bc (diff) | |
download | PeerTube-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.ts | 10 |
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 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core' |
2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
3 | import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router' | 3 | import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router' |
4 | import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' | 4 | import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' |
@@ -14,6 +14,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | |||
14 | import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' | 14 | import { POP_STATE_MODAL_DISMISS } from '@app/shared/misc/constants' |
15 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | 15 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' |
16 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' | 16 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' |
17 | import { CustomModalComponent } from '@app/modal/custom-modal.component' | ||
17 | import { ServerConfig, UserRole } from '@shared/models' | 18 | import { ServerConfig, UserRole } from '@shared/models' |
18 | import { User } from '@app/shared' | 19 | import { User } from '@app/shared' |
19 | import { InstanceService } from '@app/shared/instance/instance.service' | 20 | import { 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 | }) |
27 | export class AppComponent implements OnInit { | 28 | export 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 | } |