Skip to content

Commit

Permalink
108588: Fix header ordering issues on community & collection pages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Dec 20, 2023
1 parent 038dd18 commit 989db14
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 30 deletions.
5 changes: 5 additions & 0 deletions src/app/browse-by/abstract-browse-by-type.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export abstract class AbstractBrowseByTypeComponent implements OnChanges, OnDest
*/
@Input() scope: string;

/**
* Display the h1 title in the section
*/
@Input() displayTitle = true;

scope$: BehaviorSubject<string> = new BehaviorSubject(undefined);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<div class="container">
<section class="comcol-page-browse-section">
<div class="browse-by-metadata w-100">
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
title="{{'browse.title' | translate:
{
field: 'browse.metadata.' + browseId | translate,
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '&quot;' + startsWith + '&quot;' }) : '',
value: (value)? '&quot;' + value + '&quot;': ''
} }}"
[objects$]="(items$ !== undefined)? items$ : browseEntries$"
[paginationConfig]="(currentPagination$ |async)"
[sortConfig]="(currentSort$ |async)"
[type]="startsWithType"
[startsWithOptions]="startsWithOptions"
(prev)="goPrev()"
(next)="goNext()">
</ds-browse-by>
<ds-themed-loading *ngIf="!startsWithOptions" message="{{'loading.browse-by-page' | translate}}"></ds-themed-loading>
</div>
</section>
</div>
<section class="comcol-page-browse-section">
<div class="browse-by-metadata w-100">
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
title="{{'browse.title' | translate:{
field: 'browse.metadata.' + browseId | translate,
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '&quot;' + startsWith + '&quot;' }) : '',
value: (value)? '&quot;' + value + '&quot;': ''
} }}"
[displayTitle]="displayTitle"
[objects$]="(items$ !== undefined)? items$ : browseEntries$"
[paginationConfig]="(currentPagination$ |async)"
[sortConfig]="(currentSort$ |async)"
[type]="startsWithType"
[startsWithOptions]="startsWithOptions"
(prev)="goPrev()"
(next)="goNext()">
</ds-browse-by>
<ds-themed-loading *ngIf="!startsWithOptions"
message="{{'loading.browse-by-page' | translate}}"></ds-themed-loading>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<ds-browse-by-switcher [browseByType]="browseByType$ | async">
</ds-browse-by-switcher>
<div class="container">
<ds-browse-by-switcher [browseByType]="browseByType$ | async">
</ds-browse-by-switcher>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class BrowseBySwitcherComponent extends AbstractComponentLoaderComponent<

@Input() browseByType: BrowseByDataType;

@Input() displayTitle: boolean;

@Input() scope: string;

protected inputNamesDependentForComponent: (keyof this & string)[] = [
Expand All @@ -23,6 +25,7 @@ export class BrowseBySwitcherComponent extends AbstractComponentLoaderComponent<
protected inputNames: (keyof this & string)[] = [
...this.inputNames,
'browseByType',
'displayTitle',
'scope',
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<div class="container">
<section>
<h1 *ngIf="displayTitle">
{{ ('browse.title') | translate:{
field: 'browse.metadata.' + vocabularyName | translate,
startsWith: '',
value: '',
} }}
</h1>
<div class="mb-3">
<ds-vocabulary-treeview [vocabularyOptions]=vocabularyOptions
[multiSelect]="true"
Expand All @@ -11,4 +18,4 @@
[queryParams]="queryParams"
[queryParamsHandling]="'merge'">
{{ 'browse.taxonomy.button' | translate }}</a>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngVar="(subCollectionsRDObs | async) as subCollectionsRD">
<div *ngIf="subCollectionsRD?.hasSucceeded && subCollectionsRD?.payload.totalElements > 0" @fadeIn>
<h2>{{'community.sub-collection-list.head' | translate}}</h2>
<h3>{{'community.sub-collection-list.head' | translate}}</h3>
<ds-viewable-collection
[config]="config"
[sortConfig]="sortConfig"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngVar="(subCommunitiesRDObs | async) as subCommunitiesRD">
<div *ngIf="subCommunitiesRD?.hasSucceeded && subCommunitiesRD?.payload.totalElements > 0" @fadeIn>
<h2>{{'community.sub-community-list.head' | translate}}</h2>
<h3>{{'community.sub-community-list.head' | translate}}</h3>
<ds-viewable-collection
[config]="config"
[sortConfig]="sortConfig"
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/browse-by/browse-by.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ng-container *ngVar="(objects$ | async) as objects">
<h3>{{title | translate}}</h3>
<h1 *ngIf="displayTitle">{{title | translate}}</h1>
<ng-container *ngComponentOutlet="getStartsWithComponent(); injector: objectInjector;"></ng-container>
<div *ngIf="objects?.hasSucceeded && !objects?.isLoading && objects?.payload?.page.length > 0" @fadeIn>
<div *ngIf="shouldDisplayResetButton$ |async" class="mb-2 reset">
Expand Down
5 changes: 5 additions & 0 deletions src/app/shared/browse-by/browse-by.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export class BrowseByComponent implements OnInit, OnDestroy {
*/
@Input() title: string;

/**
* Whether the title should be displayed
*/
@Input() displayTitle = true;

/**
* The list of objects to display
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="comcol-browse-label h5">{{'browse.comcol.head' | translate}}</h2>
<h2 class="comcol-browse-label">{{'browse.comcol.head' | translate}}</h2>
<nav *ngIf="(allOptions$ | async) as allOptions" class="comcol-browse mb-4" aria-label="Browse Community or Collection">
<div class="d-none d-sm-block">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<ds-browse-by-switcher [browseByType]="browseByType$ | async"
[displayTitle]="false"
[scope]="scope$ | async">
</ds-browse-by-switcher>

0 comments on commit 989db14

Please sign in to comment.