Integrate snipContent more tightly into snip and cleanup old code
This commit is contained in:
@ -53,8 +53,6 @@ class SnipController extends AbstractController
|
||||
return $this->render('snip/single.html.twig', [
|
||||
'snip' => $snip,
|
||||
'content' => $pl->parse($snipService->getActiveText()),
|
||||
'activeVersion' => $snipService->getActiveVersion(),
|
||||
'latestVersion' => $snipService->getLatestVersion(),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -114,7 +112,7 @@ class SnipController extends AbstractController
|
||||
public function new(Request $request): Response
|
||||
{
|
||||
$snip = new Snip();
|
||||
$snip->setCreatedAtTodayNoSeconds()
|
||||
$snip->setCreatedAtNow()
|
||||
->setCreatedBy($this->getUser());
|
||||
|
||||
return $this->edit($snip, $request);
|
||||
|
@ -21,12 +21,9 @@ class VersionController extends AbstractController
|
||||
public function index(Snip $snip): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(SnipVoter::EDIT, $snip);
|
||||
|
||||
$snipService = $this->snipServiceFactory->create($snip);
|
||||
|
||||
return $this->render('version/index.html.twig', [
|
||||
'snip' => $snip,
|
||||
'versions' => $snipService->getVersions(),
|
||||
'latestVersion' => $snipService->getLatestVersion(),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -35,7 +32,7 @@ class VersionController extends AbstractController
|
||||
{
|
||||
$this->denyAccessUnlessGranted(SnipVoter::EDIT, $snip);
|
||||
|
||||
$this->snipServiceFactory->create($snip)->setVersion($version->getId());
|
||||
$this->snipServiceFactory->create($snip)->setVersion($version);
|
||||
$this->addFlash('success', 'Snip version set to ' . $version->getId());
|
||||
return $this->redirectToRoute('snip_single', ['snip' => $snip->getId()]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user