Feat: Add popup window to display teamer info per application

This commit is contained in:
Björn Fromme
2023-10-19 15:49:26 +02:00
parent 585f86e45f
commit 67cc7bf4ed
8 changed files with 107 additions and 20 deletions
+6 -2
View File
@@ -5,7 +5,9 @@ namespace App\Controller\Common;
use App\Entity\Upload;
use App\Service\Upload\UploadHandler;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
@@ -17,11 +19,13 @@ class DownloadController extends AbstractController
#[Route('/download/{uuid}', name: 'app_common_download')]
#[IsGranted('DOWNLOAD', subject: 'upload')]
public function index(Upload $upload): Response
public function index(Upload $upload, Request $request): Response
{
$path = $this->uploadHandler->getUploadFilepath($upload);
$originalFilename = $upload->getOriginalFilename();
$inline = (bool) $request->get('inline');
$disposition = $inline ? ResponseHeaderBag::DISPOSITION_INLINE : ResponseHeaderBag::DISPOSITION_ATTACHMENT;
return $this->file($path, $originalFilename);
return $this->file($path, $originalFilename, $disposition);
}
}