Skip to content

Commit

Permalink
remove commented and design change advance search
Browse files Browse the repository at this point in the history
  • Loading branch information
GauravD2t committed Feb 3, 2024
1 parent 5cc602b commit 6591cdd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<div class="facet-filter d-block mb-3 p-3" [ngClass]="{ 'focus': focusBox }" role="region">
<button (click)="toggle()" (focusin)="focusBox = true" (focusout)="focusBox = false" class="filter-name d-flex"
[attr.aria-expanded]="false" [attr.data-test]="'filter-toggle' | dsBrowserOnly">
<h5 class="d-inline-block mb-0">
[attr.aria-expanded]="false"
[attr.aria-label]="((collapsedSearch ? 'search.filters.filter.expand' : 'search.filters.filter.collapse') | translate) + ' ' + (('search.advanced.filters.head') | translate | lowercase)"
[attr.data-test]="'filter-toggle' | dsBrowserOnly">
<span class="h4 d-inline-block text-left mt-auto mb-auto">
{{'search.advanced.filters.head' | translate}}
</h5>
<span class="filter-toggle flex-grow-1 fas p-auto" [ngClass]="collapsedSearch ? 'fa-plus' : 'fa-minus'">
</span>
<i class="filter-toggle flex-grow-1 fas p-auto" aria-hidden="true" [ngClass]="collapsedSearch ? 'fa-plus' : 'fa-minus'"
[title]="(collapsedSearch ? 'search.filters.filter.expand' : 'search.filters.filter.collapse') | translate">
</i>
</button>
<div [@slide]="collapsedSearch ? 'collapsed' : 'expanded'" (@slide.start)="startSlide($event)"
(@slide.done)="finishSlide($event)" class="search-filter-wrapper"
[ngClass]="{ 'closed' : closed, 'notab': notab }">
<form [class]="'ng-invalid'" [formGroup]="advSearchForm" (ngSubmit)="onSubmit(advSearchForm.value)"
>
<form [class]="'ng-invalid'" [formGroup]="advSearchForm" (ngSubmit)="onSubmit(advSearchForm.value)">
<div class="row">
<div class="col-lg-12">
<select
[className]="(filter.invalid) && (filter.dirty || filter.touched) ? 'form-control is-invalid' :'form-control'"
aria-label="filter" name="filter" id="filter" placeholder="select operator" formControlName="filter" required>
aria-label="filter" name="filter" id="filter" placeholder="select operator"
formControlName="filter" required>
<ng-container *ngFor="let filter of appConfig.search.advancedFilters.filter;">
<option [value]="filter">
{{'search.filters.filter.' + filter + '.text'| translate}}
Expand All @@ -25,14 +28,6 @@ <h5 class="d-inline-block mb-0">
</select>
</div>
<div class="col-lg-12 mt-1">
<input type="text" aria-label="textsearch"
[className]="(textsearch.invalid) && (textsearch.dirty || textsearch.touched) ? 'form-control is-invalid' :'form-control'"
id="textsearch" name="textsearch" formControlName="textsearch" #text
[placeholder]="('filter.search.text.placeholder' | translate)" required>
</div>
</div>
<div class="row">
<div class="col-lg-8 mt-1">
<select
[className]="(operator.invalid) && (operator.dirty || operator.touched) ? 'form-control is-invalid' :'form-control'"
aria-label="operator" name="operator" id="operator" formControlName="operator" required>
Expand All @@ -42,9 +37,15 @@ <h5 class="d-inline-block mb-0">
<option value="notcontains">{{'search.filters.operator.notcontains.text'| translate}}</option>
</select>
</div>
</div>
<div class="row">
<div class="col-lg-8 mt-1">
<input type="text" aria-label="textsearch" class="form-control" id="textsearch" name="textsearch"
formControlName="textsearch" #text [placeholder]="('filter.search.text.placeholder' | translate)" required>
</div>
<div class="col-lg-4 mt-1">
<button class="form-control btn btn-primary" type="submit"
[disabled]="advSearchForm.invalid">Add</button>
[disabled]="advSearchForm.invalid">{{'advancesearch.form.submit'| translate}}</button>
</div>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { SearchFiltersComponent } from './search-filters.component';
import { SearchService } from '../../../core/shared/search/search.service';
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
import { SearchConfigurationServiceStub } from '../../testing/search-configuration-service.stub';
import { APP_CONFIG } from 'src/config/app-config.interface';
import { environment } from 'src/environments/environment';

describe('SearchFiltersComponent', () => {
let comp: SearchFiltersComponent;
Expand Down Expand Up @@ -38,6 +40,7 @@ describe('SearchFiltersComponent', () => {
{ provide: SearchService, useValue: searchServiceStub },
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
{ provide: SearchFilterService, useValue: searchFiltersStub },
{ provide: APP_CONFIG, useValue: environment },

],
schemas: [NO_ERRORS_SCHEMA]
Expand All @@ -59,9 +62,9 @@ describe('SearchFiltersComponent', () => {
(comp as any).getSearchLink();
});

// it('should call getSearchLink on the searchService', () => {
// expect(searchService.getSearchLink).toHaveBeenCalled();
// });
it('should call getSearchLink on the searchService', () => {
expect(searchService.getSearchLink).toHaveBeenCalled();
});
});

});
44 changes: 22 additions & 22 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5426,12 +5426,6 @@

"admin.system-wide-alert.title": "System-wide Alerts",

"search.advanced.filters.head": "Advanced Search",

"filter.search.operator.placeholder": "Operator",

"filter.search.text.placeholder": "Search text",

"access-control-item-header-toggle": "Item's Metadata",

"access-control-item-toggle.enable": "Enable option to perform changes on the item's metadata",
Expand All @@ -5444,16 +5438,6 @@

"access-control-bitstream-toggle.disable": "Disable option to perform changes on the bitstreams",

"search.filters.operator.notequals.text": "Not Equals",

"search.filters.operator.notcontains.text": "Not Contains",

"search.filters.operator.contains.text": "Contains",

"search.filters.filter.title.text": "Title",

"search.filters.filter.author.text": "Author",

"access-control-bitstreams-selected": "bitstreams selected",

"access-control-bitstreams-select": "Select bitstreams",
Expand All @@ -5466,12 +5450,6 @@

"access-control-remove": "Remove access condition",

"community.search.head": "Search Within",

"collection.page.browse.search.head": "Search Within",

"search.filters.applied.f.title": "Title",

"access-control-option-start-date-note": "Select the date from which the related access condition is applied",

"access-control-option-end-date": "Grant access until",
Expand All @@ -5481,4 +5459,26 @@
"vocabulary-treeview.search.form.add": "Add",

"search.filters.filter.entityType.text": "Item Type",

"search.filters.operator.equals.text": "Equals",

"search.filters.operator.notequals.text": "Not Equals",

"search.filters.operator.notcontains.text": "Not Contains",

"search.filters.operator.contains.text": "Contains",

"search.filters.filter.title.text": "Title",

"search.filters.applied.f.title": "Title",

"search.filters.filter.author.text": "Author",

"search.advanced.filters.head": "Advanced Search",

"filter.search.operator.placeholder": "Operator",

"filter.search.text.placeholder": "Search text",

"advancesearch.form.submit": "Add",
}

0 comments on commit 6591cdd

Please sign in to comment.