Skip to content

Commit

Permalink
108588: Removed the community & collection parts from the browse sect…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
alexandrevryghem committed Dec 12, 2023
1 parent 501896d commit fe1cc83
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent imp
*/
defaultMetadataKeys = ['dc.date.issued'];

public constructor(protected route: ActivatedRoute,
protected browseService: BrowseService,
protected dsoService: DSpaceObjectDataService,
protected router: Router,
protected paginationService: PaginationService,
protected cdRef: ChangeDetectorRef,
@Inject(APP_CONFIG) public appConfig: AppConfig,
public dsoNameService: DSONameService,
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,
protected cdRef: ChangeDetectorRef,
) {
super(route, browseService, dsoService, paginationService, router, appConfig, dsoNameService);
}
Expand All @@ -71,8 +72,6 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent imp
this.startsWith = +params.startsWith || params.startsWith;
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails);
this.updatePageWithItems(searchOptions, this.value, undefined);
this.updateParent(params.scope);
this.updateLogo();
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
<ds-browse-by *ngIf="startsWithOptions" class="col-xs-12 w-100"
title="{{'browse.title' | translate:
{
collection: dsoNameService.getName((parent$ | async)?.payload),
field: 'browse.metadata.' + browseId | translate,
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '&quot;' + startsWith + '&quot;' }) : '',
value: (value)? '&quot;' + value + '&quot;': ''
} }}"
parentname="{{dsoNameService.getName((parent$ | async)?.payload)}}"
[objects$]="(items$ !== undefined)? items$ : browseEntries$"
[paginationConfig]="(currentPagination$ |async)"
[sortConfig]="(currentSort$ |async)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ describe('BrowseByMetadataPageComponent', () => {

route.params = observableOf(paramsWithValue);
comp.ngOnInit();
comp.updateParent('fake-scope');
comp.updateLogo();
fixture.detectChanges();
});

Expand All @@ -154,10 +152,6 @@ describe('BrowseByMetadataPageComponent', () => {
expect(result.payload.page).toEqual(mockItems);
});
});

it('should fetch the logo', () => {
expect(comp.logo$).toBeTruthy();
});
});

describe('when calling browseParamsToOptions', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ import { Item } from '../../core/shared/item.model';
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
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 { PaginationService } from '../../core/pagination/pagination.service';
import { filter, map, mergeMap } 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 { map } from 'rxjs/operators';
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
Expand Down Expand Up @@ -52,16 +47,6 @@ export class BrowseByMetadataPageComponent extends AbstractBrowseByTypeComponent
*/
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
*/
Expand Down Expand Up @@ -170,8 +155,6 @@ export class BrowseByMetadataPageComponent extends AbstractBrowseByTypeComponent
} else {
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
}
this.updateParent(params.scope);
this.updateLogo();
}));
this.updateStartsWithTextOptions();

Expand Down Expand Up @@ -211,37 +194,6 @@ export class BrowseByMetadataPageComponent extends AbstractBrowseByTypeComponent
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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
@rendersBrowseBy(BrowseByDataType.Title)
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 {
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
// include the thumbnail configuration in browse search options
Expand All @@ -47,14 +36,12 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent im
this.subs.push(
observableCombineLatest([this.route.params, this.route.queryParams, this.currentPagination$, this.currentSort$]).pipe(
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]) => {
this.startsWith = +params.startsWith || params.startsWith;
this.browseId = params.id || this.defaultBrowseId;
this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
this.updateParent(params.scope);
this.updateLogo();
}));
this.updateStartsWithTextOptions();
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/browse-by/browse-by.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 { BrowseBySwitcherComponent } from './browse-by-switcher/browse-by-switcher.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 { DsoPageModule } from '../shared/dso-page/dso-page.module';
import { FormModule } from '../shared/form/form.module';
Expand All @@ -26,7 +25,6 @@ const ENTRY_COMPONENTS = [
imports: [
SharedBrowseByModule,
CommonModule,
ComcolModule,
DsoPageModule,
FormModule,
],
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/browse-by/browse-by.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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>
<div *ngIf="objects?.hasSucceeded && !objects?.isLoading && objects?.payload?.page.length > 0" @fadeIn>
<div *ngIf="shouldDisplayResetButton$ |async" class="mb-2 reset">
Expand Down
4 changes: 0 additions & 4 deletions src/app/shared/browse-by/browse-by.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export class BrowseByComponent implements OnInit, OnDestroy {
*/
@Input() title: string;

/**
* The parent name
*/
@Input() parentname: string;
/**
* The list of objects to display
*/
Expand Down
6 changes: 4 additions & 2 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@

"browse.metadata.title": "Title",

"browse.metadata.srsc": "Subject Category",

"browse.metadata.author.breadcrumbs": "Browse by Author",

"browse.metadata.dateissued.breadcrumbs": "Browse by Date",
Expand Down Expand Up @@ -862,9 +864,9 @@

"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",

Expand Down

0 comments on commit fe1cc83

Please sign in to comment.