diff --git a/package.json b/package.json
index 1a3ac750b7..316b12f0b6 100644
--- a/package.json
+++ b/package.json
@@ -78,7 +78,7 @@
"@angular/upgrade": "2.2.3",
"@angularclass/bootloader": "1.0.1",
"@angularclass/idle-preload": "1.0.4",
- "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.15",
+ "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.24",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^2.0.0",
"@ngrx/router-store": "^1.2.5",
@@ -90,7 +90,7 @@
"angular2-universal": "2.1.0-rc.1",
"angular2-universal-polyfills": "2.1.0-rc.1",
"body-parser": "1.15.2",
- "bootstrap": "4.0.0-alpha.5",
+ "bootstrap": "4.0.0-alpha.6",
"cerialize": "^0.1.13",
"compression": "1.6.2",
"express": "4.14.0",
@@ -100,6 +100,7 @@
"jsonschema": "^1.1.1",
"methods": "1.1.2",
"morgan": "1.7.0",
+ "ng2-pagination": "^2.0.0",
"ng2-translate": "4.2.0",
"preboot": "4.5.2",
"rxjs": "5.0.0-beta.12",
diff --git a/resources/i18n/en.json b/resources/i18n/en.json
index 6e181428ec..80a68206ea 100644
--- a/resources/i18n/en.json
+++ b/resources/i18n/en.json
@@ -15,6 +15,14 @@
"home": "Home"
},
+ "pagination": {
+ "results-per-page": "Results Per Page",
+ "showing": {
+ "label" : "Now showing items ",
+ "detail": "{{ range }} of {{ total }}"
+ }
+ },
+
"title": "DSpace",
"404": {
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 87d3703586..a83530c27d 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -10,6 +10,19 @@
development
production
+
+ {{options.id}}
+
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index b27fdd354b..856f964283 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -11,6 +11,8 @@ import { HostWindowState } from "./shared/host-window.reducer";
import { Store } from "@ngrx/store";
import { HostWindowResizeAction } from "./shared/host-window.actions";
+import { PaginationOptions } from './core/shared/pagination-options.model';
+
import { GLOBAL_CONFIG, GlobalConfig } from '../config';
@Component({
@@ -23,8 +25,9 @@ import { GLOBAL_CONFIG, GlobalConfig } from '../config';
export class AppComponent implements OnDestroy, OnInit {
private translateSubscription: any;
+ collection = [];
example: string;
-
+ options: PaginationOptions = new PaginationOptions();
data: any = {
greeting: 'Hello',
recipient: 'World'
@@ -39,12 +42,20 @@ export class AppComponent implements OnDestroy, OnInit {
translate.setDefaultLang('en');
// the lang to use, if the lang isn't available, it will use the current loader to get them
translate.use('en');
+ for (let i = 1; i <= 100; i++) {
+ this.collection.push(`item ${i}`);
+ }
}
ngOnInit() {
this.translateSubscription = this.translate.get('example.with.data', { greeting: 'Hello', recipient: 'DSpace' }).subscribe((translation: string) => {
this.example = translation;
});
+ this.onLoad();
+ this.options.id = 'app';
+ //this.options.currentPage = 1;
+ this.options.pageSize = 15;
+ this.options.size = 'sm';
}
ngOnDestroy() {
@@ -60,4 +71,9 @@ export class AppComponent implements OnDestroy, OnInit {
);
}
+ private onLoad() {
+ this.store.dispatch(
+ new HostWindowResizeAction(window.innerWidth, window.innerHeight)
+ );
+ }
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index bda3ccc9ea..920195a0f5 100755
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -20,7 +20,7 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
SharedModule,
HomeModule,
CoreModule.forRoot(),
- AppRoutingModule,
+ AppRoutingModule
],
providers: [
]
diff --git a/src/app/core/cache/request-cache.reducer.spec.ts b/src/app/core/cache/request-cache.reducer.spec.ts
index 56bea6a83e..a478f0c2f5 100644
--- a/src/app/core/cache/request-cache.reducer.spec.ts
+++ b/src/app/core/cache/request-cache.reducer.spec.ts
@@ -6,6 +6,7 @@ import {
} from "./request-cache.actions";
import deepFreeze = require("deep-freeze");
import { OpaqueToken } from "@angular/core";
+import { PaginationOptions } from "../shared/pagination-options.model";
class NullAction extends RequestCacheRemoveAction {
type = null;
@@ -26,7 +27,19 @@ describe("requestCacheReducer", () => {
"be8325f7-243b-49f4-8a4b-df2b793ff3b5"
];
const resourceID = "9978";
- const paginationOptions = { "resultsPerPage": 10, "currentPage": 1 };
+ const paginationOptions: PaginationOptions = {
+ "id": "test",
+ "currentPage": 1,
+ "pageSizeOptions": [5, 10, 20, 40, 60, 80, 100],
+ "disabled": false,
+ "boundaryLinks": false,
+ "directionLinks": true,
+ "ellipses": true,
+ "maxSize": 0,
+ "pageSize": 10,
+ "rotate": false,
+ "size": 'sm'
+ };
const sortOptions = { "field": "id", "direction": 0 };
const testState = {
[keys[0]]: {
diff --git a/src/app/core/cache/request-cache.service.spec.ts b/src/app/core/cache/request-cache.service.spec.ts
index eb4a07a742..c29addd23f 100644
--- a/src/app/core/cache/request-cache.service.spec.ts
+++ b/src/app/core/cache/request-cache.service.spec.ts
@@ -4,6 +4,7 @@ import { RequestCacheState, RequestCacheEntry } from "./request-cache.reducer";
import { OpaqueToken } from "@angular/core";
import { RequestCacheFindAllAction, RequestCacheFindByIDAction } from "./request-cache.actions";
import { Observable } from "rxjs";
+import { PaginationOptions } from "../shared/pagination-options.model";
describe("RequestCacheService", () => {
let service: RequestCacheService;
@@ -12,7 +13,19 @@ describe("RequestCacheService", () => {
const keys = ["125c17f89046283c5f0640722aac9feb", "a06c3006a41caec5d635af099b0c780c"];
const serviceTokens = [new OpaqueToken('service1'), new OpaqueToken('service2')];
const resourceID = "9978";
- const paginationOptions = { "resultsPerPage": 10, "currentPage": 1 };
+ const paginationOptions: PaginationOptions = {
+ "id": "test",
+ "currentPage": 1,
+ "pageSizeOptions": [5, 10, 20, 40, 60, 80, 100],
+ "disabled": false,
+ "boundaryLinks": false,
+ "directionLinks": true,
+ "ellipses": true,
+ "maxSize": 0,
+ "pageSize": 10,
+ "rotate": false,
+ "size": 'sm'
+ };
const sortOptions = { "field": "id", "direction": 0 };
const timestamp = new Date().getTime();
const validCacheEntry = (key) => {
diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts
index 5aa2b149a5..5cc690ed80 100644
--- a/src/app/core/core.module.ts
+++ b/src/app/core/core.module.ts
@@ -1,5 +1,6 @@
import { NgModule, Optional, SkipSelf, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
+
import { SharedModule } from "../shared/shared.module";
import { isNotEmpty } from "../shared/empty.util";
import { FooterComponent } from "./footer/footer.component";
@@ -8,6 +9,7 @@ import { ObjectCacheService } from "./cache/object-cache.service";
import { RequestCacheService } from "./cache/request-cache.service";
import { CollectionDataService } from "./data-services/collection-data.service";
import { ItemDataService } from "./data-services/item-data.service";
+import { PaginationOptions } from "./shared/pagination-options.model";
const IMPORTS = [
CommonModule,
@@ -27,6 +29,7 @@ const PROVIDERS = [
ItemDataService,
DSpaceRESTv2Service,
ObjectCacheService,
+ PaginationOptions,
RequestCacheService
];
diff --git a/src/app/core/shared/pagination-options.model.ts b/src/app/core/shared/pagination-options.model.ts
index 3ab67e1e79..211e9b392d 100644
--- a/src/app/core/shared/pagination-options.model.ts
+++ b/src/app/core/shared/pagination-options.model.ts
@@ -1,12 +1,20 @@
-export class PaginationOptions {
+import { NgbPaginationConfig } from '@ng-bootstrap/ng-bootstrap';
+
+export class PaginationOptions extends NgbPaginationConfig {
/**
- * The number of results per page.
+ * ID for the pagination instance. Only useful if you wish to
+ * have more than once instance at a time in a given component.
*/
- resultsPerPage: number = 10;
+ id: string;
/**
* The active page.
*/
currentPage: number = 1;
+ /**
+ * A number array that represents options for a context pagination limit.
+ */
+ pageSizeOptions: Array = [ 5, 10, 20, 40, 60, 80, 100 ];
+
}
diff --git a/src/app/header/header.component.html b/src/app/header/header.component.html
index a4b7cf117c..5dac95d946 100644
--- a/src/app/header/header.component.html
+++ b/src/app/header/header.component.html
@@ -1,14 +1,14 @@
-