mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
110889: Remove the scope query parameter from the search on comcol pages
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<ds-themed-search
|
<ds-themed-search
|
||||||
[showScopeSelector]="false"
|
[showScopeSelector]="false"
|
||||||
|
[hideScopeInUrl]="true"
|
||||||
[scope]="(comcol$ | async)?.id">
|
[scope]="(comcol$ | async)?.id">
|
||||||
</ds-themed-search>
|
</ds-themed-search>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { Component, EventEmitter, Input, Output, OnChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, Output, OnChanges } from '@angular/core';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { isNotEmpty } from '../empty.util';
|
import { isNotEmpty, hasValue } from '../empty.util';
|
||||||
import { SearchService } from '../../core/shared/search/search.service';
|
import { SearchService } from '../../core/shared/search/search.service';
|
||||||
import { currentPath } from '../utils/route.utils';
|
import { currentPath } from '../utils/route.utils';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
@@ -39,6 +39,11 @@ export class SearchFormComponent implements OnChanges {
|
|||||||
@Input()
|
@Input()
|
||||||
scope = '';
|
scope = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the scope in the url, this can be useful when you hardcode the scope in another way
|
||||||
|
*/
|
||||||
|
@Input() hideScopeInUrl = false;
|
||||||
|
|
||||||
selectedScope: BehaviorSubject<DSpaceObject> = new BehaviorSubject<DSpaceObject>(undefined);
|
selectedScope: BehaviorSubject<DSpaceObject> = new BehaviorSubject<DSpaceObject>(undefined);
|
||||||
|
|
||||||
@Input() currentUrl: string;
|
@Input() currentUrl: string;
|
||||||
@@ -115,6 +120,9 @@ export class SearchFormComponent implements OnChanges {
|
|||||||
*/
|
*/
|
||||||
updateSearch(data: any) {
|
updateSearch(data: any) {
|
||||||
const queryParams = Object.assign({}, data);
|
const queryParams = Object.assign({}, data);
|
||||||
|
if (hasValue(data.scope) && this.hideScopeInUrl) {
|
||||||
|
delete queryParams.scope;
|
||||||
|
}
|
||||||
|
|
||||||
void this.router.navigate(this.getSearchLinkParts(), {
|
void this.router.navigate(this.getSearchLinkParts(), {
|
||||||
queryParams: queryParams,
|
queryParams: queryParams,
|
||||||
|
@@ -18,6 +18,8 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
|
|||||||
|
|
||||||
@Input() scope: string;
|
@Input() scope: string;
|
||||||
|
|
||||||
|
@Input() hideScopeInUrl: boolean;
|
||||||
|
|
||||||
@Input() currentUrl: string;
|
@Input() currentUrl: string;
|
||||||
|
|
||||||
@Input() large: boolean;
|
@Input() large: boolean;
|
||||||
@@ -31,7 +33,15 @@ export class ThemedSearchFormComponent extends ThemedComponent<SearchFormCompone
|
|||||||
@Output() submitSearch: EventEmitter<any> = new EventEmitter();
|
@Output() submitSearch: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
protected inAndOutputNames: (keyof SearchFormComponent & keyof this)[] = [
|
protected inAndOutputNames: (keyof SearchFormComponent & keyof this)[] = [
|
||||||
'query', 'inPlaceSearch', 'scope', 'currentUrl', 'large', 'brandColor', 'searchPlaceholder', 'showScopeSelector',
|
'query',
|
||||||
|
'inPlaceSearch',
|
||||||
|
'scope',
|
||||||
|
'hideScopeInUrl',
|
||||||
|
'currentUrl',
|
||||||
|
'large',
|
||||||
|
'brandColor',
|
||||||
|
'searchPlaceholder',
|
||||||
|
'showScopeSelector',
|
||||||
'submitSearch',
|
'submitSearch',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -84,6 +84,7 @@
|
|||||||
<ds-themed-search-form *ngIf="searchEnabled" id="search-form"
|
<ds-themed-search-form *ngIf="searchEnabled" id="search-form"
|
||||||
[query]="(searchOptions$ | async)?.query"
|
[query]="(searchOptions$ | async)?.query"
|
||||||
[scope]="(searchOptions$ | async)?.scope"
|
[scope]="(searchOptions$ | async)?.scope"
|
||||||
|
[hideScopeInUrl]="hideScopeInUrl"
|
||||||
[currentUrl]="searchLink"
|
[currentUrl]="searchLink"
|
||||||
[showScopeSelector]="showScopeSelector"
|
[showScopeSelector]="showScopeSelector"
|
||||||
[inPlaceSearch]="inPlaceSearch"
|
[inPlaceSearch]="inPlaceSearch"
|
||||||
|
@@ -171,6 +171,11 @@ export class SearchComponent implements OnDestroy, OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() scope: string;
|
@Input() scope: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the scope in the url, this can be useful when you hardcode the scope in another way
|
||||||
|
*/
|
||||||
|
@Input() hideScopeInUrl: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current configuration used during the search
|
* The current configuration used during the search
|
||||||
*/
|
*/
|
||||||
|
@@ -42,6 +42,7 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
|
|||||||
'trackStatistics',
|
'trackStatistics',
|
||||||
'query',
|
'query',
|
||||||
'scope',
|
'scope',
|
||||||
|
'hideScopeInUrl',
|
||||||
'resultFound',
|
'resultFound',
|
||||||
'deselectObject',
|
'deselectObject',
|
||||||
'selectObject',
|
'selectObject',
|
||||||
@@ -93,6 +94,8 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
|
|||||||
|
|
||||||
@Input() scope: string;
|
@Input() scope: string;
|
||||||
|
|
||||||
|
@Input() hideScopeInUrl: boolean;
|
||||||
|
|
||||||
@Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = new EventEmitter();
|
@Output() resultFound: EventEmitter<SearchObjects<DSpaceObject>> = new EventEmitter();
|
||||||
|
|
||||||
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter();
|
@Output() deselectObject: EventEmitter<ListableObject> = new EventEmitter();
|
||||||
|
Reference in New Issue
Block a user