Skip to content

Commit 5728f35

Browse files
authored
Merge pull request #1885 from mspalti/entity-thumbnail
Removed thumbnails from relationship modal
2 parents 1d4f2ed + e572e4f commit 5728f35

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

src/app/item-page/edit-item-page/virtual-metadata/virtual-metadata.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div>
1+
<div [ngClass]="showThumbnails ? 'hide-modal-thumbnail-column' : ''">
22
<div class="modal-header">{{'virtual-metadata.delete-relationship.modal-head' | translate}}
33
<button type="button" class="close" (click)="close.emit()" aria-label="Close">
44
<span aria-hidden="true">×</span>

src/app/item-page/edit-item-page/virtual-metadata/virtual-metadata.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { VirtualMetadataComponent } from './virtual-metadata.component';
77
import { Item } from '../../../core/shared/item.model';
88
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
99
import { VarDirective } from '../../../shared/utils/var.directive';
10+
import { APP_CONFIG } from '../../../../config/app-config.interface';
11+
import { environment } from '../../../../environments/environment';
1012

1113
describe('VirtualMetadataComponent', () => {
1214

@@ -46,6 +48,7 @@ describe('VirtualMetadataComponent', () => {
4648
declarations: [VirtualMetadataComponent, VarDirective],
4749
providers: [
4850
{ provide: ObjectUpdatesService, useValue: objectUpdatesService },
51+
{ provide: APP_CONFIG, useValue: environment }
4952
], schemas: [
5053
NO_ERRORS_SCHEMA
5154
]

src/app/item-page/edit-item-page/virtual-metadata/virtual-metadata.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
1+
import { Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
22
import {Observable} from 'rxjs';
33
import {Item} from '../../../core/shared/item.model';
44
import {MetadataValue} from '../../../core/shared/metadata.models';
55
import {ObjectUpdatesService} from '../../../core/data/object-updates/object-updates.service';
6+
import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface';
67

78
@Component({
89
selector: 'ds-virtual-metadata',
@@ -45,6 +46,12 @@ export class VirtualMetadataComponent implements OnInit {
4546
*/
4647
@Output() save = new EventEmitter();
4748

49+
/**
50+
* Indicates when thumbnails are required by configuration and therefore
51+
* need to be hidden in the modal layout.
52+
*/
53+
showThumbnails: boolean;
54+
4855
/**
4956
* Get an array of the left and the right item of the relationship to be deleted.
5057
*/
@@ -56,7 +63,9 @@ export class VirtualMetadataComponent implements OnInit {
5663

5764
constructor(
5865
protected objectUpdatesService: ObjectUpdatesService,
66+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
5967
) {
68+
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
6069
}
6170

6271
/**

src/styles/_global-styles.scss

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,29 @@ ds-dynamic-form-control-container.d-none {
138138
.btn-dark {
139139
background-color: var(--ds-admin-sidebar-bg);
140140
}
141+
142+
.preserve-line-breaks {
143+
white-space: pre-line;
144+
}
145+
146+
/* Thumbnail styles */
147+
.hide-placeholder-text {
148+
.thumbnail-placeholder {
149+
color: transparent !important;
150+
}
151+
}
152+
153+
/* Used to hide the thumbnail column in modals. */
154+
.hide-modal-thumbnail-column {
155+
.modal-body ds-listable-object-component-loader div.row > div:first-child {
156+
display: none;
157+
}
158+
.modal-body ds-listable-object-component-loader div.row > div:nth-child(2) {
159+
flex: 0 0 100%;
160+
max-width: 100%;
161+
}
162+
}
163+
141164
/* The font sizes used in "no thumbnail" placeholder */
142165
.thumb-font-0 {
143166
.thumbnail-placeholder {
@@ -153,13 +176,6 @@ ds-dynamic-form-control-container.d-none {
153176
padding: 0.1rem;
154177
}
155178
}
156-
157-
.hide-placeholder-text {
158-
.thumbnail-placeholder {
159-
color: transparent !important;
160-
}
161-
}
162-
163179
.thumb-font-1 {
164180
.thumbnail-placeholder {
165181
@media screen and (max-width: map-get($grid-breakpoints, sm)) {
@@ -170,7 +186,7 @@ ds-dynamic-form-control-container.d-none {
170186
font-size: 0.4rem;
171187
padding: 0.1rem;
172188
}
173-
font-size: 0.6rem;
189+
font-size: 0.5rem;
174190
padding: 0.125rem;
175191
}
176192
}
@@ -187,6 +203,4 @@ ds-dynamic-form-control-container.d-none {
187203
}
188204
}
189205

190-
.preserve-line-breaks {
191-
white-space: pre-line;
192-
}
206+

0 commit comments

Comments
 (0)