Added an table to show all defined attachments.

This commit is contained in:
Jan Böhmer 2019-10-04 18:06:37 +02:00
parent 2f0dc600e2
commit f53cc08f52
8 changed files with 437 additions and 17 deletions

View file

@ -32,10 +32,15 @@
namespace App\Controller;
use App\DataTables\AttachmentDataTable;
use App\DataTables\PartsDataTable;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\PartAttachment;
use App\Services\AttachmentHelper;
use Omines\DataTablesBundle\DataTableFactory;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\Routing\Annotation\Route;
@ -104,4 +109,26 @@ class AttachmentFileController extends AbstractController
return $response;
}
/**
* @Route("/attachment/list", name="attachment_list")
* @param DataTableFactory $dataTable
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function attachmentsTable(DataTableFactory $dataTable, Request $request)
{
$this->denyAccessUnlessGranted('read', new PartAttachment());
$table = $dataTable->createFromType(AttachmentDataTable::class)
->handleRequest($request);
if ($table->isCallback()) {
return $table->getResponse();
}
return $this->render('attachment_list.html.twig', [
'datatable' => $table
]);
}
}