File
Implements
Index
Properties
|
|
Methods
|
|
HostListeners
|
|
HostListeners
window:popstate
|
Arguments : '$event'
|
window:popstate(event)
|
|
Methods
getDiscussionUrl
|
getDiscussionUrl()
|
|
|
navigateToPreviousPage
|
navigateToPreviousPage()
|
|
|
ngAfterViewInit
|
ngAfterViewInit()
|
|
|
ngOnDestroy
|
ngOnDestroy()
|
|
|
onPopState
|
onPopState(event)
|
Decorators :
@HostListener('window:popstate', ['$event'])
|
|
|
discussionUrl
|
Type : SafeResourceUrl
|
|
modal
|
Decorators :
@ViewChild('modal')
|
|
Public
sanitizer
|
Type : DomSanitizer
|
|
import { ConfigService } from '@sunbird/shared';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { LearnerService, UserService } from '@sunbird/core';
import { Component, OnInit, OnDestroy, HostListener, ViewChild, AfterViewInit } from '@angular/core';
import * as _ from 'lodash-es';
import { Location } from '@angular/common';
@Component({
selector: 'app-forum',
templateUrl: './forum.component.html',
styleUrls: ['./forum.component.scss']
})
export class ForumComponent implements OnInit, OnDestroy, AfterViewInit {
discussionUrl: SafeResourceUrl;
@ViewChild('modal')modal;
constructor(
public sanitizer: DomSanitizer, private activatedRoute: ActivatedRoute,
private location: Location, private config: ConfigService,
private learnerService: LearnerService, private userService: UserService) { }
@HostListener('window:popstate', ['$event'])
onPopState(event) {
this.closeModal();
}
ngOnInit() {
this.getDiscussionUrl();
}
ngAfterViewInit() {
document.body.className = 'o-y-auto';
}
getDiscussionUrl() {
const option = {
url: `${this.config.urlConFig.URLS.USER.GET_SESSION}/${this.userService.userid}`
};
this.learnerService.get(option).subscribe((data: any) => {
this.discussionUrl = this.sanitizer.bypassSecurityTrustResourceUrl(
`discussions/auth/sunbird-oidc/callback${data.id}&returnTo=/category/${_.get(this.activatedRoute.snapshot, 'queryParams.forumId')}`
);
});
}
navigateToPreviousPage() {
this.location.back();
}
closeModal() {
if (this.modal) {
this.modal.deny();
}
}
ngOnDestroy() {
this.closeModal();
}
}
<app-modal-wrapper [config]="{disableClose: true, size: 'large', panelClass: 'material-modal'}"
(dismiss)="navigateToPreviousPage()" #modal>
<ng-template sbModalContent>
<div class="sb-mat__modal">
<div mat-dialog-title class="mb-0"></div>
<div class="sb-mat__modal__content">
<iframe scrolling="no" [src]="discussionUrl"></iframe>
</div>
<mat-dialog-actions class="sb-mat__modal__actions"></mat-dialog-actions>
</div>
</ng-template>
</app-modal-wrapper>
@use "@project-sunbird/sb-styles/assets/mixins/mixins" as *;
::ng-deep {
.sb-modal .ui.modal.fullscreen .sb-modal-content {
height: 100vh;
padding: 0;
border-radius: 0;
overflow: hidden;
}
iframe {
width: 100%;
height: 100vh;
border: 0;
}
.sb-modal .ui.modal>.close {
color: var(--black);
background: var(--gray-0);
border-radius: 100%;
right: 1rem;
top: 1rem;
font-size: 1.25rem;
&:hover {
background: var(--black);
color: var(--white);
}
}
.o-y-auto {
overflow-y: auto;
}
}
Legend
Html element with directive