ui touch ups

This commit is contained in:
Joren de Graaf
2026-08-25 11:25:55 +02:00
parent c32edc1f65
commit 749ca32489
5 changed files with 130 additions and 47 deletions
+21 -3
View File
@@ -14,6 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Process\Process;
#[Route('/task')]
final class TaskController extends AbstractController
@@ -116,7 +117,7 @@ final class TaskController extends AbstractController
#[Route('/{id}/completion', name: 'app_task_toggle_completion', methods: ['POST'])]
public function toggleCompletion(Request $request, Task $task, EntityManagerInterface $entityManager, TaskRepository $taskRepository, TaskRecommendationService $taskRecommendationService): Response
{
if (!$this->isCsrfTokenValid('completion'.$task->getId(), $request->getPayload()->getString('_token'))) {
if (!$this->isCsrfTokenValid('completion' . $task->getId(), $request->getPayload()->getString('_token'))) {
throw $this->createAccessDeniedException('Invalid CSRF token.');
}
@@ -134,7 +135,7 @@ final class TaskController extends AbstractController
#[Route('/{id}', name: 'app_task_delete', methods: ['POST'])]
public function delete(Request $request, Task $task, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$task->getId(), $request->getPayload()->getString('_token'))) {
if ($this->isCsrfTokenValid('delete' . $task->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($task);
$entityManager->flush();
}
@@ -183,6 +184,23 @@ final class TaskController extends AbstractController
return $user instanceof User ? $user->getSettings() : null;
}
#[Route('/task/refresh/weather', name: 'weather_refresh', methods: ['POST'])]
public function refresh(): Response
{
$process = new Process([
'frankenphp',
'php-cli',
$this->getParameter('kernel.project_dir') . '/bin/console',
'app:weather:refresh',
]);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
return $this->redirectToRoute('app_task_index');
}
}