mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Show part name hint in edit page and default description and comment settings of a category now properly works
This fixes issue #196
This commit is contained in:
parent
f2239e99d1
commit
58105575d3
4 changed files with 20 additions and 2 deletions
|
@ -237,6 +237,8 @@ class PartController extends AbstractController
|
|||
$category = $cid ? $em->find(Category::class, $cid) : null;
|
||||
if (null !== $category && null === $new_part->getCategory()) {
|
||||
$new_part->setCategory($category);
|
||||
$new_part->setDescription($category->getDefaultDescription());
|
||||
$new_part->setComment($category->getDefaultComment());
|
||||
}
|
||||
|
||||
$fid = $request->get('footprint', null);
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Form\AdminPages;
|
||||
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Form\Type\RichTextEditorType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
@ -81,20 +82,22 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('default_description', TextType::class, [
|
||||
$builder->add('default_description', RichTextEditorType::class, [
|
||||
'required' => false,
|
||||
'empty_data' => '',
|
||||
'label' => 'category.edit.default_description',
|
||||
'mode' => 'markdown-single_line',
|
||||
'attr' => [
|
||||
'placeholder' => 'category.edit.default_description.placeholder',
|
||||
],
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('default_comment', TextType::class, [
|
||||
$builder->add('default_comment', RichTextEditorType::class, [
|
||||
'required' => false,
|
||||
'empty_data' => '',
|
||||
'label' => 'category.edit.default_comment',
|
||||
'mode' => 'markdown-full',
|
||||
'attr' => [
|
||||
'placeholder' => 'category.edit.default_comment.placeholder',
|
||||
],
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{{ form_row(form.name) }}
|
||||
{% if part.category is not null and part.category.partnameHint is not empty %}
|
||||
<div class="row">
|
||||
<div class="col-sm-9 offset-sm-3">
|
||||
<p class="text-muted"><b>{% trans %}part.edit.name.category_hint{% endtrans %}:</b> {{ part.category.partnameHint }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form_row(form.description) }}
|
||||
{{ form_row(form.category) }}
|
||||
{{ form_row(form.tags) }}
|
||||
|
|
|
@ -10395,5 +10395,11 @@ Element 3</target>
|
|||
<target>Remove profile picture</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="Y1Aes28" name="part.edit.name.category_hint">
|
||||
<segment>
|
||||
<source>part.edit.name.category_hint</source>
|
||||
<target>Hint from category</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue