Remove up/down buttons for slides
CI / Deploy / test (push) Successful in 46s
CI / Deploy / deploy (push) Skipped

Drag and drop (including arrow keys on the handle) replaces them, so the
move route, action and table method are gone as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 14:48:58 +01:00
1 parent 4034a65498
commit 60fb2cb029
7 files changed
+4 -60

No files matched your search

-13
View File
@@ -107,19 +107,6 @@ class SlidesController extends AdminAppController
return $this->redirect($this->adminUrl());
}
/**
* @param string $id Slide id
* @param string $direction up|down
* @return \Cake\Http\Response|null
*/
public function move(string $id, string $direction): ?Response
{
$this->request->allowMethod(['post']);
$this->Slides->move($this->loadSlide($id), $direction);
return $this->redirect($this->adminUrl());
}
/**
* Saves a complete new slide order (drag & drop), expects `ids[]` and answers with JSON.
*
-32
View File
@@ -262,38 +262,6 @@ class SlidesTable extends Table
});
}
/**
* Swaps the slide with its neighbour.
*
* @param \App\Model\Entity\Slide $slide Slide to move
* @param string $direction 'up' or 'down'
* @return bool Whether something changed
*/
public function move(Slide $slide, string $direction): bool
{
$this->normalizePositions($slide->poll_id);
$slide = $this->get($slide->id);
$neighbour = $this->find()
->where([
'poll_id' => $slide->poll_id,
'position' . ($direction === 'up' ? ' <' : ' >') => $slide->position,
])
->orderBy(['position' => $direction === 'up' ? 'DESC' : 'ASC'])
->first();
if ($neighbour === null) {
return false;
}
return (bool)$this->getConnection()->transactional(function () use ($slide, $neighbour): bool {
$position = $slide->position;
$slide->position = $neighbour->position;
$neighbour->position = $position;
return $this->save($slide) && $this->save($neighbour);
});
}
/**
* Applies a complete new order (e.g. from drag & drop).
*