mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
108588: Removed the community & collection parts from the browse sections
This commit is contained in:
@@ -40,14 +40,15 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent imp
|
|||||||
*/
|
*/
|
||||||
defaultMetadataKeys = ['dc.date.issued'];
|
defaultMetadataKeys = ['dc.date.issued'];
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
public constructor(
|
||||||
protected browseService: BrowseService,
|
protected route: ActivatedRoute,
|
||||||
protected dsoService: DSpaceObjectDataService,
|
protected browseService: BrowseService,
|
||||||
protected router: Router,
|
protected dsoService: DSpaceObjectDataService,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected cdRef: ChangeDetectorRef,
|
protected router: Router,
|
||||||
@Inject(APP_CONFIG) public appConfig: AppConfig,
|
@Inject(APP_CONFIG) public appConfig: AppConfig,
|
||||||
public dsoNameService: DSONameService,
|
public dsoNameService: DSONameService,
|
||||||
|
protected cdRef: ChangeDetectorRef,
|
||||||
) {
|
) {
|
||||||
super(route, browseService, dsoService, paginationService, router, appConfig, dsoNameService);
|
super(route, browseService, dsoService, paginationService, router, appConfig, dsoNameService);
|
||||||
}
|
}
|
||||||
@@ -71,8 +72,6 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent imp
|
|||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails);
|
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails);
|
||||||
this.updatePageWithItems(searchOptions, this.value, undefined);
|
this.updatePageWithItems(searchOptions, this.value, undefined);
|
||||||
this.updateParent(params.scope);
|
|
||||||
this.updateLogo();
|
|
||||||
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
|
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@@ -4,12 +4,10 @@
|
|||||||
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
|
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
|
||||||
title="{{'browse.title' | translate:
|
title="{{'browse.title' | translate:
|
||||||
{
|
{
|
||||||
collection: dsoNameService.getName((parent$ | async)?.payload),
|
|
||||||
field: 'browse.metadata.' + browseId | translate,
|
field: 'browse.metadata.' + browseId | translate,
|
||||||
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '"' + startsWith + '"' }) : '',
|
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '"' + startsWith + '"' }) : '',
|
||||||
value: (value)? '"' + value + '"': ''
|
value: (value)? '"' + value + '"': ''
|
||||||
} }}"
|
} }}"
|
||||||
parentname="{{dsoNameService.getName((parent$ | async)?.payload)}}"
|
|
||||||
[objects$]="(items$ !== undefined)? items$ : browseEntries$"
|
[objects$]="(items$ !== undefined)? items$ : browseEntries$"
|
||||||
[paginationConfig]="(currentPagination$ |async)"
|
[paginationConfig]="(currentPagination$ |async)"
|
||||||
[sortConfig]="(currentSort$ |async)"
|
[sortConfig]="(currentSort$ |async)"
|
||||||
|
@@ -144,8 +144,6 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
|
|
||||||
route.params = observableOf(paramsWithValue);
|
route.params = observableOf(paramsWithValue);
|
||||||
comp.ngOnInit();
|
comp.ngOnInit();
|
||||||
comp.updateParent('fake-scope');
|
|
||||||
comp.updateLogo();
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -154,10 +152,6 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
expect(result.payload.page).toEqual(mockItems);
|
expect(result.payload.page).toEqual(mockItems);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch the logo', () => {
|
|
||||||
expect(comp.logo$).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when calling browseParamsToOptions', () => {
|
describe('when calling browseParamsToOptions', () => {
|
||||||
|
@@ -12,14 +12,9 @@ import { Item } from '../../core/shared/item.model';
|
|||||||
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
||||||
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
|
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { filter, map, mergeMap } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
|
||||||
import { Bitstream } from '../../core/shared/bitstream.model';
|
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
|
||||||
import { Community } from '../../core/shared/community.model';
|
|
||||||
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
|
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
@@ -62,16 +57,6 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
items$: Observable<RemoteData<PaginatedList<Item>>>;
|
items$: Observable<RemoteData<PaginatedList<Item>>>;
|
||||||
|
|
||||||
/**
|
|
||||||
* The current Community or Collection we're browsing metadata/items in
|
|
||||||
*/
|
|
||||||
parent$: Observable<RemoteData<DSpaceObject>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The logo of the current Community or Collection
|
|
||||||
*/
|
|
||||||
logo$: Observable<RemoteData<Bitstream>>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pagination config used to display the values
|
* The pagination config used to display the values
|
||||||
*/
|
*/
|
||||||
@@ -184,8 +169,6 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
|
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
|
||||||
}
|
}
|
||||||
this.updateParent(params.scope);
|
|
||||||
this.updateLogo();
|
|
||||||
}));
|
}));
|
||||||
this.updateStartsWithTextOptions();
|
this.updateStartsWithTextOptions();
|
||||||
|
|
||||||
@@ -225,37 +208,6 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
|
|||||||
this.items$ = this.browseService.getBrowseItemsFor(value, authority, searchOptions);
|
this.items$ = this.browseService.getBrowseItemsFor(value, authority, searchOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the parent Community or Collection using their scope
|
|
||||||
* @param scope The UUID of the Community or Collection to fetch
|
|
||||||
*/
|
|
||||||
updateParent(scope: string) {
|
|
||||||
if (hasValue(scope)) {
|
|
||||||
const linksToFollow = () => {
|
|
||||||
return [followLink('logo')];
|
|
||||||
};
|
|
||||||
this.parent$ = this.dsoService.findById(scope,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
...linksToFollow() as FollowLinkConfig<DSpaceObject>[]).pipe(
|
|
||||||
getFirstSucceededRemoteData()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the parent Community or Collection logo
|
|
||||||
*/
|
|
||||||
updateLogo() {
|
|
||||||
if (hasValue(this.parent$)) {
|
|
||||||
this.logo$ = this.parent$.pipe(
|
|
||||||
map((rd: RemoteData<Collection | Community>) => rd.payload),
|
|
||||||
filter((collectionOrCommunity: Collection | Community) => hasValue(collectionOrCommunity.logo)),
|
|
||||||
mergeMap((collectionOrCommunity: Collection | Community) => collectionOrCommunity.logo)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to the previous page
|
* Navigate to the previous page
|
||||||
*/
|
*/
|
||||||
|
@@ -1,18 +1,13 @@
|
|||||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
import { combineLatest as observableCombineLatest } from 'rxjs';
|
||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { Params } from '@angular/router';
|
||||||
import {
|
import {
|
||||||
BrowseByMetadataPageComponent,
|
BrowseByMetadataPageComponent,
|
||||||
browseParamsToOptions, getBrowseSearchOptions
|
browseParamsToOptions, getBrowseSearchOptions
|
||||||
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface';
|
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
|
||||||
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
|
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
|
||||||
|
|
||||||
@@ -27,17 +22,6 @@ import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
|
|||||||
@rendersBrowseBy(BrowseByDataType.Title)
|
@rendersBrowseBy(BrowseByDataType.Title)
|
||||||
export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent implements OnInit {
|
export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent implements OnInit {
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
|
||||||
protected browseService: BrowseService,
|
|
||||||
protected dsoService: DSpaceObjectDataService,
|
|
||||||
protected paginationService: PaginationService,
|
|
||||||
protected router: Router,
|
|
||||||
@Inject(APP_CONFIG) public appConfig: AppConfig,
|
|
||||||
public dsoNameService: DSONameService,
|
|
||||||
) {
|
|
||||||
super(route, browseService, dsoService, paginationService, router, appConfig, dsoNameService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
||||||
// include the thumbnail configuration in browse search options
|
// include the thumbnail configuration in browse search options
|
||||||
@@ -47,14 +31,12 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent im
|
|||||||
this.subs.push(
|
this.subs.push(
|
||||||
observableCombineLatest([this.route.params, this.route.queryParams, this.currentPagination$, this.currentSort$]).pipe(
|
observableCombineLatest([this.route.params, this.route.queryParams, this.currentPagination$, this.currentSort$]).pipe(
|
||||||
map(([routeParams, queryParams, currentPage, currentSort]) => {
|
map(([routeParams, queryParams, currentPage, currentSort]) => {
|
||||||
return [Object.assign({}, routeParams, queryParams),currentPage,currentSort];
|
return [Object.assign({}, routeParams, queryParams), currentPage, currentSort];
|
||||||
})
|
})
|
||||||
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
|
this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
|
||||||
this.updateParent(params.scope);
|
|
||||||
this.updateLogo();
|
|
||||||
}));
|
}));
|
||||||
this.updateStartsWithTextOptions();
|
this.updateStartsWithTextOptions();
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,6 @@ import { BrowseByMetadataPageComponent } from './browse-by-metadata-page/browse-
|
|||||||
import { BrowseByDatePageComponent } from './browse-by-date-page/browse-by-date-page.component';
|
import { BrowseByDatePageComponent } from './browse-by-date-page/browse-by-date-page.component';
|
||||||
import { BrowseBySwitcherComponent } from './browse-by-switcher/browse-by-switcher.component';
|
import { BrowseBySwitcherComponent } from './browse-by-switcher/browse-by-switcher.component';
|
||||||
import { BrowseByTaxonomyPageComponent } from './browse-by-taxonomy-page/browse-by-taxonomy-page.component';
|
import { BrowseByTaxonomyPageComponent } from './browse-by-taxonomy-page/browse-by-taxonomy-page.component';
|
||||||
import { ComcolModule } from '../shared/comcol/comcol.module';
|
|
||||||
import { SharedBrowseByModule } from '../shared/browse-by/shared-browse-by.module';
|
import { SharedBrowseByModule } from '../shared/browse-by/shared-browse-by.module';
|
||||||
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
|
import { DsoPageModule } from '../shared/dso-page/dso-page.module';
|
||||||
import { FormModule } from '../shared/form/form.module';
|
import { FormModule } from '../shared/form/form.module';
|
||||||
@@ -26,7 +25,6 @@ const ENTRY_COMPONENTS = [
|
|||||||
imports: [
|
imports: [
|
||||||
SharedBrowseByModule,
|
SharedBrowseByModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ComcolModule,
|
|
||||||
DsoPageModule,
|
DsoPageModule,
|
||||||
FormModule,
|
FormModule,
|
||||||
],
|
],
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<ng-container *ngVar="(objects$ | async) as objects">
|
<ng-container *ngVar="(objects$ | async) as objects">
|
||||||
<h3 [ngClass]="{'sr-only': parentname }">{{title | translate}}</h3>
|
<h3>{{title | translate}}</h3>
|
||||||
<ng-container *ngComponentOutlet="getStartsWithComponent(); injector: objectInjector;"></ng-container>
|
<ng-container *ngComponentOutlet="getStartsWithComponent(); injector: objectInjector;"></ng-container>
|
||||||
<div *ngIf="objects?.hasSucceeded && !objects?.isLoading && objects?.payload?.page.length > 0" @fadeIn>
|
<div *ngIf="objects?.hasSucceeded && !objects?.isLoading && objects?.payload?.page.length > 0" @fadeIn>
|
||||||
<div *ngIf="shouldDisplayResetButton$ |async" class="mb-2 reset">
|
<div *ngIf="shouldDisplayResetButton$ |async" class="mb-2 reset">
|
||||||
|
@@ -38,10 +38,6 @@ export class BrowseByComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
@Input() title: string;
|
@Input() title: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* The parent name
|
|
||||||
*/
|
|
||||||
@Input() parentname: string;
|
|
||||||
/**
|
/**
|
||||||
* The list of objects to display
|
* The list of objects to display
|
||||||
*/
|
*/
|
||||||
|
@@ -796,6 +796,8 @@
|
|||||||
|
|
||||||
"browse.metadata.title": "Title",
|
"browse.metadata.title": "Title",
|
||||||
|
|
||||||
|
"browse.metadata.srsc": "Subject Category",
|
||||||
|
|
||||||
"browse.metadata.author.breadcrumbs": "Browse by Author",
|
"browse.metadata.author.breadcrumbs": "Browse by Author",
|
||||||
|
|
||||||
"browse.metadata.dateissued.breadcrumbs": "Browse by Date",
|
"browse.metadata.dateissued.breadcrumbs": "Browse by Date",
|
||||||
@@ -862,9 +864,9 @@
|
|||||||
|
|
||||||
"browse.taxonomy.button": "Browse",
|
"browse.taxonomy.button": "Browse",
|
||||||
|
|
||||||
"browse.title": "Browsing {{ collection }} by {{ field }}{{ startsWith }} {{ value }}",
|
"browse.title": "Browsing by {{ field }}{{ startsWith }} {{ value }}",
|
||||||
|
|
||||||
"browse.title.page": "Browsing {{ collection }} by {{ field }} {{ value }}",
|
"browse.title.page": "Browsing by {{ field }} {{ value }}",
|
||||||
|
|
||||||
"search.browse.item-back": "Back to Results",
|
"search.browse.item-back": "Back to Results",
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user