Skip to content

Commit a71cce4

Browse files
committed
More propagation of 'advanced', and correct replacement of ':'
1 parent 58b0bcb commit a71cce4

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<input type="text" [(ngModel)]="query" name="query" class="form-control"
1313
[attr.aria-label]="searchPlaceholder" [attr.data-test]="'search-box' | dsBrowserOnly"
1414
[placeholder]="searchPlaceholder" tabindex="0">
15-
<input type="checkbox" [(ngModel)]="advanced" [attr.name]="{{ ('search.form.advanced' | translate ) }}" checked />
15+
<input type="checkbox" [(ngModel)]="advanced" name="advanced" checked /><label for="advanced">{{ "('search.form.advanced' | translate )" }}</label>
1616
<button type="submit" class="search-button btn btn-{{brandColor}}" [attr.data-test]="'search-button' | dsBrowserOnly" role="button" tabindex="0"><i class="fas fa-search"></i> {{ ('search.form.search' | translate) }}</button>
1717
</div>
1818
</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
@@ -19,6 +19,8 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
1919

2020
@Input() query: string;
2121

22+
@Input() advanced: boolean;
23+
2224
@Input() inPlaceSearch: boolean;
2325

2426
@Input() scope: string;
@@ -39,6 +41,7 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
3941

4042
protected inAndOutputNames: (keyof SearchFormComponent & keyof this)[] = [
4143
'query',
44+
'advanced',
4245
'inPlaceSearch',
4346
'scope',
4447
'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
@@ -133,6 +133,7 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy {
133133
if (isNotEmpty(this.currentValue)) {
134134
this.searchFilterService.minimizeAll();
135135
this.subs.push(this.searchConfigurationService.selectNewAppliedFilterParams(this.currentFilter, this.currentValue.trim(), this.currentOperator).pipe(take(1)).subscribe((params: Params) => {
136+
params.advanced = true;
136137
void this.router.navigate([this.searchService.getSearchLink()], {
137138
queryParams: params,
138139
});

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)