mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Started to implement a very basic builtin footprints gallery tool
This commit is contained in:
parent
39d4f06c12
commit
ddd8a66024
3 changed files with 96 additions and 0 deletions
|
@ -20,12 +20,16 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Services\Attachments\AttachmentPathResolver;
|
||||
use App\Services\Attachments\AttachmentURLGenerator;
|
||||
use App\Services\Attachments\BuiltinAttachmentsFinder;
|
||||
use App\Services\Misc\GitVersionInfo;
|
||||
use App\Services\Misc\DBInfoHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||
|
||||
/**
|
||||
* @Route("/tools")
|
||||
|
@ -84,4 +88,26 @@ class ToolsController extends AbstractController
|
|||
'db_version' => $DBInfoHelper->getDatabaseVersion() ?? 'Unknown',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/builtin_footprints")
|
||||
* @param AttachmentPathResolver $pathResolver
|
||||
* @return Response
|
||||
*/
|
||||
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator, ): Response
|
||||
{
|
||||
$grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder();
|
||||
$grouped_footprints = array_map(function($group) use ($urlGenerator) {
|
||||
return array_map(function($placeholder_filepath) use ($urlGenerator) {
|
||||
return [
|
||||
'filename' => basename($placeholder_filepath),
|
||||
'assets_path' => $urlGenerator->placeholderPathToAssetPath($placeholder_filepath),
|
||||
];
|
||||
}, $group);
|
||||
}, $grouped_footprints);
|
||||
|
||||
return $this->render('Tools/BuiltInFootprintsViewer/main.html.twig', [
|
||||
'grouped_footprints' => $grouped_footprints,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue