Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #1813

Merged
merged 2 commits into from
Mar 15, 2024
Merged

Devel #1813

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
Original file line number Diff line number Diff line change
Expand Up @@ -541,29 +541,9 @@ <h3 style='font-size: 1.4rem; margin: 0' i18n='@@searchHelpButton'>Hakuohje</h3>
<!-- TODO: standalone-header here -->

<div class='search-bar' style="background-color: orange; height: 100px; display: flex; justify-content: center; align-items: center">
<app-search-bar2 [(value)]='keywords' (search)='setKeywords(keywords)' (instructions)='openTutorialDialog()'></app-search-bar2>
<app-search-bar2 [(value)]='keywords' (search)='setKeywords(keywords)' (instructions)='openTutorialDialog()' (clear)='clearKeywordField()'></app-search-bar2>
</div>

<!-- TODO HIDE FOR NOW -->
<!--<div class='search-tabs'>
&lt;!&ndash; TAB LOOKING BUTTONS &ndash;&gt;
<div style='height: 80px; margin-top: 20px; display: flex'>
<ng-container *ngFor='let tab of ["Julkaisut", "Tutkijat", "Hankkeet", "Aineistot", "Rahoitushaut", "Infrastruktuurit", "Organisaatio"]'>
<ng-container *ngIf='tab === "Julkaisut"'>
<div style='display: flex; justify-content: center; flex-grow: 1; align-items: center; height: 80px; border: 1px solid black; border-bottom: none; background-color: white'>
{{tab}}
</div>
</ng-container>

<ng-container *ngIf='tab !== "Julkaisut"'>
<div style='display: flex; justify-content: center; flex-grow: 1; align-items: center; height: 70px; margin-top: 10px; border-bottom: 1px solid black; background-color: #e8e8f5'>
{{tab}}
</div>
</ng-container>
</ng-container>
</div>
</div>-->

<div class='search-info'>
<!--<div style='width: 100%; height: 25px; background-color: blue'></div>--> <!-- TODO: GO TO NEW SEARCH -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ export class Publications2Component implements OnDestroy {
clamp(value: number, min: number, max: number) {
return Math.min(Math.max(value, min), max);
}

clearKeywordField() {
this.keywords = "";
}
}

export class PublicationDataSource extends DataSource<HighlightedPublication> {
Expand Down
7 changes: 5 additions & 2 deletions src/app/portal/search-bar2/search-bar2.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
[ngModel]='value'
(ngModelChange)='valueChange.emit($event)'
(keyup.enter)='search.emit(keywords)'
class='search-input'
style='margin-right: 8px'
type='search'
class='search-input'
i18n-title='@@searchTooltip'
title='Voit hakea julkaisuja, tutkijoita, rahoituspäätöksiä, aineistoja, rahoitushakuja, infrastruktuureja ja organisaatioita kuvailevaa tietoa.'
i18n-placeholder='@@searchPlaceholder'
Expand All @@ -22,6 +21,10 @@
tabindex='0'
/>

<div style='display: flex; justify-content: center; align-items: center; background-color: white; width: 50px; cursor: pointer; border-top-right-radius: 4px; border-bottom-right-radius: 4px; margin-right: 8px' (click)='clear.emit()'>
<i class='fas fa-times' style='color: black; font-size: 1rem;'></i>
</div>

<button matRipple style='display: flex; justify-content: center; align-items: center; background-color: white; height: 55px; width: 115px; margin-right: 8px' (click)='search.emit(keywords)'>
Hae
</button>
Expand Down
7 changes: 4 additions & 3 deletions src/app/portal/search-bar2/search-bar2.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
width: 510px;
height: 55px;

border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;

border-width: 0;

font-size: 25px;
Expand Down Expand Up @@ -96,7 +97,7 @@ app-search-bar .search-input input {
white-space: nowrap;
overflow: hidden;
border: none;
padding-right: 2.75rem;
// padding-right: 2.75rem;
}

app-search-bar input {
Expand Down
3 changes: 3 additions & 0 deletions src/app/portal/search-bar2/search-bar2.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ export class SearchBar2Component {
// instruction button is pressed output
@Output() instructions = new EventEmitter<void>();

// clear event output
@Output() clear = new EventEmitter<void>();

public keywords = this.route.snapshot.queryParams.q ?? "";
}
7 changes: 6 additions & 1 deletion src/app/portal/services/publication2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,16 @@ function sortingTerms(searchParams: SearchParams) {
if (textFields.includes(sortedField)) {
sortedField += ".keyword";
}

return [
{ [sortedField]: { "order": direction } },
"_score"
];
}

return [
"_score",
{ [sortedField]: { "order": direction } },
"_score"
];
}

Expand Down
Loading