Moved SHOW_PART_IMAGE_OVERLAY to settings-bundle

This commit is contained in:
Jan Böhmer 2025-07-06 21:53:06 +02:00
parent a4f2a7a7df
commit dc81a5b361
7 changed files with 65 additions and 6 deletions

3
.env
View file

@ -133,9 +133,6 @@ REDIRECT_TO_HTTPS=0
# When this is empty the content of config/banner.md is used as banner # When this is empty the content of config/banner.md is used as banner
BANNER="" BANNER=""
# Enable the part image overlay which shows name and filename of the picture
SHOW_PART_IMAGE_OVERLAY=1
APP_ENV=prod APP_ENV=prod
APP_SECRET=a03498528f5a5fc089273ec9ae5b2849 APP_SECRET=a03498528f5a5fc089273ec9ae5b2849

View file

@ -17,7 +17,6 @@ twig:
available_themes: '%partdb.available_themes%' available_themes: '%partdb.available_themes%'
saml_enabled: '%partdb.saml.enabled%' saml_enabled: '%partdb.saml.enabled%'
part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator' part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator'
img_overlay: '%partdb.show_part_image_overlay%'
when@test: when@test:
twig: twig:

View file

@ -48,7 +48,6 @@ parameters:
# Miscellaneous # Miscellaneous
###################################################################################################################### ######################################################################################################################
partdb.demo_mode: '%env(bool:DEMO_MODE)%' # If set to true, all potentially dangerous things are disabled (like changing passwords of the own user) partdb.demo_mode: '%env(bool:DEMO_MODE)%' # If set to true, all potentially dangerous things are disabled (like changing passwords of the own user)
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
# Set the themes from which the user can choose from in the settings. # Set the themes from which the user can choose from in the settings.
# Themes commented here by default, are not really usable, because of display problems. Enable them at your own risk! # Themes commented here by default, are not really usable, because of display problems. Enable them at your own risk!

View file

@ -37,4 +37,7 @@ class BehaviorSettings
#[EmbeddedSettings] #[EmbeddedSettings]
public ?TableSettings $table = null; public ?TableSettings $table = null;
#[EmbeddedSettings]
public ?PartInfoSettings $partInfo = null;
} }

View file

@ -0,0 +1,43 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Settings\BehaviorSettings;
use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Symfony\Component\Translation\TranslatableMessage as TM;
#[Settings(name: "part_info", label: new TM("settings.behavior.part_info"))]
#[SettingsIcon('fa-circle-info')]
class PartInfoSettings
{
/**
* Whether to show the part image overlays in the part info view
* @var bool
*/
#[SettingsParameter(label: new TM("settings.behavior.part_info.show_part_image_overlay"), description: new TM("settings.behavior.part_info.show_part_image_overlay.help"),
envVar: "bool:SHOW_PART_IMAGE_OVERLAY", envVarMode: EnvVarMode::OVERWRITE)]
public bool $showPartImageOverlay = true;
}

View file

@ -13,7 +13,7 @@
<div class="carousel-item {% if loop.first %}active{% endif %}"> <div class="carousel-item {% if loop.first %}active{% endif %}">
<a href="{{ entity_url(pic, 'file_view') }}" data-turbo="false" target="_blank" rel="noopener"> <a href="{{ entity_url(pic, 'file_view') }}" data-turbo="false" target="_blank" rel="noopener">
<img class="d-block w-100 img-fluid img-thumbnail bg-light part-info-image" src="{{ entity_url(pic, 'file_view') }}" alt=""> <img class="d-block w-100 img-fluid img-thumbnail bg-light part-info-image" src="{{ entity_url(pic, 'file_view') }}" alt="">
{% if img_overlay %} {% if settings_instance("part_info").showPartImageOverlay %}
<div class="mask"></div> <div class="mask"></div>
<div class="carousel-caption-hover"> <div class="carousel-caption-hover">
<div class="carousel-caption text-white"> <div class="carousel-caption text-white">

View file

@ -12994,5 +12994,23 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>If you need exchange rates between non-euro currencies, you can input an API key from fixer.io here.</target> <target>If you need exchange rates between non-euro currencies, you can input an API key from fixer.io here.</target>
</segment> </segment>
</unit> </unit>
<unit id="Ffr5xYM" name="settings.behavior.part_info">
<segment>
<source>settings.behavior.part_info</source>
<target>Part info page</target>
</segment>
</unit>
<unit id="weH3j.a" name="settings.behavior.part_info.show_part_image_overlay">
<segment>
<source>settings.behavior.part_info.show_part_image_overlay</source>
<target>Show image overlay</target>
</segment>
</unit>
<unit id="SCUs3WS" name="settings.behavior.part_info.show_part_image_overlay.help">
<segment>
<source>settings.behavior.part_info.show_part_image_overlay.help</source>
<target>Show the image overlay with attachment details on hovering over the part image gallery.</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>