Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/+display/display.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div [ngClass]="{ 'col-lg-9': showAside(displayView, individual), 'col-lg-12': !showAside(displayView, individual) }">
<div class="row mt-2">
<div *ngIf="showLeftScan(displayView)" class="col-md-{{ getLeftScanColSize(displayView) }}" [innerHtml]="displayView.leftScanTemplateFunction(individual) | safeHtml"></div>
<div *ngIf="showMainContent(displayView)" class="col-md-{{ getMainContentColSize(displayView) }}" [innerHtml]="displayView.mainContentTemplateFunction(individual) | safeHtml"></div>
<div #mainContent *ngIf="showMainContent(displayView)" class="col-md-{{ getMainContentColSize(displayView) }}" [innerHtml]="displayView.mainContentTemplateFunction(individual) | safeHtml"></div>
<div *ngIf="showRightScan(displayView)" class="col-md-{{ getRightScanColSize(displayView) }}" [innerHtml]="displayView.rightScanTemplateFunction(individual) | safeHtml"></div>
</div>
<div class="row mt-4 mb-4">
Expand Down
26 changes: 25 additions & 1 deletion src/app/+display/display.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { ChangeDetectionStrategy, Component, HostListener, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { MetaDefinition } from '@angular/platform-browser';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { Store, select } from '@ngrx/store';
Expand Down Expand Up @@ -334,4 +334,28 @@ export class DisplayComponent implements OnDestroy, OnInit {
return metaTags;
}

@HostListener('click', ['$event'])
public onMainContentClick(event: MouseEvent): void {
const target = event.target as HTMLElement;

if (!target) return;

const toggleBtn = target.closest<HTMLButtonElement>('.toggle-btn');

if (!toggleBtn) return;

const container = toggleBtn.closest('.research-areas') as HTMLElement;

if (!container) return;

event.preventDefault();
event.stopPropagation();

const nextState = !(container.getAttribute('data-expanded') === 'true');

container.setAttribute('data-expanded', String(nextState));
toggleBtn.textContent = nextState ? 'Show less' : 'Show more';
toggleBtn.setAttribute('aria-expanded', String(nextState));
}

}