Skip to content

Commit dc81a5b

Browse files
committed
Moved SHOW_PART_IMAGE_OVERLAY to settings-bundle
1 parent a4f2a7a commit dc81a5b

File tree

7 files changed

+65
-6
lines changed

7 files changed

+65
-6
lines changed

.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ REDIRECT_TO_HTTPS=0
133133
# When this is empty the content of config/banner.md is used as banner
134134
BANNER=""
135135

136-
# Enable the part image overlay which shows name and filename of the picture
137-
SHOW_PART_IMAGE_OVERLAY=1
138-
139136
APP_ENV=prod
140137
APP_SECRET=a03498528f5a5fc089273ec9ae5b2849
141138

config/packages/twig.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ twig:
1717
available_themes: '%partdb.available_themes%'
1818
saml_enabled: '%partdb.saml.enabled%'
1919
part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator'
20-
img_overlay: '%partdb.show_part_image_overlay%'
2120

2221
when@test:
2322
twig:

config/parameters.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ parameters:
4848
# Miscellaneous
4949
######################################################################################################################
5050
partdb.demo_mode: '%env(bool:DEMO_MODE)%' # If set to true, all potentially dangerous things are disabled (like changing passwords of the own user)
51-
partdb.show_part_image_overlay: '%env(bool:SHOW_PART_IMAGE_OVERLAY)%' # If set to false, the filename overlay of the part image will be disabled
5251

5352
# Set the themes from which the user can choose from in the settings.
5453
# Themes commented here by default, are not really usable, because of display problems. Enable them at your own risk!

src/Settings/BehaviorSettings/BehaviorSettings.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ class BehaviorSettings
3737

3838
#[EmbeddedSettings]
3939
public ?TableSettings $table = null;
40+
41+
#[EmbeddedSettings]
42+
public ?PartInfoSettings $partInfo = null;
4043
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/*
3+
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
4+
*
5+
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Affero General Public License as published
9+
* by the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
declare(strict_types=1);
22+
23+
24+
namespace App\Settings\BehaviorSettings;
25+
26+
use App\Settings\SettingsIcon;
27+
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
28+
use Jbtronics\SettingsBundle\Settings\Settings;
29+
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
30+
use Symfony\Component\Translation\TranslatableMessage as TM;
31+
32+
#[Settings(name: "part_info", label: new TM("settings.behavior.part_info"))]
33+
#[SettingsIcon('fa-circle-info')]
34+
class PartInfoSettings
35+
{
36+
/**
37+
* Whether to show the part image overlays in the part info view
38+
* @var bool
39+
*/
40+
#[SettingsParameter(label: new TM("settings.behavior.part_info.show_part_image_overlay"), description: new TM("settings.behavior.part_info.show_part_image_overlay.help"),
41+
envVar: "bool:SHOW_PART_IMAGE_OVERLAY", envVarMode: EnvVarMode::OVERWRITE)]
42+
public bool $showPartImageOverlay = true;
43+
}

templates/parts/info/_picture.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div class="carousel-item {% if loop.first %}active{% endif %}">
1414
<a href="{{ entity_url(pic, 'file_view') }}" data-turbo="false" target="_blank" rel="noopener">
1515
<img class="d-block w-100 img-fluid img-thumbnail bg-light part-info-image" src="{{ entity_url(pic, 'file_view') }}" alt="">
16-
{% if img_overlay %}
16+
{% if settings_instance("part_info").showPartImageOverlay %}
1717
<div class="mask"></div>
1818
<div class="carousel-caption-hover">
1919
<div class="carousel-caption text-white">

translations/messages.en.xlf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12994,5 +12994,23 @@ Please note, that you can not impersonate a disabled user. If you try you will g
1299412994
<target>If you need exchange rates between non-euro currencies, you can input an API key from fixer.io here.</target>
1299512995
</segment>
1299612996
</unit>
12997+
<unit id="Ffr5xYM" name="settings.behavior.part_info">
12998+
<segment>
12999+
<source>settings.behavior.part_info</source>
13000+
<target>Part info page</target>
13001+
</segment>
13002+
</unit>
13003+
<unit id="weH3j.a" name="settings.behavior.part_info.show_part_image_overlay">
13004+
<segment>
13005+
<source>settings.behavior.part_info.show_part_image_overlay</source>
13006+
<target>Show image overlay</target>
13007+
</segment>
13008+
</unit>
13009+
<unit id="SCUs3WS" name="settings.behavior.part_info.show_part_image_overlay.help">
13010+
<segment>
13011+
<source>settings.behavior.part_info.show_part_image_overlay.help</source>
13012+
<target>Show the image overlay with attachment details on hovering over the part image gallery.</target>
13013+
</segment>
13014+
</unit>
1299713015
</file>
1299813016
</xliff>

0 commit comments

Comments
 (0)