diff --git a/.env b/.env index 3b82f715..a95b46fb 100644 --- a/.env +++ b/.env @@ -133,9 +133,6 @@ REDIRECT_TO_HTTPS=0 # When this is empty the content of config/banner.md is used as banner BANNER="" -# Enable the part image overlay which shows name and filename of the picture -SHOW_PART_IMAGE_OVERLAY=1 - APP_ENV=prod APP_SECRET=a03498528f5a5fc089273ec9ae5b2849 diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f113c254..674aa317 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -17,7 +17,6 @@ twig: available_themes: '%partdb.available_themes%' saml_enabled: '%partdb.saml.enabled%' part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator' - img_overlay: '%partdb.show_part_image_overlay%' when@test: twig: diff --git a/config/parameters.yaml b/config/parameters.yaml index 8a798913..311b567c 100644 --- a/config/parameters.yaml +++ b/config/parameters.yaml @@ -48,7 +48,6 @@ parameters: # 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.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. # Themes commented here by default, are not really usable, because of display problems. Enable them at your own risk! diff --git a/src/Settings/BehaviorSettings/BehaviorSettings.php b/src/Settings/BehaviorSettings/BehaviorSettings.php index 97a1759e..1251a097 100644 --- a/src/Settings/BehaviorSettings/BehaviorSettings.php +++ b/src/Settings/BehaviorSettings/BehaviorSettings.php @@ -37,4 +37,7 @@ class BehaviorSettings #[EmbeddedSettings] public ?TableSettings $table = null; + + #[EmbeddedSettings] + public ?PartInfoSettings $partInfo = null; } \ No newline at end of file diff --git a/src/Settings/BehaviorSettings/PartInfoSettings.php b/src/Settings/BehaviorSettings/PartInfoSettings.php new file mode 100644 index 00000000..4c44b9bb --- /dev/null +++ b/src/Settings/BehaviorSettings/PartInfoSettings.php @@ -0,0 +1,43 @@ +. + */ + +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; +} \ No newline at end of file diff --git a/templates/parts/info/_picture.html.twig b/templates/parts/info/_picture.html.twig index 6bfb2472..e6aa74b3 100644 --- a/templates/parts/info/_picture.html.twig +++ b/templates/parts/info/_picture.html.twig @@ -13,7 +13,7 @@