Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1602 Insufficient collection information when submitting an article #3327

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ds-truncatable-part [maxLines]="1" [background]="isCurrent() ? 'primary' : 'default'" [showToggle]="false">
<ds-truncatable-part [background]="isCurrent() ? 'primary' : 'default'" [showToggle]="false">
<div [ngClass]="isCurrent() ? 'text-light' : 'text-body'"
[innerHTML]="(parentTitle$ && parentTitle$ | async) ? (parentTitle$ | async) : ('home.breadcrumbs' | translate)"></div>
</ds-truncatable-part>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import {
find,
map,
switchMap,
} from 'rxjs/operators';

import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
Expand Down Expand Up @@ -68,7 +69,7 @@ export class SidebarSearchListElementComponent<T extends SearchResult<K>, K exte
ngOnInit(): void {
super.ngOnInit();
if (hasValue(this.dso)) {
this.parentTitle$ = this.getParentTitle();
this.parentTitle$ = this.getHierarchicalName();
this.description = this.getDescription();
}
}
Expand All @@ -92,6 +93,33 @@ export class SidebarSearchListElementComponent<T extends SearchResult<K>, K exte
);
}

getHierarchicalName(): Observable<string> {
return this.getParentTitle().pipe(
switchMap((parentTitle: string) => {
return this.getParent().pipe(
switchMap((parentRD: RemoteData<DSpaceObject>) => {
if (hasValue(parentRD) && hasValue(parentRD.payload)) {
const parentInstance = this.createInstanceFromDSpaceObject(parentRD.payload);
return parentInstance.getHierarchicalName().pipe(
map((ancestorName: string) => ancestorName ? `${ancestorName} > ${parentTitle}` : parentTitle),
);
}
return observableOf(parentTitle);
}),
);
}),
);
}

/**
* Utility method to create an instance of the current class from a DSpaceObject
*/
private createInstanceFromDSpaceObject(dso: DSpaceObject): this {
const instance = Object.create(this);
instance.dso = dso;
return instance;
}

/**
* Get the parent of the object
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
.removeFaded.content::after {
display: none;
}

.content {
white-space: normal;
overflow: visible;
}
Loading