Skip to content

Commit

Permalink
Make number of actions the same for all contests.
Browse files Browse the repository at this point in the history
This fixes a javascript error with DataTables.
  • Loading branch information
nickygerritsen committed Mar 23, 2024
1 parent 280cd28 commit a86b7b9
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions webapp/src/Controller/Jury/ContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,31 @@ public function indexAction(Request $request): Response
} else {
$contestactions[] = [];
}
if ($this->isGranted('ROLE_ADMIN') && !$contest->isLocked()) {
$contestactions[] = [
'icon' => 'edit',
'title' => 'edit this contest',
'link' => $this->generateUrl('jury_contest_edit', [
'contestId' => $contest->getCid(),
])
];
$contestactions[] = [
'icon' => 'trash-alt',
'title' => 'delete this contest',
'link' => $this->generateUrl('jury_contest_delete', [
'contestId' => $contest->getCid(),
]),
'ajaxModal' => true,
];
if ($this->isGranted('ROLE_ADMIN')) {
if ($contest->isLocked()) {
// The number of table columns and thus the number of actions need
// to match for all rows to not get DataTables errors.
// Since we add two actions for non-locked contests, we need to add
// two empty actions for locked contests.
$contestactions[] = [];
$contestactions[] = [];
} else {
$contestactions[] = [
'icon' => 'edit',
'title' => 'edit this contest',
'link' => $this->generateUrl('jury_contest_edit', [
'contestId' => $contest->getCid(),
])
];
$contestactions[] = [
'icon' => 'trash-alt',
'title' => 'delete this contest',
'link' => $this->generateUrl('jury_contest_delete', [
'contestId' => $contest->getCid(),
]),
'ajaxModal' => true,
];
}
}

$contestdata['process_balloons'] = [
Expand Down

0 comments on commit a86b7b9

Please sign in to comment.