mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 05:39:33 +00:00
Fix formatting
This commit is contained in:
parent
334a37a9d0
commit
26ee564481
2 changed files with 16 additions and 16 deletions
|
|
@ -53,17 +53,17 @@ class SelectAPIController extends AbstractController
|
|||
#[Route(path: '/tag', name: 'select_tag')]
|
||||
public function tag(): Response
|
||||
{
|
||||
$tags = [
|
||||
$tags = [
|
||||
'text' => 'test',
|
||||
'value' => 'test',
|
||||
];
|
||||
$this->addEmptyNode($tags);
|
||||
// pseudocode:
|
||||
// for each part in selection
|
||||
// use TagFilter to find tags
|
||||
// dedupe
|
||||
return $this->json($tags);
|
||||
|
||||
$this->addEmptyNode($tags);
|
||||
// pseudocode:
|
||||
// for each part in selection
|
||||
// use TagFilter to find tags
|
||||
// dedupe
|
||||
return $this->json($tags);
|
||||
|
||||
#[Route(path: '/category', name: 'select_category')]
|
||||
public function category(): Response
|
||||
{
|
||||
|
|
|
|||
|
|
@ -137,18 +137,18 @@ implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPart
|
|||
$this->denyAccessUnlessGranted('edit', $part);
|
||||
|
||||
switch ($action) {
|
||||
case "add_tag":
|
||||
case "add_tag":
|
||||
$this->denyAccessUnlessGranted('edit', $part);
|
||||
$tags = $part->getTags();
|
||||
$tags = $part->getTags();
|
||||
$part->setTags($tags . ',' . $target_id); // simple append
|
||||
break;
|
||||
case "remove_tag":
|
||||
break;
|
||||
case "remove_tag":
|
||||
$this->denyAccessUnlessGranted('edit', $part);
|
||||
$tags = $part->getTags();
|
||||
$tags = str_replace($target_id, '', $tags);
|
||||
// sanitize $tags (remove leading, trailing and double commas)
|
||||
$tags = $part->getTags();
|
||||
$tags = str_replace($target_id, '', $tags);
|
||||
// sanitize $tags (remove leading, trailing and double commas)
|
||||
$part->setTags($tags);
|
||||
break;
|
||||
break;
|
||||
case 'favorite':
|
||||
$this->denyAccessUnlessGranted('change_favorite', $part);
|
||||
$part->setFavorite(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue