mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
changed the scope to activate on change instead of on form submit
This commit is contained in:
@@ -63,7 +63,9 @@ export class SearchPageComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
this.scopeListRD$ = this.filterService.getCurrentScope().pipe(
|
this.scopeListRD$ = this.filterService.getCurrentScope().pipe(
|
||||||
flatMap((scopeId) => this.service.getScopes(scopeId))
|
flatMap((scopeId) => this.service.getScopes(scopeId))
|
||||||
)
|
);
|
||||||
|
|
||||||
|
this.resultsRD$.subscribe((v) => console.log('this.resultsRD$', v.state));
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeSidebar(): void {
|
public closeSidebar(): void {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/search">
|
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/search">
|
||||||
<div *ngIf="isNotEmpty(scopes)" class="col-12 col-sm-3">
|
<div *ngIf="isNotEmpty(scopes)" class="col-12 col-sm-3">
|
||||||
<select [(ngModel)]="selectedId" name="scope" class="form-control" aria-label="Search scope">
|
<select [(ngModel)]="selectedId" name="scope" class="form-control" aria-label="Search scope" (change)="onScopeChange($event.target.value)">
|
||||||
<option value>{{'search.form.search_dspace' | translate}}</option>
|
<option value>{{'search.form.search_dspace' | translate}}</option>
|
||||||
<option *ngFor="let scopeOption of scopes" [value]="scopeOption.id">{{scopeOption?.name ? scopeOption.name : 'search.form.search_dspace' | translate}}</option>
|
<option *ngFor="let scopeOption of scopes" [value]="scopeOption.id">{{scopeOption?.name ? scopeOption.name : 'search.form.search_dspace' | translate}}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@@ -33,14 +33,14 @@ export class SearchFormComponent {
|
|||||||
this.updateSearch(data);
|
this.updateSearch(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onScopeChange(scope: string) {
|
||||||
|
this.updateSearch({ scope });
|
||||||
|
}
|
||||||
|
|
||||||
updateSearch(data: any) {
|
updateSearch(data: any) {
|
||||||
const newUrl = hasValue(this.currentUrl) ? this.currentUrl : 'search';
|
const newUrl = hasValue(this.currentUrl) ? this.currentUrl : 'search';
|
||||||
this.router.navigate([newUrl], {
|
this.router.navigate([newUrl], {
|
||||||
queryParams: {
|
queryParams: Object.assign({}, { page: 1 }, data),
|
||||||
query: data.query,
|
|
||||||
scope: data.scope || undefined,
|
|
||||||
page: data.page || 1
|
|
||||||
},
|
|
||||||
queryParamsHandling: 'merge'
|
queryParamsHandling: 'merge'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user