Added:
- Refactor MangaScraperService (not used everywhere now) - Added JavascriptScraper.php - Added alternatives slugs in Manga.php - Improvement in manga edit form
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Entity\Manga;
|
||||
use App\Form\MangaEditType;
|
||||
use App\Manager\Toolbar\Factory\ToolbarFactory;
|
||||
use App\Message\DownloadChapter;
|
||||
use App\Message\RefreshMetadata;
|
||||
@@ -79,9 +80,12 @@ class MangaController extends AbstractController
|
||||
throw new NotFoundHttpException("Le manga demandé n'existe pas.");
|
||||
}
|
||||
|
||||
$form = $this->createForm(MangaEditType::class, $manga);
|
||||
|
||||
return $this->render('manga/show_chapters.html.twig', [
|
||||
'manga' => $manga,
|
||||
'toolbar' => $this->toolbarFactory->createToolbar('chapter_list', ['mangaId' => $manga->getId(), 'isMonitored' => (int) $manga->isMonitored()])->getGroups(),
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -101,6 +105,25 @@ class MangaController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/manga/{id}/edit', name: 'app_manga_edit', methods: ['POST'])]
|
||||
public function edit(Request $request, Manga $manga, EntityManagerInterface $entityManager): JsonResponse|Response
|
||||
{
|
||||
$form = $this->createForm(MangaEditType::class, $manga);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_manga_show', ['mangaSlug' => $manga->getSlug()]);
|
||||
}
|
||||
|
||||
$errors = [];
|
||||
foreach ($form->getErrors(true) as $error) {
|
||||
$errors[] = $error->getMessage();
|
||||
}
|
||||
|
||||
return new JsonResponse(['errors' => $errors], 400);
|
||||
}
|
||||
|
||||
public function _chaptersByManga(int $id): Response
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user