mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
#150 Feedback fixes
This commit is contained in:
@@ -77,10 +77,15 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
|||||||
let pageSizeOptions: number[] = [5, 10, 20, 40, 60, 80, 100];
|
let pageSizeOptions: number[] = [5, 10, 20, 40, 60, 80, 100];
|
||||||
|
|
||||||
if (isNotEmpty(params.view) && params.view === ViewMode.Grid) {
|
if (isNotEmpty(params.view) && params.view === ViewMode.Grid) {
|
||||||
pageSize = 12;
|
|
||||||
pageSizeOptions = [12, 24, 36, 48 , 50, 62, 74, 84];
|
pageSizeOptions = [12, 24, 36, 48 , 50, 62, 74, 84];
|
||||||
// pageSize = 9;
|
if (pageSizeOptions.indexOf(pageSize) === -1) {
|
||||||
// pageSizeOptions = [9, 18, 27, 36 , 45, 54, 63, 72];
|
pageSize = 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNotEmpty(params.view) && params.view === ViewMode.List) {
|
||||||
|
if (pageSizeOptions.indexOf(pageSize) === -1) {
|
||||||
|
pageSize = 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortDirection = +params.sortDirection || this.searchOptions.sort.direction;
|
const sortDirection = +params.sortDirection || this.searchOptions.sort.direction;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<ds-pagination
|
<ds-pagination
|
||||||
[paginationOptions]="config"
|
[paginationOptions]="config"
|
||||||
[pageInfoState]="pageInfo"
|
[pageInfoState]="pageInfo"
|
||||||
[collectionSize]="(pageInfo | async)?.totalElements"
|
[collectionSize]="pageInfo?.totalElements"
|
||||||
[sortOptions]="sortConfig"
|
[sortOptions]="sortConfig"
|
||||||
[hideGear]="hideGear"
|
[hideGear]="hideGear"
|
||||||
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
|
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
|
||||||
(pageChange)="onPageChange($event)"
|
(pageChange)="onPageChange($event)"
|
||||||
(pageSizeChange)="onPageSizeChange($event)"
|
(pageSizeChange)="onPageSizeChange($event)"
|
||||||
(sortDirectionChange)="onSortDirectionChange($event)"
|
(sortDirectionChange)="onSortDirectionChange($event)"
|
||||||
(sortFieldChange)="onSortDirectionChange($event)"
|
(sortFieldChange)="onSortFieldChange($event)"
|
||||||
(paginationChange)="onPaginationChange($event)">
|
(paginationChange)="onPaginationChange($event)">
|
||||||
<div class="row mt-2" *ngIf="objects?.hasSucceeded" @fadeIn>
|
<div class="row mt-2" *ngIf="objects?.hasSucceeded" @fadeIn>
|
||||||
<div class="col-lg-4 col-sm-6 col-xs-12 "
|
<div class="col-lg-4 col-sm-6 col-xs-12 "
|
||||||
|
@@ -1,12 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
Component, EventEmitter,
|
Component, EventEmitter,
|
||||||
Input,
|
Input,
|
||||||
ViewEncapsulation,
|
Output,
|
||||||
ChangeDetectionStrategy,
|
ViewEncapsulation
|
||||||
OnInit,
|
|
||||||
Output, SimpleChanges, OnChanges, ChangeDetectorRef, DoCheck
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
|
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
@@ -16,6 +14,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o
|
|||||||
import { SortOptions, SortDirection } from '../../core/cache/models/sort-options.model';
|
import { SortOptions, SortDirection } from '../../core/cache/models/sort-options.model';
|
||||||
import { fadeIn } from '../animations/fade';
|
import { fadeIn } from '../animations/fade';
|
||||||
import { ListableObject } from '../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../object-collection/shared/listable-object.model';
|
||||||
|
import { hasValue } from '../empty.util';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
changeDetection: ChangeDetectionStrategy.Default,
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
@@ -26,14 +25,35 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
|
|||||||
animations: [fadeIn]
|
animations: [fadeIn]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ObjectGridComponent implements OnChanges, OnInit {
|
export class ObjectGridComponent {
|
||||||
|
|
||||||
@Input() objects: RemoteData<ListableObject[]>;
|
|
||||||
@Input() config: PaginationComponentOptions;
|
@Input() config: PaginationComponentOptions;
|
||||||
@Input() sortConfig: SortOptions;
|
@Input() sortConfig: SortOptions;
|
||||||
@Input() hideGear = false;
|
@Input() hideGear = false;
|
||||||
@Input() hidePagerWhenSinglePage = true;
|
@Input() hidePagerWhenSinglePage = true;
|
||||||
pageInfo: Observable<PageInfo>;
|
private _objects: RemoteData<ListableObject[]>;
|
||||||
|
pageInfo: PageInfo;
|
||||||
|
@Input() set objects(objects: RemoteData<ListableObject[]>) {
|
||||||
|
this._objects = objects;
|
||||||
|
if (hasValue(objects)) {
|
||||||
|
this.pageInfo = objects.pageInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get objects() {
|
||||||
|
return this._objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the page is changed.
|
||||||
|
* Event's payload equals to the newly selected page.
|
||||||
|
*/
|
||||||
|
@Output() change: EventEmitter<{
|
||||||
|
pagination: PaginationComponentOptions,
|
||||||
|
sort: SortOptions
|
||||||
|
}> = new EventEmitter<{
|
||||||
|
pagination: PaginationComponentOptions,
|
||||||
|
sort: SortOptions
|
||||||
|
}>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event fired when the page is changed.
|
* An event fired when the page is changed.
|
||||||
@@ -61,26 +81,6 @@ export class ObjectGridComponent implements OnChanges, OnInit {
|
|||||||
*/
|
*/
|
||||||
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
|
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
|
||||||
data: any = {};
|
data: any = {};
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
if (changes.objects && !changes.objects.isFirstChange()) {
|
|
||||||
// this.pageInfo = this.objects.pageInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
// this.pageInfo = this.objects.pageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param route
|
|
||||||
* Route is a singleton service provided by Angular.
|
|
||||||
* @param router
|
|
||||||
* Router is a singleton service provided by Angular.
|
|
||||||
*/
|
|
||||||
constructor(private cdRef: ChangeDetectorRef) {
|
|
||||||
}
|
|
||||||
|
|
||||||
onPageChange(event) {
|
onPageChange(event) {
|
||||||
this.pageChange.emit(event);
|
this.pageChange.emit(event);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user