mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-15 23:49:31 +00:00
Implemented the ability to set user-defined synonyms/labels for internal element types
* Implementiere bevorzugte Sprachauswahl und Datenquellen-Synonyme Die Spracheinstellungen/System-Settings wurden um die Möglichkeit ergänzt, bevorzugte Sprachen für die Dropdown-Menüs festzulegen. Zudem wurde ein Datenquellen-Synonymsystem implementiert, um benutzerfreundlichere Bezeichnungen anzuzeigen und zu personalisieren. * Anpassung aus Analyse * Entferne alten JSON-basierten Datenquellen-Synonym-Handler Die Verwaltung der Datenquellen-Synonyme wurde überarbeitet, um ein flexibleres und strukturiertes Konzept zu ermöglichen. Der bestehende JSON-basierte Ansatz wurde durch eine neue Service-basierte Architektur ersetzt, die eine bessere Handhabung und Erweiterbarkeit erlaubt. * Ermögliche Rückgabe aller möglichen Sprachoptionen in Verbindung mit den vom Nutzer freigeschalteten. * Removed unnecessary service definition The tag is applied via autoconfiguration * Use default translations for the NotBlank constraint * Started refactoring ElementTypeNameGenerator * Made ElementTypeNameGenerator class readonly * Modified form to work properly with new datastructure * Made the form more beautiful and space saving * Made synonym form even more space saving * Allow to define overrides for any element label there is * Use defined synonyms in ElementTypeNameGenerator * Use ElementTypeNameGenerator where possible * Register synonyms for element types as global translation parameters * Revert changes done to permission layout * Use new synonym system for admin page titles * Removed now unnecessary services * Reworked settings name and translation * Renamed all files to Synonyms * Removed unnecessary translations * Removed unnecessary translations * Fixed duplicate check * Renamed synoynms translations * Use our synonyms for permission translations * Fixed phpstan issue * Added tests --------- Co-authored-by: Marcel Diegelmann <marcel.diegelmann@gmail.com> Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
This commit is contained in:
parent
5e3bd26e27
commit
54f318ecac
43 changed files with 1504 additions and 335 deletions
|
|
@ -1,13 +1,15 @@
|
|||
{% macro sidebar_dropdown() %}
|
||||
{% set currentLocale = app.request.locale %}
|
||||
|
||||
{# Format is [mode, route, label, show_condition] #}
|
||||
{% set data_sources = [
|
||||
['categories', path('tree_category_root'), 'category.labelp', is_granted('@categories.read') and is_granted('@parts.read')],
|
||||
['locations', path('tree_location_root'), 'storelocation.labelp', is_granted('@storelocations.read') and is_granted('@parts.read')],
|
||||
['footprints', path('tree_footprint_root'), 'footprint.labelp', is_granted('@footprints.read') and is_granted('@parts.read')],
|
||||
['manufacturers', path('tree_manufacturer_root'), 'manufacturer.labelp', is_granted('@manufacturers.read') and is_granted('@parts.read')],
|
||||
['suppliers', path('tree_supplier_root'), 'supplier.labelp', is_granted('@suppliers.read') and is_granted('@parts.read')],
|
||||
['projects', path('tree_device_root'), 'project.labelp', is_granted('@projects.read')],
|
||||
['tools', path('tree_tools'), 'tools.label', true],
|
||||
['categories', path('tree_category_root'), '@category@@', is_granted('@categories.read') and is_granted('@parts.read')],
|
||||
['locations', path('tree_location_root'), '@storage_location@@', is_granted('@storelocations.read') and is_granted('@parts.read'), ],
|
||||
['footprints', path('tree_footprint_root'), '@footprint@@', is_granted('@footprints.read') and is_granted('@parts.read')],
|
||||
['manufacturers', path('tree_manufacturer_root'), '@manufacturer@@', is_granted('@manufacturers.read') and is_granted('@parts.read'), 'manufacturer'],
|
||||
['suppliers', path('tree_supplier_root'), '@supplier@@', is_granted('@suppliers.read') and is_granted('@parts.read'), 'supplier'],
|
||||
['projects', path('tree_device_root'), '@project@@', is_granted('@projects.read'), 'project'],
|
||||
['tools', path('tree_tools'), 'tools.label', true, 'tool'],
|
||||
] %}
|
||||
|
||||
<li class="dropdown-header">{% trans %}actions{% endtrans %}</li>
|
||||
|
|
@ -18,9 +20,20 @@
|
|||
|
||||
{% for source in data_sources %}
|
||||
{% if source[3] %} {# show_condition #}
|
||||
<li><button class="tree-btns dropdown-item" data-mode="{{ source[0] }}" data-url="{{ source[1] }}" data-text="{{ source[2] | trans }}"
|
||||
{{ stimulus_action('elements/sidebar_tree', 'changeDataSource') }}
|
||||
>{{ source[2] | trans }}</button></li>
|
||||
<li>
|
||||
{% if source[2] starts with '@' %}
|
||||
{% set label = type_label_p(source[2]|replace({'@': ''})) %}
|
||||
{% else %}
|
||||
{% set label = source[2]|trans %}
|
||||
{% endif %}
|
||||
|
||||
<button class="tree-btns dropdown-item"
|
||||
data-mode="{{ source[0] }}"
|
||||
data-url="{{ source[1] }}"
|
||||
data-text="{{ label }}"
|
||||
{{ stimulus_action('elements/sidebar_tree', 'changeDataSource') }}
|
||||
>{{ label }}</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
|
@ -61,4 +74,4 @@
|
|||
|
||||
<div class="treeview-sm mt-2" {{ stimulus_target('elements/tree', 'tree') }}></div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue