Skip to content

Commit ecd2abe

Browse files
committed
Made image size of preview images in tables configurable and slightly bigger by default
This makes PR #984 and #623 obsolete
1 parent 0d1ae03 commit ecd2abe

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

assets/css/app/images.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919

2020
.hoverpic {
21-
min-width: 10px;
22-
max-width: 30px;
21+
min-width: var(--table-image-preview-min-size, 20px);
22+
max-width: var(--table-image-preview-max-size, 35px);
2323
display: block;
2424
margin-left: auto;
2525
margin-right: auto;
@@ -49,7 +49,7 @@
4949
}
5050

5151
.part-table-image {
52-
max-height: 40px;
52+
max-height: calc(1.2*var(--table-image-preview-max-size, 35px)); /** Aspect ratio of maximum 1.2 */
5353
object-fit: contain;
5454
}
5555

src/Settings/BehaviorSettings/TableSettings.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ class TableSettings
7070
PartTableColumns::CATEGORY, PartTableColumns::FOOTPRINT, PartTableColumns::MANUFACTURER,
7171
PartTableColumns::LOCATION, PartTableColumns::AMOUNT];
7272

73+
#[SettingsParameter(label: new TM("settings.behavior.table.preview_image_min_width"),
74+
formOptions: ['attr' => ['min' => 1, 'max' => 100]],
75+
envVar: "int:TABLE_IMAGE_PREVIEW_MIN_SIZE", envVarMode: EnvVarMode::OVERWRITE
76+
)]
77+
#[Assert\Range(min: 1, max: 100)]
78+
public int $previewImageMinWidth = 20;
79+
80+
#[SettingsParameter(label: new TM("settings.behavior.table.preview_image_max_width"),
81+
formOptions: ['attr' => ['min' => 1, 'max' => 100]],
82+
envVar: "int:TABLE_IMAGE_PREVIEW_MAX_SIZE", envVarMode: EnvVarMode::OVERWRITE
83+
)]
84+
#[Assert\Range(min: 1, max: 100)]
85+
#[Assert\GreaterThanOrEqual(propertyPath: 'previewImageMinWidth')]
86+
public int $previewImageMaxWidth = 35;
7387

7488
public static function mapPartsDefaultColumnsEnv(string $columns): array
7589
{
@@ -87,4 +101,4 @@ public static function mapPartsDefaultColumnsEnv(string $columns): array
87101
return $ret;
88102
}
89103

90-
}
104+
}

templates/base.html.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@
5353
{% endif %}
5454

5555
{{ encore_entry_link_tags('app') }}
56+
57+
{% set table_settings = settings_instance('table') %}
58+
<style nonce="{{ csp_nonce('style') }}">
59+
:root {
60+
--table-image-preview-min-size: {{ table_settings.previewImageMinWidth }}px;
61+
--table-image-preview-max-size: {{ table_settings.previewImageMaxWidth }}px;
62+
}
63+
</style>
5664
{% endblock %}
5765
5866
{% block javascripts %}

translations/messages.en.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13489,5 +13489,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
1348913489
<target>These providers will be preselected for searches in part providers.</target>
1349013490
</segment>
1349113491
</unit>
13492+
<unit id="dv6eslZ" name="settings.behavior.table.preview_image_max_width">
13493+
<segment>
13494+
<source>settings.behavior.table.preview_image_max_width</source>
13495+
<target>Preview image max width (px)</target>
13496+
</segment>
13497+
</unit>
13498+
<unit id="5bOoqEL" name="settings.behavior.table.preview_image_min_width">
13499+
<segment>
13500+
<source>settings.behavior.table.preview_image_min_width</source>
13501+
<target>Preview image min width (px)</target>
13502+
</segment>
13503+
</unit>
1349213504
</file>
1349313505
</xliff>

0 commit comments

Comments
 (0)