mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Allow to configure the global theme using the WebUI
This commit is contained in:
parent
3e657a7cac
commit
f88584e1ca
5 changed files with 16 additions and 6 deletions
|
@ -7,7 +7,6 @@ twig:
|
|||
|
||||
globals:
|
||||
default_currency: '%partdb.default_currency%'
|
||||
global_theme: '%partdb.global_theme%'
|
||||
allow_email_pw_reset: '%partdb.users.email_pw_reset%'
|
||||
locale_menu: '%partdb.locale_menu%'
|
||||
attachment_manager: '@App\Services\Attachments\AttachmentManager'
|
||||
|
|
|
@ -11,7 +11,6 @@ parameters:
|
|||
# This is used as workaround for places where we can not access the settings directly (like the 2FA application names)
|
||||
partdb.title: '%env(string:settings:customization:instanceName)%' # The title shown inside of Part-DB (e.g. in the navbar and on homepage)
|
||||
partdb.default_currency: '%env(string:BASE_CURRENCY)%' # The currency that is used inside the DB (and is assumed when no currency is set). This can not be changed later, so be sure to set it the currency used in your country
|
||||
partdb.global_theme: '' # The theme to use globally (see public/build/themes/ for choices, use name without .css). Set to '' for default bootstrap theme
|
||||
partdb.locale_menu: ['en', 'de', 'it', 'fr', 'ru', 'ja', 'cs', 'da', 'zh'] # The languages that are shown in user drop down menu
|
||||
partdb.enforce_change_comments_for: '%env(csv:ENFORCE_CHANGE_COMMENTS_FOR)%' # The actions for which a change comment is required (e.g. "part_edit", "part_create", etc.). If this is empty, change comments are not required at all.
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ declare(strict_types=1);
|
|||
namespace App\Settings\SystemSettings;
|
||||
|
||||
use App\Form\Type\RichTextEditorType;
|
||||
use App\Form\Type\ThemeChoiceType;
|
||||
use App\Validator\Constraints\ValidTheme;
|
||||
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
||||
use Jbtronics\SettingsBundle\Settings\Settings;
|
||||
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
|
||||
|
@ -48,4 +50,10 @@ class CustomizationSettings
|
|||
)]
|
||||
public ?string $banner = null;
|
||||
|
||||
#[SettingsParameter(
|
||||
label: new TM("settings.system.customization.theme"),
|
||||
formType: ThemeChoiceType::class, formOptions: ['placeholder' => false]
|
||||
)]
|
||||
#[ValidTheme]
|
||||
public string $theme = 'bootstrap';
|
||||
}
|
|
@ -40,14 +40,12 @@
|
|||
|
||||
|
||||
|
||||
{% if not app.user.theme is defined %}
|
||||
{% set theme = global_theme %}
|
||||
{% if app.user.theme is not defined or app.user.theme is null %}
|
||||
{% set theme = settings_instance('customization').theme %}
|
||||
{% else %}
|
||||
{% set theme = app.user.theme %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{% if theme and theme in available_themes and encore_entry_exists('theme_' ~ theme) %}
|
||||
{{ encore_entry_link_tags('theme_' ~ theme) }}
|
||||
{% else %}
|
||||
|
|
|
@ -12467,5 +12467,11 @@ Please note, that you can not impersonate a disabled user. If you try you will g
|
|||
<target>Save removed data in log entries on element deletion</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="8665ItM" name="settings.system.customization.theme">
|
||||
<segment>
|
||||
<source>settings.system.customization.theme</source>
|
||||
<target>Global theme</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue