added drag and drop for new records via calendar (#1962)

This commit is contained in:
Kevin Papst
2020-09-17 01:13:48 +02:00
committed by GitHub
parent 14b3de4300
commit 9ef32e75c5
82 changed files with 2808 additions and 385 deletions

View File

@@ -10,10 +10,8 @@
namespace App\Twig;
use App\Constants;
use App\Entity\Activity;
use App\Entity\Customer;
use App\Entity\EntityWithMetaFields;
use App\Entity\Project;
use App\Utils\Color;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
@@ -32,6 +30,7 @@ class Extensions extends AbstractExtension
new TwigFilter('docu_link', [$this, 'documentationLink']),
new TwigFilter('multiline_indent', [$this, 'multilineIndent']),
new TwigFilter('color', [$this, 'color']),
new TwigFilter('font_contrast', [$this, 'calculateFontContrastColor']),
];
}
@@ -60,32 +59,20 @@ class Extensions extends AbstractExtension
return ++$key;
}
public function color(EntityWithMetaFields $entity): ?string
/**
* Returns null instead of the default color if $defaultColor is not set to true.
*
* @param EntityWithMetaFields $entity
* @return string|null
*/
public function color(EntityWithMetaFields $entity, bool $defaultColor = false): ?string
{
if ($entity instanceof Activity) {
if (!empty($entity->getColor())) {
return $entity->getColor();
}
return (new Color())->getColor($entity, $defaultColor);
}
if (null !== $entity->getProject()) {
$entity = $entity->getProject();
}
}
if ($entity instanceof Project) {
if (!empty($entity->getColor())) {
return $entity->getColor();
}
$entity = $entity->getCustomer();
}
if ($entity instanceof Customer) {
if (!empty($entity->getColor())) {
return $entity->getColor();
}
}
return null;
public function calculateFontContrastColor(string $color): string
{
return (new Color())->getFontContrastColor($color);
}
/**