Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-1841 (pull request DSpace#2013)
Browse files Browse the repository at this point in the history
Task/dspace cris 2023 02 x/DSC-1841

Approved-by: Andrea Barbasso
  • Loading branch information
atarix83 authored and Andrea Barbasso committed Jul 29, 2024
2 parents f37dc08 + 0c1a726 commit f402dcd
Show file tree
Hide file tree
Showing 47 changed files with 186 additions and 30 deletions.
2 changes: 2 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ browseBy:
fiveYearLimit: 30
# The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
defaultLowerLimit: 1900
# Whether to add item badges to BOTH browse and search result lists.
showLabels: true
# If true, thumbnail images for items will be added to BOTH search and browse result lists.
showThumbnails: true
# The number of entries in a paginated browse results list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
<ds-themed-item-list-preview [item]="match"
[object]="itemPreviewObject"
[metadataList]="metadataList"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showThumbnails]="showThumbnails">
</ds-themed-item-list-preview>
<div class="offset-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[index]="i"
[listID]="paginatedSearchOptions.configuration"
[object]="object"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showThumbnails]="showThumbnails"
[viewMode]="paginatedSearchOptions.view"></ds-listable-object-component-loader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ export class BrowseMostElementsComponent implements OnInit {
@Input() paginatedSearchOptions: PaginatedSearchOptions;

@Input() context: Context;
/**
* Whether to show the badge label or not
*/
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
*/
@Input() showMetrics;
@Input() showMetrics: boolean;

/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

searchResults: RemoteData<PaginatedList<SearchResult<DSpaceObject>>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ export class ThemedBrowseMostElementsComponent extends ThemedComponent<BrowseMos

@Input() paginatedSearchOptions: PaginatedSearchOptions;

@Input() showMetrics;
@Input() showLabel: boolean;

@Input() showThumbnails;
@Input() showMetrics: boolean;

protected inAndOutputNames: (keyof BrowseMostElementsComponent & keyof this)[] = ['context', 'paginatedSearchOptions', 'showMetrics', 'showThumbnails'];
@Input() showThumbnails: boolean;

protected inAndOutputNames: (keyof BrowseMostElementsComponent & keyof this)[] = ['context', 'paginatedSearchOptions', 'showLabel', 'showMetrics', 'showThumbnails'];

protected getComponentName(): string {
return 'BrowseMostElementsComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<div *ngIf="topSection.titleKey" class="card-header">{{ 'explore.index.' + topSection.titleKey | translate }}</div>
<div *ngIf="!topSection.titleKey" class="card-header">{{ 'explore.index.' + topSection.sortField | translate }}</div>
<div class="card-body p-0">
<ds-themed-browse-most-elements [context]="context" [paginatedSearchOptions]="paginatedSearchOptions" [showThumbnails]="showThumbnails"></ds-themed-browse-most-elements>
<ds-themed-browse-most-elements [context]="context"
[paginatedSearchOptions]="paginatedSearchOptions"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showThumbnails]="showThumbnails"></ds-themed-browse-most-elements>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class TopSectionComponent implements OnInit {

paginatedSearchOptions: PaginatedSearchOptions;

showLabel: boolean;

showMetrics = true;

showThumbnails: boolean;

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[linkType]="linkType"
[context]="context"
[hidePaginationDetail]="hidePaginationDetail"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
Expand Down Expand Up @@ -37,6 +38,7 @@
[linkType]="linkType"
[context]="context"
[hidePaginationDetail]="hidePaginationDetail"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
Expand All @@ -55,6 +57,7 @@
[linkType]="linkType"
[context]="context"
[hidePaginationDetail]="hidePaginationDetail"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export class ObjectCollectionComponent implements OnInit {
*/
@Input() hidePaginationDetail = false;

/**
* Whether to show the badge label or not
*/
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
*/
Expand All @@ -123,7 +128,7 @@ export class ObjectCollectionComponent implements OnInit {
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

/**
* Whether or not to show an alert for hidden related items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
/**
* Whether to show the badge label or not
*/
@Input() showLabel = true;
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
Expand All @@ -78,7 +78,7 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnChanges
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

/**
* The value to display for this element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AbstractListableElementComponent<T extends ListableObject> {
/**
* Whether to show the badge label or not
*/
@Input() showLabel = true;
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
Expand All @@ -50,7 +50,7 @@ export class AbstractListableElementComponent<T extends ListableObject> {
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

/**
* The context we matched on to get this component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ng-container *ngIf="(workflowitem$ | async) && (item$ | async)">
<ds-item-detail-preview [item]="item$?.value"
[object]="object"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[badgeContext]="badgeContext">
</ds-item-detail-preview>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div *ngIf="item" class="item-page" @fadeInOut>
<ds-themed-badges [object]="item" [context]="badgeContext"></ds-themed-badges>
<ds-themed-badges *ngIf="showLabel" [object]="item" [context]="badgeContext"></ds-themed-badges>
<div *ngIf="item">
<ds-themed-item-page-title-field [item]="item">
</ds-themed-item-page-title-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export class ItemDetailPreviewComponent {
*/
@Input() badgeContext: Context;

/**
* Whether to show the badge label or not
*/
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
*/
@Input() showMetrics = true;

/**
* A boolean representing if to show submitter information
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ds-item-detail-preview [item]="dso"
[object]="object"
[badgeContext]="badgeContext">
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics">
</ds-item-detail-preview>

<ds-item-actions [object]="dso"></ds-item-actions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ng-container *ngIf="(workflowitem$ | async) && (item$ | async)">
<ds-item-detail-preview [item]="item$?.value"
[object]="object"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[badgeContext]="badgeContext"></ds-item-detail-preview>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ds-item-detail-preview [item]="item"
[object]="object"
[badgeContext]="badgeContext"></ds-item-detail-preview>
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics"></ds-item-detail-preview>

<ds-workflowitem-actions [object]="dso"></ds-workflowitem-actions>

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<ds-item-detail-preview [item]="item"
[object]="object"
[badgeContext]="badgeContext"></ds-item-detail-preview>
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics"></ds-item-detail-preview>

<ds-workspaceitem-actions [object]="dso"></ds-workspaceitem-actions>
1 change: 1 addition & 0 deletions src/app/shared/object-detail/object-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ds-listable-object-component-loader [object]="object"
[viewMode]="viewMode"
[context]="context"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showThumbnails]="showThumbnails"
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
Expand Down
7 changes: 6 additions & 1 deletion src/app/shared/object-detail/object-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export class ObjectDetailComponent {
*/
@Input() context: Context;

/**
* Whether to show the badge label or not
*/
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
*/
Expand All @@ -72,7 +77,7 @@ export class ObjectDetailComponent {
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

/**
* Emit when one of the listed object has changed.
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/object-grid/object-grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ds-listable-object-component-loader [object]="object"
[viewMode]="viewMode"
[context]="context"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showThumbnails]="showThumbnails"
[linkType]="linkType"></ds-listable-object-component-loader>
Expand Down
7 changes: 6 additions & 1 deletion src/app/shared/object-grid/object-grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export class ObjectGridComponent implements OnInit {
*/
@Input() sortConfig: SortOptions;

/**
* Whether to show the badge label or not
*/
@Input() showLabel: boolean;

/**
* Whether to show the metrics badges
*/
Expand All @@ -63,7 +68,7 @@ export class ObjectGridComponent implements OnInit {
/**
* Whether to show the thumbnail preview
*/
@Input() showThumbnails;
@Input() showThumbnails: boolean;

/**
* The whether or not the gear is hidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ <h4 class="alert-heading mb-0">{{ 'claimed-approved-search-result-list-element.t
[item]="(workflowitem?.item | async)?.payload"
[object]="object"
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[showThumbnails]="showThumbnails"></ds-themed-item-list-preview>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ <h4 class="alert-heading mb-0">{{ 'claimed-declined-search-result-list-element.t
[item]="(workflowitem?.item | async)?.payload"
[object]="object"
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[showThumbnails]="showThumbnails"></ds-themed-item-list-preview>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ <h4 class="alert-heading mb-0">{{ 'claimed-declined-task-search-result-list-elem
[item]="(workflowitem?.item | async)?.payload"
[object]="object"
[badgeContext]="badgeContext"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[showThumbnails]="showThumbnails">
</ds-themed-item-list-preview>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ng-container *ngIf="(workflowitem$ | async) && (item$ | async)">
<ds-themed-item-list-preview [item]="item$.value"
[object]="object"
[showLabel]="showLabel"
[showMetrics]="showMetrics"
[showSubmitter]="showSubmitter"
[showThumbnails]="showThumbnails"
[badgeContext]="badgeContext"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div [ngClass]="showThumbnails ? 'col-9 col-xl-10' : 'col-md-12'">
<div *ngIf="item" @fadeInOut>
<div class="d-flex">
<ds-themed-badges [object]="item" [context]="badgeContext" [showAccessStatus]="true"></ds-themed-badges>
<ds-themed-badges *ngIf="showLabel" [object]="item" [context]="badgeContext" [showAccessStatus]="true"></ds-themed-badges>
</div>
<ds-truncatable [id]="item.id">
<h3 [innerHTML]="dsoTitle" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ describe('ItemListPreviewComponent', () => {
});
});

describe('When the item has an entity type', () => {
describe('When the item has an entity type and showLabel is true', () => {
beforeEach(() => {
component.item = mockItemWithEntityType;
component.showLabel = true;
fixture.detectChanges();
});

Expand All @@ -184,6 +185,19 @@ describe('ItemListPreviewComponent', () => {
expect(entityField).not.toBeNull();
});
});

describe('When the item has an entity type and showLabel is false', () => {
beforeEach(() => {
component.item = mockItemWithEntityType;
component.showLabel = false;
fixture.detectChanges();
});

it('should not show the badges', () => {
const entityField = fixture.debugElement.query(By.css('ds-themed-badges'));
expect(entityField).toBeNull();
});
});
});

describe('ItemListPreviewComponent', () => {
Expand Down
Loading

0 comments on commit f402dcd

Please sign in to comment.