mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 20:13:07 +00:00
implemented feedback
This commit is contained in:
@@ -34,9 +34,8 @@
|
|||||||
[name]="filterConfig.paramName"
|
[name]="filterConfig.paramName"
|
||||||
[(ngModel)]="filter"
|
[(ngModel)]="filter"
|
||||||
(submitSuggestion)="onSubmit($event)"
|
(submitSuggestion)="onSubmit($event)"
|
||||||
(clickSuggestion)="onSubmit($event)"
|
(clickSuggestion)="onClick($event)"
|
||||||
(findSuggestions)="findSuggestions($event)"
|
(findSuggestions)="findSuggestions($event)"
|
||||||
[getDisplayValue]="getDisplayValue"
|
|
||||||
ngDefaultControl
|
ngDefaultControl
|
||||||
></ds-input-suggestions>
|
></ds-input-suggestions>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,6 +7,9 @@
|
|||||||
&:hover, &focus {
|
&:hover, &focus {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
span.badge {
|
||||||
|
vertical-align: text-top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.toggle-more-filters a {
|
.toggle-more-filters a {
|
||||||
color: $link-color;
|
color: $link-color;
|
||||||
|
@@ -43,7 +43,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
filter: string;
|
filter: string;
|
||||||
pageChange = false;
|
pageChange = false;
|
||||||
sub: Subscription;
|
sub: Subscription;
|
||||||
filterSearchResults: Observable<string[]> = Observable.of([]);
|
filterSearchResults: Observable<any[]> = Observable.of([]);
|
||||||
|
|
||||||
constructor(private searchService: SearchService, private filterService: SearchFilterService, private router: Router) {
|
constructor(private searchService: SearchService, private filterService: SearchFilterService, private router: Router) {
|
||||||
}
|
}
|
||||||
@@ -108,6 +108,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
this.filterSearchResults = Observable.of([]);
|
this.filterSearchResults = Observable.of([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClick(data: any) {
|
||||||
|
this.filter = data;
|
||||||
|
}
|
||||||
|
|
||||||
hasValue(o: any): boolean {
|
hasValue(o: any): boolean {
|
||||||
return hasValue(o);
|
return hasValue(o);
|
||||||
}
|
}
|
||||||
@@ -144,7 +148,9 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
.first()
|
.first()
|
||||||
.map(
|
.map(
|
||||||
(rd: RemoteData<PaginatedList<FacetValue>>) => {
|
(rd: RemoteData<PaginatedList<FacetValue>>) => {
|
||||||
return rd.payload.page.map((facet) => facet.value)
|
return rd.payload.page.map((facet) => {
|
||||||
|
return {displayValue: this.getDisplayValue(facet, data), value: facet.value}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -154,7 +160,8 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDisplayValue(value: string, searchValue: string) {
|
getDisplayValue(facet: FacetValue, query: string): string {
|
||||||
return new EmphasizePipe().transform(value, searchValue);
|
return new EmphasizePipe().transform(facet.value, query) + ' (' + facet.count + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ export class SearchOptions {
|
|||||||
}
|
}
|
||||||
if (isNotEmpty(this.filters)) {
|
if (isNotEmpty(this.filters)) {
|
||||||
Object.entries(this.filters).forEach(([key, values]) => {
|
Object.entries(this.filters).forEach(([key, values]) => {
|
||||||
values.forEach((value) => args.push(`${key}=${value},equals`));
|
values.forEach((value) => args.push(`${key}=${value},query`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isNotEmpty(args)) {
|
if (isNotEmpty(args)) {
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
<div class="autocomplete dropdown-menu" [ngClass]="{'show': (show | async) && isNotEmpty(suggestions)}">
|
<div class="autocomplete dropdown-menu" [ngClass]="{'show': (show | async) && isNotEmpty(suggestions)}">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li *ngFor="let suggestionOption of suggestions">
|
<li *ngFor="let suggestionOption of suggestions">
|
||||||
<a href="#" class="d-block" class="dropdown-item" (click)="onClickSuggestion(suggestionOption)" #suggestion>
|
<a href="#" class="d-block" class="dropdown-item" (click)="onClickSuggestion(suggestionOption.value)" #suggestion>
|
||||||
<span [innerHTML]="getDisplayValue(suggestionOption, inputField.value)"></span>
|
<span [innerHTML]="suggestionOption.displayValue"></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -14,7 +14,7 @@ describe('InputSuggestionsComponent', () => {
|
|||||||
let fixture: ComponentFixture<InputSuggestionsComponent>;
|
let fixture: ComponentFixture<InputSuggestionsComponent>;
|
||||||
let de: DebugElement;
|
let de: DebugElement;
|
||||||
let el: HTMLElement;
|
let el: HTMLElement;
|
||||||
const suggestions = ['suggestion uno', 'suggestion dos', 'suggestion tres'];
|
const suggestions = [{displayValue: 'suggestion uno', value: 'suggestion uno'}, {displayValue: 'suggestion dos', value: 'suggestion dos'}, {displayValue: 'suggestion tres', value: 'suggestion tres'}];
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -299,7 +299,7 @@ describe('InputSuggestionsComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
it('should call onClickSuggestion() with the suggestion as a parameter', () => {
|
it('should call onClickSuggestion() with the suggestion as a parameter', () => {
|
||||||
expect(comp.onClickSuggestion).toHaveBeenCalledWith(suggestions[clickedIndex]);
|
expect(comp.onClickSuggestion).toHaveBeenCalledWith(suggestions[clickedIndex].value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
})
|
})
|
||||||
|
|
||||||
export class InputSuggestionsComponent {
|
export class InputSuggestionsComponent {
|
||||||
@Input() suggestions: string[] = [];
|
@Input() suggestions: any[] = [];
|
||||||
@Input() debounceTime = 500;
|
@Input() debounceTime = 500;
|
||||||
@Input() placeholder = '';
|
@Input() placeholder = '';
|
||||||
@Input() action;
|
@Input() action;
|
||||||
@@ -38,7 +38,6 @@ export class InputSuggestionsComponent {
|
|||||||
selectedIndex = -1;
|
selectedIndex = -1;
|
||||||
@ViewChild('inputField') queryInput: ElementRef;
|
@ViewChild('inputField') queryInput: ElementRef;
|
||||||
@ViewChildren('suggestion') resultViews: QueryList<ElementRef>;
|
@ViewChildren('suggestion') resultViews: QueryList<ElementRef>;
|
||||||
@Input() getDisplayValue: (value: string, query: string) => string = (value: string, query: string) => value;
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (hasValue(changes.suggestions)) {
|
if (hasValue(changes.suggestions)) {
|
||||||
@@ -90,6 +89,8 @@ export class InputSuggestionsComponent {
|
|||||||
|
|
||||||
onClickSuggestion(data) {
|
onClickSuggestion(data) {
|
||||||
this.clickSuggestion.emit(data);
|
this.clickSuggestion.emit(data);
|
||||||
|
this.close();
|
||||||
|
this.queryInput.nativeElement.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
(<span *ngIf="dso.findMetadata('dc.publisher')" class="item-list-publisher"
|
(<span *ngIf="dso.findMetadata('dc.publisher')" class="item-list-publisher"
|
||||||
[innerHTML]="getFirstValue('dc.publisher')">, </span><span
|
[innerHTML]="getFirstValue('dc.publisher') + ', '"></span><span
|
||||||
*ngIf="dso.findMetadata('dc.date.issued')" class="item-list-date"
|
*ngIf="dso.findMetadata('dc.date.issued')" class="item-list-date"
|
||||||
[innerHTML]="getFirstValue('dc.date.issued')"></span>)
|
[innerHTML]="getFirstValue('dc.date.issued')"></span>)
|
||||||
<span *ngIf="dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0"
|
<span *ngIf="dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0"
|
||||||
|
Reference in New Issue
Block a user