Skip to content

Commit ff03161

Browse files
authored
Merge pull request #219 from TAMULib/dca-sprint5-216-merge
Issue #216: Add conditional search result header level
2 parents c0dcde2 + 52f6739 commit ff03161

File tree

6 files changed

+149
-2
lines changed

6 files changed

+149
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- TAMU Customization - search page single h1 -->
2+
<h1 class="sr-only">{{ 'search.page.heading' | translate }}</h1>
3+
<!-- END TAMU Customization - search page single h1 -->
4+
<!-- TAMU Customization - search page complete heading structure -->
5+
<h2 class="sr-only">{{ 'search.page.heading' | translate }}</h2>
6+
<!-- END TAMU Customization - search page complete heading structure -->
7+
<ds-search [showCsvExport]="true" [trackStatistics]="true" />
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Component } from '@angular/core';
2+
import { TranslateModule } from '@ngx-translate/core';
3+
4+
import { SearchConfigurationService } from '../../../../app/core/shared/search/search-configuration.service';
5+
import { SEARCH_CONFIG_SERVICE } from '../../../../app/my-dspace-page/my-dspace-configuration.service';
6+
import { SearchPageComponent as BaseComponent } from '../../../../app/search-page/search-page.component';
7+
import { ThemedSearchComponent } from '../../../../app/shared/search/themed-search.component';
8+
9+
@Component({
10+
selector: 'ds-themed-search-page',
11+
// styleUrls: ['./search-page.component.scss'],
12+
templateUrl: './search-page.component.html',
13+
providers: [
14+
{
15+
provide: SEARCH_CONFIG_SERVICE,
16+
useClass: SearchConfigurationService,
17+
},
18+
],
19+
standalone: true,
20+
imports: [
21+
TranslateModule,
22+
ThemedSearchComponent,
23+
],
24+
})
25+
export class SearchPageComponent extends BaseComponent {
26+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@if ((activeFilters$ | async).length > 0 && (appliedFilters$ | async).length === 0) {
2+
<div class="row">
3+
<div class="col-12">
4+
<div class="filters-badge-skeleton-container">
5+
<div class="filter-badge-skeleton">
6+
<ngx-skeleton-loader [count]="(activeFilters$ | async).length" />
7+
</div>
8+
</div>
9+
</div>
10+
</div>
11+
}
12+
13+
<div class="d-flex justify-content-between">
14+
<!-- TAMU Customization - single h1 on search page -->
15+
<!--
16+
@if (!disableHeader) {
17+
<h1>{{ (configuration ? configuration + '.search.results.head' : 'search.results.head') | translate }}</h1>
18+
}
19+
-->
20+
<h2 [ngClass]="{ 'sr-only' : disableHeader }">{{ (configuration ? configuration + '.search.results.head' : 'search.results.head') | translate }}</h2>
21+
<!-- END TAMU Customization - single h1 on search page -->
22+
@if (showCsvExport) {
23+
<ds-search-export-csv [searchConfig]="searchConfig" [total]="searchResults?.payload?.totalElements"></ds-search-export-csv>
24+
}
25+
</div>
26+
@if (searchResults && searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0) {
27+
<div @fadeIn>
28+
<ds-viewable-collection
29+
[config]="searchConfig.pagination"
30+
[sortConfig]="searchConfig.sort"
31+
[objects]="searchResults"
32+
[hideGear]="true"
33+
[showRSS]="true"
34+
[selectable]="selectable"
35+
[selectionConfig]="selectionConfig"
36+
[linkType]="linkType"
37+
[context]="context"
38+
[hidePaginationDetail]="hidePaginationDetail"
39+
[showThumbnails]="showThumbnails"
40+
(contentChange)="contentChange.emit($event)"
41+
(deselectObject)="deselectObject.emit($event)"
42+
(selectObject)="selectObject.emit($event)">
43+
</ds-viewable-collection>
44+
</div>
45+
}
46+
47+
@if (isLoading()) {
48+
<ds-search-results-skeleton
49+
[showThumbnails]="showThumbnails"
50+
[numberOfResults]="searchConfig.pagination.pageSize"
51+
></ds-search-results-skeleton>
52+
}
53+
54+
@if (showError()) {
55+
<ds-error
56+
message="{{errorMessageLabel() | translate}}"></ds-error>
57+
}
58+
@if (searchResults?.payload?.page.length === 0 || searchResults?.statusCode === 400) {
59+
<div>
60+
{{ 'search.results.no-results' | translate }}
61+
<a [routerLink]="['/search']"
62+
[queryParams]="{ query: surroundStringWithQuotes(searchConfig?.query) }"
63+
queryParamsHandling="merge" role="link" tabindex="0">
64+
{{"search.results.no-results-link" | translate}}
65+
</a>
66+
</div>
67+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { AsyncPipe, CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
3+
import { RouterLink } from '@angular/router';
4+
import { TranslateModule } from '@ngx-translate/core';
5+
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
6+
7+
import {
8+
fadeIn,
9+
fadeInOut,
10+
} from '../../../../../../app/shared/animations/fade';
11+
import { ErrorComponent } from '../../../../../../app/shared/error/error.component';
12+
import { ObjectCollectionComponent } from '../../../../../../app/shared/object-collection/object-collection.component';
13+
import { SearchExportCsvComponent } from '../../../../../../app/shared/search/search-export-csv/search-export-csv.component';
14+
import { SearchResultsSkeletonComponent } from '../../../../../../app/shared/search/search-results/search-results-skeleton/search-results-skeleton.component';
15+
import { SearchResultsComponent as BaseComponent } from '../../../../../../app/shared/search/search-results/search-results.component';
16+
17+
@Component({
18+
selector: 'ds-themed-search-results',
19+
templateUrl: './search-results.component.html',
20+
styleUrls: ['../../../../../../app/shared/search/search-results/search-results.component.scss'],
21+
animations: [
22+
fadeIn,
23+
fadeInOut,
24+
],
25+
standalone: true,
26+
imports: [
27+
AsyncPipe,
28+
ErrorComponent,
29+
NgxSkeletonLoaderModule,
30+
ObjectCollectionComponent,
31+
RouterLink,
32+
SearchExportCsvComponent,
33+
SearchResultsSkeletonComponent,
34+
CommonModule,
35+
TranslateModule,
36+
],
37+
})
38+
export class SearchResultsComponent extends BaseComponent {
39+
}

src/themes/tamu/assets/i18n/en.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@
7979

8080
"register-page.registration.info": "Register an account to subscribe to collections for email updates, and submit new items to OAKTrust.",
8181

82+
"search-page.heading": "Search OAKTrust",
83+
84+
"search-page.configuration.heading": "Search Configuration",
8285
"browse.startsWith.input": "To browse a location in the index, enter the first few letters",
8386
"browse.startsWith.click_here": "Click here for a ",
8487
"browse.startsWith.general_search": "general search",
8588
"browse.startsWith.type_text": "Click here for a general search",
8689

8790
"browse.startsWith.placeholder": "Enter the first few letters",
91+
8892
}

src/themes/tamu/eager-theme.module.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import { HomeNewsComponent } from './app/home-page/home-news/home-news.component
88
import { NavbarComponent } from './app/navbar/navbar.component';
99

1010
// TAMU Customizations
11-
import { LoginPageComponent } from './app/login-page/login-page.component';
12-
import { LogoutPageComponent } from './app/logout-page/logout-page.component';
1311
import { CommunityListComponent } from './app/community-list-page/community-list/community-list.component';
1412
import { CommunityPageSubCollectionListComponent } from './app/community-page/sections/sub-com-col-section/sub-collection-list/community-page-sub-collection-list.component';
1513
import { CommunityPageSubCommunityListComponent } from './app/community-page/sections/sub-com-col-section/sub-community-list/community-page-sub-community-list.component';
14+
import { LoginPageComponent } from './app/login-page/login-page.component';
15+
import { LogoutPageComponent } from './app/logout-page/logout-page.component';
16+
import { SearchPageComponent } from './app/search-page/search-page.component';
17+
import { SearchResultsComponent } from './app/shared/search/search-results/search-results.component';
1618
import { StartsWithTextComponent } from './app/shared/starts-with/text/starts-with-text.component';
1719
import { SubmissionSectionLicenseComponent } from './app/submission/sections/license/section-license.component';
1820
// END TAMU Customizations
@@ -35,6 +37,8 @@ const DECLARATIONS = [
3537
CommunityPageSubCommunityListComponent,
3638
LoginPageComponent,
3739
LogoutPageComponent,
40+
SearchPageComponent,
41+
SearchResultsComponent,
3842
StartsWithTextComponent,
3943
SubmissionSectionLicenseComponent,
4044
// END TAMU Customizations

0 commit comments

Comments
 (0)