Allow referencing other snips in snip

This commit is contained in:
Tim
2023-12-12 21:35:35 +01:00
parent 980ea6af94
commit 9f5bb66ae9
6 changed files with 79 additions and 11 deletions

View File

@ -44,25 +44,25 @@ class SnipController extends AbstractController
}
#[Route('/single/{snip}', name: '_single')]
public function single(Snip $snip): Response
public function single(Snip $snip, Pipeline $pl): Response
{
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
$snipService = $this->snipServiceFactory->create($snip);
return $this->render('snip/single.html.twig', [
'snip' => $snip,
'content' => (new Pipeline())->parse($snipService->get()),
'content' => $pl->parse($snipService->get()),
'branch' => $snipService->getRepo()->getCurrentBranchName(),
]);
}
#[Route('/raw/{snip}', name: '_raw')]
public function raw(Snip $snip, Request $request): Response
public function raw(Snip $snip, Pipeline $pl, Request $request): Response
{
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
$response = new Response(
(new Pipeline())->clean($this->snipServiceFactory->create($snip)->get()),
$pl->clean($this->snipServiceFactory->create($snip)->get()),
Response::HTTP_OK,
['Content-Type' => 'text/html']
);
@ -77,10 +77,6 @@ class SnipController extends AbstractController
}
return $response;
// return $this->render('snip/single.html.twig', [
// 'snip' => $snip,
// 'content' => $this->snipServiceFactory->create($snip)->get(),
// ]);
}
#[Route('/edit/{snip}', name: '_edit')]