From 4ccd19081a86212794ff02d243d8d27d4f865e04 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 29 Jan 2019 15:47:32 +0100 Subject: [PATCH 01/16] 59415: Possibility to browse-by using a scope --- .../browse-by-author-page.component.ts | 4 +++- .../browse-by-title-page.component.ts | 7 +++++-- src/app/core/browse/browse.service.ts | 4 ++++ src/app/navbar/navbar.component.ts | 10 ---------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.ts b/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.ts index 813ee8a32f..6299dd896b 100644 --- a/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.ts +++ b/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.ts @@ -57,6 +57,7 @@ export class BrowseByAuthorPageComponent implements OnInit { const pageSize = +params.pageSize || this.paginationConfig.pageSize; const sortDirection = params.sortDirection || this.sortConfig.direction; const sortField = params.sortField || this.sortConfig.field; + const scope = params.scope; this.value = +params.value || params.value || ''; const pagination = Object.assign({}, this.paginationConfig, @@ -68,7 +69,8 @@ export class BrowseByAuthorPageComponent implements OnInit { ); const searchOptions = { pagination: pagination, - sort: sort + sort: sort, + scope: scope }; if (isNotEmpty(this.value)) { this.updatePageWithItems(searchOptions, this.value); diff --git a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.ts b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.ts index e9127dbbab..b5e9eb2427 100644 --- a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.ts +++ b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.ts @@ -56,6 +56,7 @@ export class BrowseByTitlePageComponent implements OnInit { const pageSize = +params.pageSize || this.paginationConfig.pageSize; const sortDirection = params.sortDirection || this.sortConfig.direction; const sortField = params.sortField || this.sortConfig.field; + const scopeID = params.scope; const pagination = Object.assign({}, this.paginationConfig, { currentPage: page, pageSize: pageSize } @@ -66,7 +67,8 @@ export class BrowseByTitlePageComponent implements OnInit { ); this.updatePage({ pagination: pagination, - sort: sort + sort: sort, + scopeID: scopeID }); })); } @@ -81,7 +83,8 @@ export class BrowseByTitlePageComponent implements OnInit { this.items$ = this.itemDataService.findAll({ currentPage: searchOptions.pagination.currentPage, elementsPerPage: searchOptions.pagination.pageSize, - sort: searchOptions.sort + sort: searchOptions.sort, + scopeID: searchOptions.scopeID }); } diff --git a/src/app/core/browse/browse.service.ts b/src/app/core/browse/browse.service.ts index ddce277e7e..9293343c24 100644 --- a/src/app/core/browse/browse.service.ts +++ b/src/app/core/browse/browse.service.ts @@ -90,6 +90,7 @@ export class BrowseService { getBrowseEntriesFor(definitionID: string, options: { pagination?: PaginationComponentOptions; sort?: SortOptions; + scope?: string; } = {}): Observable>> { const request$ = this.getBrowseDefinitions().pipe( getBrowseDefinitionLinks(definitionID), @@ -99,6 +100,9 @@ export class BrowseService { map((href: string) => { // TODO nearly identical to PaginatedSearchOptions => refactor const args = []; + if (isNotEmpty(options.sort)) { + args.push(`scope=${options.scope}`); + } if (isNotEmpty(options.sort)) { args.push(`sort=${options.sort.field},${options.sort.direction}`); } diff --git a/src/app/navbar/navbar.component.ts b/src/app/navbar/navbar.component.ts index 54d409d751..92bd0cd633 100644 --- a/src/app/navbar/navbar.component.ts +++ b/src/app/navbar/navbar.component.ts @@ -63,16 +63,6 @@ export class NavbarComponent extends MenuComponent implements OnInit { } as LinkMenuItemModel, }, { - id: 'browse_global_global_by_issue_date', - parentID: 'browse_global', - active: false, - visible: true, - model: { - type: MenuItemType.LINK, - text: 'menu.section.browse_global_by_issue_date', - link: '#' - } as LinkMenuItemModel, - }, { id: 'browse_global_global_by_title', parentID: 'browse_global', active: false, From 0312e659a48d296cdf81c14d24487aba17515eec Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 29 Jan 2019 16:07:53 +0100 Subject: [PATCH 02/16] 59415: Browse-By links on community and collection pages' --- src/app/+collection-page/collection-page.component.html | 2 ++ src/app/+community-page/community-page.component.html | 2 ++ .../comcol-page-browse-by.component.html | 5 +++++ .../comcol-page-browse-by.component.ts | 9 +++++++++ src/app/shared/shared.module.ts | 2 ++ 5 files changed, 20 insertions(+) create mode 100644 src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html create mode 100644 src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts diff --git a/src/app/+collection-page/collection-page.component.html b/src/app/+collection-page/collection-page.component.html index a233163070..bc283968df 100644 --- a/src/app/+collection-page/collection-page.component.html +++ b/src/app/+collection-page/collection-page.component.html @@ -33,6 +33,8 @@ [content]="collection.license" [title]="'collection.page.license'"> + + diff --git a/src/app/+community-page/community-page.component.html b/src/app/+community-page/community-page.component.html index a86a86c3da..ff62cda945 100644 --- a/src/app/+community-page/community-page.component.html +++ b/src/app/+community-page/community-page.component.html @@ -24,6 +24,8 @@ [content]="communityPayload.copyrightText" [hasInnerHtml]="true"> + + diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html new file mode 100644 index 0000000000..5750a909b5 --- /dev/null +++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.html @@ -0,0 +1,5 @@ +

Browse

+ diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts new file mode 100644 index 0000000000..a1d286992d --- /dev/null +++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -0,0 +1,9 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'ds-comcol-page-browse-by', + templateUrl: './comcol-page-browse-by.component.html', +}) +export class ComcolPageBrowseByComponent { + @Input() id: string; +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 3561576046..5a7541018b 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -87,6 +87,7 @@ import { ObjectKeysPipe } from './utils/object-keys-pipe'; import { MomentModule } from 'ngx-moment'; import { MenuModule } from './menu/menu.module'; import {LangSwitchComponent} from './lang-switch/lang-switch.component'; +import { ComcolPageBrowseByComponent } from './comcol-page-browse-by/comcol-page-browse-by.component'; const MODULES = [ // Do NOT include UniversalModule, HttpModule, or JsonpModule here @@ -130,6 +131,7 @@ const COMPONENTS = [ ComcolPageContentComponent, ComcolPageHeaderComponent, ComcolPageLogoComponent, + ComcolPageBrowseByComponent, DsDynamicFormComponent, DsDynamicFormControlComponent, DsDynamicListComponent, From 551ed18fe580cfbf855d9ea760369fccca3b26f0 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 29 Jan 2019 16:18:46 +0100 Subject: [PATCH 03/16] 59415: Allow scope in browse-by-value --- src/app/core/browse/browse.service.ts | 4 ++++ .../browse-entry-list-element.component.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/core/browse/browse.service.ts b/src/app/core/browse/browse.service.ts index 9293343c24..8e2c288ae8 100644 --- a/src/app/core/browse/browse.service.ts +++ b/src/app/core/browse/browse.service.ts @@ -149,6 +149,7 @@ export class BrowseService { getBrowseItemsFor(definitionID: string, filterValue: string, options: { pagination?: PaginationComponentOptions; sort?: SortOptions; + scope?: string; } = {}): Observable>> { const request$ = this.getBrowseDefinitions().pipe( getBrowseDefinitionLinks(definitionID), @@ -157,6 +158,9 @@ export class BrowseService { hasValueOperator(), map((href: string) => { const args = []; + if (isNotEmpty(options.sort)) { + args.push(`scope=${options.scope}`); + } if (isNotEmpty(options.sort)) { args.push(`sort=${options.sort.field},${options.sort.direction}`); } diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.html b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.html index 198e79b453..6139e4a9df 100644 --- a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.html +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.html @@ -1,5 +1,5 @@
- + {{object.value}}   From 3fdd32b383c4913080cbe6709120f4fd9f8be443 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 29 Jan 2019 17:00:25 +0100 Subject: [PATCH 04/16] 59415: Refactored Browse-By-Author to Browse-By-Metadata to support multiple metadata definitions --- resources/i18n/en.json | 7 +- .../browse-by-metadata-page.component.html} | 6 +- .../browse-by-metadata-page.component.scss} | 0 .../browse-by-metadata-page.component.ts} | 68 ++++++++++++++++--- .../browse-by-title-page.component.html | 2 +- .../+browse-by/browse-by-routing.module.ts | 4 +- src/app/+browse-by/browse-by.module.ts | 4 +- 7 files changed, 71 insertions(+), 20 deletions(-) rename src/app/+browse-by/{+browse-by-author-page/browse-by-author-page.component.html => +browse-by-metadata-page/browse-by-metadata-page.component.html} (56%) rename src/app/+browse-by/{+browse-by-author-page/browse-by-author-page.component.scss => +browse-by-metadata-page/browse-by-metadata-page.component.scss} (100%) rename src/app/+browse-by/{+browse-by-author-page/browse-by-author-page.component.ts => +browse-by-metadata-page/browse-by-metadata-page.component.ts} (64%) diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 4db7e4a3d4..229d278327 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -280,7 +280,12 @@ } }, "browse": { - "title": "Browsing {{ collection }} by {{ field }} {{ value }}" + "title": "Browsing {{ collection }} by {{ field }} {{ value }}", + "metadata": { + "title": "Title", + "author": "Author", + "subject": "Subject" + } }, "admin": { "registries": { diff --git a/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.html b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.html similarity index 56% rename from src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.html rename to src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.html index 438c318994..c67096e29e 100644 --- a/src/app/+browse-by/+browse-by-author-page/browse-by-author-page.component.html +++ b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.html @@ -1,8 +1,8 @@
-
+