adjusted view for subject classifications
This commit is contained in:
@@ -27,17 +27,41 @@
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
<ng-template #detailRowTmp let-element>
|
||||
<div class="classification-container">
|
||||
@for (classification of element.subject_classifications; track $index) {
|
||||
<p>
|
||||
{{ classification.wissenschaftsbereich || '-' }}
|
||||
→ {{ classification.fachkollegium || '-' }} →
|
||||
{{ classification.fachgebiet || '-' }} →
|
||||
{{ classification.fach || '-' }}
|
||||
</p>
|
||||
<ng-template #detailRowTmp let-project>
|
||||
@let classifications = getProjectClassifications(project);
|
||||
@let isClassificationsExpanded = isProjectClassificationsExpanded(project);
|
||||
@let visibleClassifications =
|
||||
isClassificationsExpanded ? classifications : classifications.slice(0, 3);
|
||||
<div
|
||||
class="classification-tags"
|
||||
aria-label="Fachsystematik"
|
||||
style="padding: 0.5rem 0.5rem">
|
||||
@for (classification of visibleClassifications; track $index) {
|
||||
<span
|
||||
class="publication-institution-tag classification-tag"
|
||||
[matTooltip]="getClassificationTooltipText(classification)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getClassificationTooltipText(classification)">
|
||||
<mat-icon class="institution-icon">category</mat-icon>
|
||||
<span class="institution-name">{{
|
||||
getClassificationFullChain(classification)
|
||||
}}</span>
|
||||
</span>
|
||||
} @empty {
|
||||
<span>-</span>
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (classifications.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="isClassificationsExpanded"
|
||||
(click)="toggleProjectClassificationsExpansion(project)">
|
||||
{{
|
||||
isClassificationsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (classifications.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
|
||||
.topic-chips,
|
||||
.institution-tags,
|
||||
.classification-tags,
|
||||
.author-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -163,8 +164,16 @@
|
||||
// Classification container
|
||||
// ------------------------
|
||||
|
||||
.classification-container {
|
||||
max-width: 200px;
|
||||
.classification-tag {
|
||||
max-width: 280px;
|
||||
cursor: default; // not clickable/filterable, unlike author/institution tags
|
||||
|
||||
.institution-name {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
|
||||
@@ -360,4 +360,39 @@ export class DfgProjectTableComponent implements OnInit {
|
||||
|
||||
return this.expandedProjectTopicsId.includes(project.id);
|
||||
}
|
||||
expandedProjectClassificationsId: string[] = [];
|
||||
//classifications
|
||||
getProjectClassifications(project: DfgProjectSummary): any[] {
|
||||
return project.subject_classifications ?? [];
|
||||
}
|
||||
|
||||
isProjectClassificationsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectClassificationsId.includes(project.id);
|
||||
}
|
||||
|
||||
toggleProjectClassificationsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectClassificationsId.includes(project.id)) {
|
||||
this.expandedProjectClassificationsId =
|
||||
this.expandedProjectClassificationsId.filter((id) => id !== project.id);
|
||||
} else {
|
||||
this.expandedProjectClassificationsId.push(project.id);
|
||||
}
|
||||
}
|
||||
|
||||
getClassificationFullChain(classification: any): string {
|
||||
return [
|
||||
classification.wissenschaftsbereich || '-',
|
||||
classification.fachkollegium || '-',
|
||||
classification.fachgebiet || '-',
|
||||
classification.fach || '-',
|
||||
].join(' → ');
|
||||
}
|
||||
|
||||
getClassificationTooltipText(classification: any): string {
|
||||
return this.getClassificationFullChain(classification);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user