Skip to content

Commit

Permalink
Show type of executable with fontawesome icon
Browse files Browse the repository at this point in the history
The type is now removed as column from the table.
  • Loading branch information
vmcj committed Sep 21, 2023
1 parent faa3656 commit f9ccdfd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions webapp/src/Controller/Jury/ExecutableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,],
Expand All @@ -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[] = [
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f9ccdfd

Please sign in to comment.