mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 19:19:29 +00:00
Renamed all files to Synonyms
This commit is contained in:
parent
446f4a662d
commit
1234f447fd
9 changed files with 79 additions and 29 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
twig:
|
twig:
|
||||||
default_path: '%kernel.project_dir%/templates'
|
default_path: '%kernel.project_dir%/templates'
|
||||||
form_themes: ['bootstrap_5_horizontal_layout.html.twig', 'form/extended_bootstrap_layout.html.twig', 'form/permission_layout.html.twig', 'form/filter_types_layout.html.twig', 'form/datasource_synonyms_collection.html.twig']
|
form_themes: ['bootstrap_5_horizontal_layout.html.twig', 'form/extended_bootstrap_layout.html.twig', 'form/permission_layout.html.twig', 'form/filter_types_layout.html.twig', 'form/synonyms_collection.html.twig']
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
'%kernel.project_dir%/assets/css': css
|
'%kernel.project_dir%/assets/css': css
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,11 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
namespace App\Form\Type;
|
namespace App\Form\Settings;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
|
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
|
|
||||||
use Symfony\Component\Intl\Languages;
|
use Symfony\Component\Intl\Languages;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
|
@ -20,28 +20,26 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Form\Type;
|
namespace App\Form\Settings;
|
||||||
|
|
||||||
use App\Services\ElementTypes;
|
use App\Services\ElementTypes;
|
||||||
use App\Settings\SystemSettings\LocalizationSettings;
|
use App\Settings\SystemSettings\LocalizationSettings;
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
|
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Intl\Locales;
|
use Symfony\Component\Intl\Locales;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single translation row: data source + language + translations (singular/plural).
|
* A single translation row: data source + language + translations (singular/plural).
|
||||||
*/
|
*/
|
||||||
class DataSourceSynonymRowType extends AbstractType
|
class TypeSynonymRowType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
||||||
private const PREFFERED_TYPES = [
|
private const PREFERRED_TYPES = [
|
||||||
ElementTypes::CATEGORY,
|
ElementTypes::CATEGORY,
|
||||||
ElementTypes::STORAGE_LOCATION,
|
ElementTypes::STORAGE_LOCATION,
|
||||||
ElementTypes::FOOTPRINT,
|
ElementTypes::FOOTPRINT,
|
||||||
|
|
@ -62,14 +60,13 @@ class DataSourceSynonymRowType extends AbstractType
|
||||||
->add('dataSource', EnumType::class, [
|
->add('dataSource', EnumType::class, [
|
||||||
'class' => ElementTypes::class,
|
'class' => ElementTypes::class,
|
||||||
'label' => false,
|
'label' => false,
|
||||||
//'choices' => $this->buildDataSourceChoices($options['data_sources']),
|
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new Assert\NotBlank(),
|
new Assert\NotBlank(),
|
||||||
],
|
],
|
||||||
'row_attr' => ['class' => 'mb-0'],
|
'row_attr' => ['class' => 'mb-0'],
|
||||||
'attr' => ['class' => 'form-select-sm'],
|
'attr' => ['class' => 'form-select-sm'],
|
||||||
'preferred_choices' => self::PREFFERED_TYPES
|
'preferred_choices' => self::PREFERRED_TYPES
|
||||||
])
|
])
|
||||||
->add('locale', LocaleType::class, [
|
->add('locale', LocaleType::class, [
|
||||||
'label' => false,
|
'label' => false,
|
||||||
|
|
@ -1,8 +1,26 @@
|
||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Form\Type;
|
namespace App\Form\Settings;
|
||||||
|
|
||||||
use App\Services\ElementTypes;
|
use App\Services\ElementTypes;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
|
@ -21,7 +39,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
* View data: list [{dataSource, locale, translation_singular, translation_plural}, ...]
|
* View data: list [{dataSource, locale, translation_singular, translation_plural}, ...]
|
||||||
* Model data: same structure (list). Optionally expands a nested map to a list.
|
* Model data: same structure (list). Optionally expands a nested map to a list.
|
||||||
*/
|
*/
|
||||||
class DataSourceSynonymsCollectionType extends AbstractType
|
class TypeSynonymsCollectionType extends AbstractType
|
||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatorInterface $translator)
|
public function __construct(private readonly TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
|
|
@ -180,7 +198,7 @@ class DataSourceSynonymsCollectionType extends AbstractType
|
||||||
|
|
||||||
// Defaults for the collection and entry type
|
// Defaults for the collection and entry type
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'entry_type' => DataSourceSynonymRowType::class,
|
'entry_type' => TypeSynonymRowType::class,
|
||||||
'allow_add' => true,
|
'allow_add' => true,
|
||||||
'allow_delete' => true,
|
'allow_delete' => true,
|
||||||
'by_reference' => false,
|
'by_reference' => false,
|
||||||
|
|
@ -198,6 +216,6 @@ class DataSourceSynonymsCollectionType extends AbstractType
|
||||||
|
|
||||||
public function getBlockPrefix(): string
|
public function getBlockPrefix(): string
|
||||||
{
|
{
|
||||||
return 'datasource_synonyms_collection';
|
return 'type_synonyms_collection';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Settings;
|
namespace App\Settings;
|
||||||
|
|
||||||
use App\Form\Type\DataSourceSynonymsCollectionType;
|
use App\Form\Settings\TypeSynonymsCollectionType;
|
||||||
use App\Services\ElementTypes;
|
use App\Services\ElementTypes;
|
||||||
use Jbtronics\SettingsBundle\ParameterTypes\ArrayType;
|
use Jbtronics\SettingsBundle\ParameterTypes\ArrayType;
|
||||||
use Jbtronics\SettingsBundle\ParameterTypes\SerializeType;
|
use Jbtronics\SettingsBundle\ParameterTypes\SerializeType;
|
||||||
|
|
@ -43,7 +43,7 @@ class SynonymSettings
|
||||||
label: new TM("settings.system.synonyms.type_synonyms"),
|
label: new TM("settings.system.synonyms.type_synonyms"),
|
||||||
description: new TM("settings.system.synonyms.type_synonyms.help"),
|
description: new TM("settings.system.synonyms.type_synonyms.help"),
|
||||||
options: ['type' => SerializeType::class],
|
options: ['type' => SerializeType::class],
|
||||||
formType: DataSourceSynonymsCollectionType::class,
|
formType: TypeSynonymsCollectionType::class,
|
||||||
formOptions: [
|
formOptions: [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Settings\SystemSettings;
|
namespace App\Settings\SystemSettings;
|
||||||
|
|
||||||
use App\Form\Type\LanguageMenuEntriesType;
|
use App\Form\Settings\LanguageMenuEntriesType;
|
||||||
use App\Form\Type\LocaleSelectType;
|
use App\Form\Type\LocaleSelectType;
|
||||||
use App\Settings\SettingsIcon;
|
use App\Settings\SettingsIcon;
|
||||||
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@
|
||||||
<div class="col">{{ form_row(child.translation_singular) }}</div>
|
<div class="col">{{ form_row(child.translation_singular) }}</div>
|
||||||
<div class="col">{{ form_row(child.translation_plural) }}</div>
|
<div class="col">{{ form_row(child.translation_plural) }}</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button type="button" class="btn btn-outline-danger btn-sm tc-remove" data-action="elements--datasource-synonyms-collection#remove">
|
<button type="button" class="btn btn-outline-danger btn-sm tc-remove" {{ stimulus_action('pages/synonyms_collection', 'remove' )}}>
|
||||||
<i class="fa fa-trash"></i> {{ 'settings.behavior.data_source_synonyms.collection.remove_entry'|trans }}
|
<i class="fa fa-trash"></i> {{ 'settings.synonyms.type_synonym.remove_entry'|trans }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% block datasource_synonyms_collection_widget %}
|
{% block type_synonyms_collection_widget %}
|
||||||
{% set _attrs = attr|default({}) %}
|
{% set _attrs = attr|default({}) %}
|
||||||
{% set _attrs = _attrs|merge({
|
{% set _attrs = _attrs|merge({
|
||||||
class: (_attrs.class|default('') ~ ' datasource-synonyms-collection-widget')|trim
|
class: (_attrs.class|default('') ~ ' type_synonyms_collection-widget')|trim
|
||||||
}) %}
|
}) %}
|
||||||
|
|
||||||
{% set has_proto = prototype is defined %}
|
{% set has_proto = prototype is defined %}
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
{{ stimulus_controller('elements/datasource_synonyms_collection', {
|
{{ stimulus_controller('pages/synonyms_collection', {
|
||||||
prototype: has_proto ? _proto_html : '',
|
prototype: has_proto ? _proto_html : '',
|
||||||
prototypeName: has_proto ? _proto_name : '__name__',
|
prototypeName: has_proto ? _proto_name : '__name__',
|
||||||
index: has_proto ? _index : (form|length)
|
index: has_proto ? _index : (form|length)
|
||||||
|
|
@ -40,20 +40,20 @@
|
||||||
{{ block('widget_container_attributes')|raw }}{% for k,v in _attrs %} {{ k }}="{{ v }}"{% endfor %}
|
{{ block('widget_container_attributes')|raw }}{% for k,v in _attrs %} {{ k }}="{{ v }}"{% endfor %}
|
||||||
>
|
>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center"><strong>{% trans %}settings.behavior.data_source_synonyms.row_type.form.datasource{% endtrans %}</strong></div>
|
<div class="col text-center"><strong>{% trans%}settings.synonyms.type_synonym.type{% endtrans%}</strong></div>
|
||||||
<div class="col text-center"><strong>{% trans %}settings.behavior.data_source_synonyms.row_type.form.locale{% endtrans %}</strong></div>
|
<div class="col text-center"><strong>{% trans%}settings.synonyms.type_synonym.language{% endtrans%}</strong></div>
|
||||||
<div class="col text-center"><strong>{% trans %}settings.behavior.data_source_synonyms.row_type.form.translation_singular{% endtrans %}</strong></div>
|
<div class="col text-center"><strong>{% trans%}settings.synonyms.type_synonym.translation_singular{% endtrans%}</strong></div>
|
||||||
<div class="col text-center"><strong>{% trans %}settings.behavior.data_source_synonyms.row_type.form.translation_plural{% endtrans %}</strong></div>
|
<div class="col text-center"><strong>{% trans%}settings.synonyms.type_synonym.translation_plural{% endtrans%}</strong></div>
|
||||||
<div class="col text-center"></div>
|
<div class="col text-center"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tc-items" data-elements--datasource-synonyms-collection-target="items">
|
<div class="tc-items" {{ stimulus_target('pages/synonyms_collection', 'items') }}>
|
||||||
{% for child in form %}
|
{% for child in form %}
|
||||||
{{ _self.renderForm(child) }}
|
{{ _self.renderForm(child) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-outline-primary btn-sm mt-2 tc-add" data-action="elements--datasource-synonyms-collection#add">
|
<button type="button" class="btn btn-outline-primary btn-sm mt-2 tc-add" {{ stimulus_action('pages/synonyms_collection', 'add')}}>
|
||||||
<i class="fa fa-plus"></i> {{ 'settings.behavior.data_source_synonyms.collection.add_entry'|trans }}
|
<i class="fa fa-plus"></i> {{ 'settings.synonyms.type_synonym.add_entry'|trans }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
@ -14486,5 +14486,41 @@ Please note that this system is currently experimental, and the synonyms defined
|
||||||
<target>Type synonyms allow you to replace the labels of built-in data types. For example, you can rename "Footprint" to something else.</target>
|
<target>Type synonyms allow you to replace the labels of built-in data types. For example, you can rename "Footprint" to something else.</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="O10voez" name="settings.synonyms.type_synonym.type">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.type</source>
|
||||||
|
<target>Type</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="1BDQVEp" name="settings.synonyms.type_synonym.language">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.language</source>
|
||||||
|
<target>Language</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="2.g2ewQ" name="settings.synonyms.type_synonym.translation_singular">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.translation_singular</source>
|
||||||
|
<target>Translation Singular</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="Up9ZhvR" name="settings.synonyms.type_synonym.translation_plural">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.translation_plural</source>
|
||||||
|
<target>Translation Plural</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="BHoS230" name="settings.synonyms.type_synonym.add_entry">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.add_entry</source>
|
||||||
|
<target>Add entry</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="wvtOEBn" name="settings.synonyms.type_synonym.remove_entry">
|
||||||
|
<segment>
|
||||||
|
<source>settings.synonyms.type_synonym.remove_entry</source>
|
||||||
|
<target>Remove entry</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue