mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use green button for creating new elements.
This commit is contained in:
parent
be5d33c624
commit
6649460ed6
2 changed files with 7 additions and 3 deletions
|
@ -76,7 +76,7 @@ abstract class DBElement
|
|||
*/
|
||||
final public function getID(): ?int
|
||||
{
|
||||
return (int) $this->id;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\StructuralDBElement;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
@ -54,7 +55,9 @@ class BaseEntityAdminForm extends AbstractType
|
|||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
/** @var StructuralDBElement $entity */
|
||||
$entity = $options['data'];
|
||||
$is_new = $entity->getID() === null;
|
||||
|
||||
$builder
|
||||
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
|
||||
|
@ -70,7 +73,8 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'disabled' => !$this->security->isGranted('edit', $entity)])
|
||||
|
||||
//Buttons
|
||||
->add('save', SubmitType::class, ['label' => 'part.edit.save'])
|
||||
->add('reset', ResetType::class, ['label' => 'part.edit.reset']);
|
||||
->add('save', SubmitType::class, ['label' => $is_new ? 'entity.create' : 'entity.edit.save',
|
||||
'attr' => ['class' => $is_new ? 'btn-success' : '']])
|
||||
->add('reset', ResetType::class, ['label' => 'entity.edit.reset']);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue