Show preview pictures as carousel on part info page.

This commit is contained in:
Jan Böhmer 2019-10-03 18:03:56 +02:00
parent 07dcbc0464
commit 2d4def2836
5 changed files with 96 additions and 14 deletions

View file

@ -34,6 +34,7 @@ use App\Entity\Parts\Category;
use App\Entity\Parts\Part;
use App\Form\Part\PartBaseType;
use App\Services\AttachmentHelper;
use App\Services\Attachments\PartPreviewGenerator;
use App\Services\PricedetailHelper;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -55,17 +56,19 @@ class PartController extends AbstractController
* @param AttachmentHelper $attachmentHelper
* @return \Symfony\Component\HttpFoundation\Response
*/
public function show(Part $part, AttachmentHelper $attachmentHelper, PricedetailHelper $pricedetailHelper)
public function show(Part $part, AttachmentHelper $attachmentHelper, PricedetailHelper $pricedetailHelper, PartPreviewGenerator $previewGenerator)
{
$this->denyAccessUnlessGranted('read', $part);
return $this->render('Parts/info/show_part_info.html.twig',
return $this->render(
'Parts/info/show_part_info.html.twig',
[
'part' => $part,
'attachment_helper' => $attachmentHelper,
'pricedetail_helper' => $pricedetailHelper
'pricedetail_helper' => $pricedetailHelper,
'pictures' => $previewGenerator->getPreviewAttachments($part)
]
);
);
}
/**
@ -78,7 +81,7 @@ class PartController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response
*/
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentHelper $attachmentHelper)
AttachmentHelper $attachmentHelper)
{
$this->denyAccessUnlessGranted('edit', $part);