Improved styling of image in structural entity select

This commit is contained in:
Jan Böhmer 2023-02-05 20:23:52 +01:00
parent 08b60cd149
commit 5ea791eac7
3 changed files with 23 additions and 4 deletions

View file

@ -83,7 +83,7 @@ export default class extends Controller {
} }
name += "<b>" + escape(data.text) + "</b>"; name += "<b>" + escape(data.text) + "</b>";
return '<div>' + (data.image ? "<img style='max-height: 1.5rem; max-width: 2rem; margin-right: 5px;' ' src='" + data.image + "'/>" : "") + name + '</div>'; return '<div>' + (data.image ? "<img class='structural-entity-select-image' style='margin-right: 5px;' ' src='" + data.image + "'/>" : "") + name + '</div>';
} }
renderOption(data, escape) { renderOption(data, escape) {
@ -117,7 +117,7 @@ export default class extends Controller {
let image = ""; let image = "";
if (data.image) { if (data.image) {
image = '<img style="max-height: 1.5rem; max-width: 2rem; margin-left: 5px;" src="' + data.image + '"/>'; image = '<img class="structural-entity-select-image" style="margin-left: 5px;" src="' + data.image + '"/>';
} }
return '<div>' + level_html + escape(data.text) + image + symbol_badge + parent_badge + filter_badge + '</div>'; return '<div>' + level_html + escape(data.text) + image + symbol_badge + parent_badge + filter_badge + '</div>';

View file

@ -30,8 +30,20 @@
} }
.avatar-xs { .avatar-xs {
height: 1.2rem; height: 1.2em;
width: 1.2rem; width: 1.2em;
object-fit: cover; object-fit: cover;
border-radius: 5px; border-radius: 5px;
}
.entity-image-xs {
height: 1.2em;
width: 2.0em;
object-fit: contain;
}
.structural-entity-select-image {
height: 1.5em;
max-width: 2.0em;
object-fit: contain;
} }

View file

@ -181,6 +181,13 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro entity_preview_xs(entity) %}
{# @var entity \App\Entity\Contracts\HasMasterAttachmentInterface #}
{% if entity.masterPictureAttachment and entity.masterPictureAttachment.picture and attachment_manager.fileExisting(entity.masterPictureAttachment) %}
<img src="{{ attachment_thumbnail(entity.masterPictureAttachment, 'thumbnail_xs') }}" class="entity-image-xs">
{% endif %}
{% endmacro %}
{% macro parameters_table(parameters) %} {% macro parameters_table(parameters) %}
<table class="table table-hover table-striped table-sm"> <table class="table table-hover table-striped table-sm">
<thead> <thead>