mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 20:28:54 +02:00
Added an table to show all defined attachments.
This commit is contained in:
parent
2f0dc600e2
commit
f53cc08f52
8 changed files with 437 additions and 17 deletions
|
@ -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
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue