diff --git a/src/Controller/Admin/Document/RenameController.php b/src/Controller/Admin/Document/RenameController.php new file mode 100644 index 0000000..149b953 --- /dev/null +++ b/src/Controller/Admin/Document/RenameController.php @@ -0,0 +1,54 @@ +generateUrl('app_admin_document_rename', ['uuid' => $upload->getUuid()]); + + $form = $this + ->createFormBuilder($upload, ['action' => $formAction, 'ajax_submit' => true]) + ->add('displayName', TextType::class, [ + 'label' => 'angezeigter Name', + ]) + ->getForm() + ; + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $this->entityManager->flush(); + $this->addFlash('success', 'Das Dokument wurden umbenannt'); + $this->logger->info('Rename document'); + + $response->setCloseAndRedirect($this->generateUrl('app_admin_document_index')); + } else { + $response->setContent($this->renderView('admin/document/rename.html.twig', [ + 'form' => $form, + ])); + } + + return $this->json($response); + } +} \ No newline at end of file diff --git a/templates/admin/document/index.html.twig b/templates/admin/document/index.html.twig index 3f45171..dbdab1a 100644 --- a/templates/admin/document/index.html.twig +++ b/templates/admin/document/index.html.twig @@ -30,7 +30,7 @@ {% for document in pagination %}