Skip to content

Commit 60c0132

Browse files
committed
More propagation of 'advanced', and correct replacement of ':'
1 parent ecb9e2f commit 60c0132

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/app/shared/search-form/search-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<input type="text" [(ngModel)]="query" name="query" class="form-control"
1212
[attr.aria-label]="searchPlaceholder" [attr.data-test]="'search-box' | dsBrowserOnly"
1313
[placeholder]="searchPlaceholder">
14-
<input type="checkbox" [(ngModel)]="advanced" [attr.name]="{{ ('search.form.advanced' | translate ) }}" checked />
14+
<input type="checkbox" [(ngModel)]="advanced" [attr.name]="('search.form.advanced' | translate )" checked />
1515
<button type="submit" class="search-button btn btn-{{brandColor}}" [attr.data-test]="'search-button' | dsBrowserOnly"><i class="fas fa-search"></i> {{ ('search.form.search' | translate) }}</button>
1616
</div>
1717
</div>

src/app/shared/search-form/themed-search-form.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
2222

2323
@Input() query: string;
2424

25+
@Input() advanced: boolean;
26+
2527
@Input() inPlaceSearch: boolean;
2628

2729
@Input() scope: string;
@@ -42,6 +44,7 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
4244

4345
protected inAndOutputNames: (keyof SearchFormComponent & keyof this)[] = [
4446
'query',
47+
'advanced',
4548
'inPlaceSearch',
4649
'scope',
4750
'hideScopeInUrl',

src/app/shared/search/advanced-search/advanced-search.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy {
138138
if (isNotEmpty(this.currentValue)) {
139139
this.searchFilterService.minimizeAll();
140140
this.subs.push(this.searchConfigurationService.selectNewAppliedFilterParams(this.currentFilter, this.currentValue.trim(), this.currentOperator).pipe(take(1)).subscribe((params: Params) => {
141+
params.advanced = true;
141142
void this.router.navigate([this.searchService.getSearchLink()], {
142143
queryParams: params,
143144
});

src/app/shared/search/models/search-options.model.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ export class SearchOptions {
4949
args.push(this.encodedFixedFilter);
5050
}
5151
if (isNotEmpty(this.query)) {
52-
if (!this.advanced){
53-
this.query.replace(':', '\:');
52+
if (!this.advanced) {
53+
args.push(`query=${encodeURIComponent(this.query.replace(':', '\\:'))}`);
54+
} else {
55+
args.push(`query=${encodeURIComponent(this.query)}`);
5456
}
55-
args.push(`query=${encodeURIComponent(this.query)}`);
5657
}
5758
if (isNotEmpty(this.scope)) {
5859
args.push(`scope=${encodeURIComponent(this.scope)}`);

src/app/shared/search/search.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
<ng-template #searchForm>
107107
<ds-search-form id="search-form"
108108
[query]="(searchOptions$ | async)?.query"
109+
[advanced]="(searchOptions$ | async)?.advanced"
109110
[scope]="(searchOptions$ | async)?.scope"
110111
[hideScopeInUrl]="hideScopeInUrl"
111112
[currentUrl]="searchLink"

0 commit comments

Comments
 (0)