Skip to content

Commit

Permalink
Merge pull request DSpace#1885 from mspalti/entity-thumbnail
Browse files Browse the repository at this point in the history
Removed thumbnails from relationship modal
  • Loading branch information
tdonohue authored Oct 6, 2022
2 parents 1d4f2ed + e572e4f commit 5728f35
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<div [ngClass]="showThumbnails ? 'hide-modal-thumbnail-column' : ''">
<div class="modal-header">{{'virtual-metadata.delete-relationship.modal-head' | translate}}
<button type="button" class="close" (click)="close.emit()" aria-label="Close">
<span aria-hidden="true">×</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { VirtualMetadataComponent } from './virtual-metadata.component';
import { Item } from '../../../core/shared/item.model';
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
import { VarDirective } from '../../../shared/utils/var.directive';
import { APP_CONFIG } from '../../../../config/app-config.interface';
import { environment } from '../../../../environments/environment';

describe('VirtualMetadataComponent', () => {

Expand Down Expand Up @@ -46,6 +48,7 @@ describe('VirtualMetadataComponent', () => {
declarations: [VirtualMetadataComponent, VarDirective],
providers: [
{ provide: ObjectUpdatesService, useValue: objectUpdatesService },
{ provide: APP_CONFIG, useValue: environment }
], schemas: [
NO_ERRORS_SCHEMA
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import { Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
import {Observable} from 'rxjs';
import {Item} from '../../../core/shared/item.model';
import {MetadataValue} from '../../../core/shared/metadata.models';
import {ObjectUpdatesService} from '../../../core/data/object-updates/object-updates.service';
import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface';

@Component({
selector: 'ds-virtual-metadata',
Expand Down Expand Up @@ -45,6 +46,12 @@ export class VirtualMetadataComponent implements OnInit {
*/
@Output() save = new EventEmitter();

/**
* Indicates when thumbnails are required by configuration and therefore
* need to be hidden in the modal layout.
*/
showThumbnails: boolean;

/**
* Get an array of the left and the right item of the relationship to be deleted.
*/
Expand All @@ -56,7 +63,9 @@ export class VirtualMetadataComponent implements OnInit {

constructor(
protected objectUpdatesService: ObjectUpdatesService,
@Inject(APP_CONFIG) protected appConfig: AppConfig,
) {
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}

/**
Expand Down
36 changes: 25 additions & 11 deletions src/styles/_global-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ ds-dynamic-form-control-container.d-none {
.btn-dark {
background-color: var(--ds-admin-sidebar-bg);
}

.preserve-line-breaks {
white-space: pre-line;
}

/* Thumbnail styles */
.hide-placeholder-text {
.thumbnail-placeholder {
color: transparent !important;
}
}

/* Used to hide the thumbnail column in modals. */
.hide-modal-thumbnail-column {
.modal-body ds-listable-object-component-loader div.row > div:first-child {
display: none;
}
.modal-body ds-listable-object-component-loader div.row > div:nth-child(2) {
flex: 0 0 100%;
max-width: 100%;
}
}

/* The font sizes used in "no thumbnail" placeholder */
.thumb-font-0 {
.thumbnail-placeholder {
Expand All @@ -153,13 +176,6 @@ ds-dynamic-form-control-container.d-none {
padding: 0.1rem;
}
}

.hide-placeholder-text {
.thumbnail-placeholder {
color: transparent !important;
}
}

.thumb-font-1 {
.thumbnail-placeholder {
@media screen and (max-width: map-get($grid-breakpoints, sm)) {
Expand All @@ -170,7 +186,7 @@ ds-dynamic-form-control-container.d-none {
font-size: 0.4rem;
padding: 0.1rem;
}
font-size: 0.6rem;
font-size: 0.5rem;
padding: 0.125rem;
}
}
Expand All @@ -187,6 +203,4 @@ ds-dynamic-form-control-container.d-none {
}
}

.preserve-line-breaks {
white-space: pre-line;
}

0 comments on commit 5728f35

Please sign in to comment.