From f9ccdfd674981c0f45031829a94b730b8976d82d Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 17 Sep 2023 21:54:14 +0200 Subject: [PATCH] Show type of executable with fontawesome icon The type is now removed as column from the table. --- .../Controller/Jury/ExecutableController.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/src/Controller/Jury/ExecutableController.php b/webapp/src/Controller/Jury/ExecutableController.php index 11cf995c1e..223f3995c2 100644 --- a/webapp/src/Controller/Jury/ExecutableController.php +++ b/webapp/src/Controller/Jury/ExecutableController.php @@ -56,6 +56,7 @@ public function indexAction(Request $request): Response ->getQuery()->getResult(); $executables = array_column($executables, 'executable', 'execid'); $table_fields = [ + 'icon' => ['title' => 'type', 'sort' => false], 'execid' => ['title' => 'ID', 'sort' => true,], 'type' => ['title' => 'type', 'sort' => true,], 'description' => ['title' => 'description', 'sort' => true,], @@ -73,6 +74,23 @@ public function indexAction(Request $request): Response } } $execdata['execid']['cssclass'] = 'execid'; + $type = $execdata['type']['value']; + switch ($type) { + case 'compare': + $execdata['icon']['icon'] = 'code-compare'; + break; + case 'compile': + $execdata['icon']['icon'] = 'language'; + break; + case 'debug': + $execdata['icon']['icon'] = 'bug'; + break; + case 'run': + $execdata['icon']['icon'] = 'person-running'; + break; + default: + $execdata['icon']['icon'] = 'question'; + } if ($this->isGranted('ROLE_ADMIN')) { $execactions[] = [ @@ -103,6 +121,8 @@ public function indexAction(Request $request): Response 'link' => $this->generateUrl('jury_executable', ['execId' => $e->getExecid()]), ]; } + // This is replaced with the icon. + unset($table_fields['type']); return $this->render('jury/executables.html.twig', [ 'executables' => $executables_table, 'table_fields' => $table_fields,