javascript and api to stop and display active records (#772)

This commit is contained in:
Kevin Papst
2019-05-10 13:45:09 +02:00
committed by GitHub
parent e619b5fd31
commit 09da7cd242
86 changed files with 918 additions and 449 deletions

View File

@@ -9,8 +9,10 @@
namespace App\Form\Extension;
use App\Configuration\ThemeConfiguration;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
@@ -29,14 +31,14 @@ class EnhancedChoiceTypeExtension extends AbstractTypeExtension
/**
* @param null|string $type
*/
public function __construct(?string $type)
public function __construct(ThemeConfiguration $configuration)
{
$this->type = $type;
$this->type = $configuration->getSelectPicker();
}
public static function getExtendedTypes(): iterable
{
return [EntityType::class];
return [EntityType::class, ChoiceType::class];
}
/**

View File

@@ -13,6 +13,7 @@ class SystemConfiguration
{
public const SECTION_TIMESHEET = 'timesheet';
public const SECTION_FORM_CUSTOMER = 'form_customer';
public const SECTION_THEME = 'theme';
/**
* @var string

View File

@@ -291,6 +291,11 @@ class TimesheetEditForm extends AbstractType
'method' => 'POST',
'date_format' => null,
'customer' => false,
'attr' => [
'data-form-event' => 'kimai.timesheetUpdate',
'data-msg-success' => 'action.update.success',
'data-msg-error' => 'action.update.error',
],
]);
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Custom form field type to select the javascript renderer for select boxes.
*/
class EnhancedSelectboxType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'label' => 'label.select_type',
'choices' => [
'' => null,
'Javascript' => 'selectpicker',
],
'required' => false,
]);
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return ChoiceType::class;
}
}