diff --git a/src/Controller/BibliographyController.php b/src/Controller/BibliographyController.php index 93d5b05..dd5cf80 100644 --- a/src/Controller/BibliographyController.php +++ b/src/Controller/BibliographyController.php @@ -13,7 +13,7 @@ use Symfony\Component\Routing\Attribute\Route; class BibliographyController extends AbstractController { - #[Route('/bibliography/{id}', name: 'app_bibliography')] + #[Route('/bibliography/{id<\d+>}', name: 'app_bibliography')] public function index(Bibliography $bibliography, EntityManagerInterface $em): Response { return $this->render('bibliography/index.html.twig', [ @@ -21,5 +21,28 @@ class BibliographyController extends AbstractController 'record' => $bibliography, ]); } -} + #[Route('/bibliography', name: 'app_bibliography_landing')] + public function landing(): Response + { + return $this->render('bibliography/landing.html.twig', [ + 'controller_name' => 'BibliographyController', + ]); + } + + #[Route('/bibliography/search', name: 'app_bibliography_search')] + public function search(): Response + { + return $this->render('bibliography/search.html.twig', [ + 'controller_name' => 'BibliographyController', + ]); + } + + #[Route('/bibliography/add', name: 'app_bibliography_add')] + public function add(): Response + { + return $this->render('bibliography/add.html.twig', [ + 'controller_name' => 'BibliographyController', + ]); + } +} diff --git a/src/Entity/Bibliography.php b/src/Entity/Bibliography.php index f03ec70..261ae0d 100644 --- a/src/Entity/Bibliography.php +++ b/src/Entity/Bibliography.php @@ -36,10 +36,10 @@ class Bibliography #[ORM\Column(name: 'note_bib', type: Types::TEXT)] private ?string $notes = null; - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, name: 'editor')] private ?string $editor = null; - #[ORM\Column(length: 100)] + #[ORM\Column(length: 100, name: 'creator')] private ?string $creator = null; public function getId(): ?int @@ -96,6 +96,18 @@ class Bibliography return $this; } + public function getCreator(): ?string + { + return $this->creator; + } + + public function setCreator(string $creator): static + { + $this->creator = $creator; + + return $this; + } + public function getCitation(): ?string { return $this->citation; diff --git a/templates/bibliography/index.html.twig b/templates/bibliography/index.html.twig index 7c6b89f..724cad8 100644 --- a/templates/bibliography/index.html.twig +++ b/templates/bibliography/index.html.twig @@ -7,25 +7,26 @@

Bibliography

{{ record.citation }}

-
-
-

- Last modified: {{ record.modifiedAt.format('Y-m-d') }} - at {{ record.modifiedAt.format('H:i:s') }} -

-

Editor: {{ record.editor }}

-
-
-
+
+
+

+ Last modified: {{ record.modifiedAt.format('Y-m-d') }} + at {{ record.modifiedAt.format('H:i:s') }} +

+

Editor: {{ record.editor }}

+
+
+
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %} -
-
+
+
-
- {% for message in app.flashes('notice') %} -
- - {{ message }} -
- {% endfor %} {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}
@@ -37,6 +28,14 @@
{% endif %} + + {% for message in app.flashes('notice') %} +
+ + {{ message }} +
+ {% endfor %}

Terms in vocabulary

{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_REVISOR') %}{% endif %} @@ -102,7 +101,10 @@ const notice = document.querySelector('#ajax-success'); if (res.status === 200) { - notice.innerHTML += 'Term deleted successfully'; + notice.innerHTML = ` + + Term updated successfully + `; notice.classList.remove('is-hidden'); notice.querySelector('.delete').addEventListener('click', () => { notice.classList.add('is-hidden'); @@ -112,13 +114,31 @@ } } - if (clicked.classList.contains('is-link')) { + if (clicked.getAttribute('data-id-edit')) { const termId = clicked.getAttribute('data-id-edit'); const saveBtn = document.querySelector(`button[data-id-save="${termId}"]`); const input = document.querySelector(`input[data-term-id="${termId}"]`); input.disabled = input.disabled ? false : true; saveBtn.classList.toggle('is-hidden'); + clicked.classList.toggle('is-link'); + + if (!clicked.classList.contains('is-link')) { + clicked.innerHTML = ` + Cancel + + + + `; + } else { + clicked.innerHTML = ` + Edit + + + + `; + } + const data = new FormData; data.append("_id", termId); saveBtn.addEventListener('click', async () => { @@ -131,7 +151,10 @@ const notice = document.querySelector('#ajax-success'); if (res.status === 200) { - notice.innerHTML += 'Term updated successfully'; + notice.innerHTML = ` + + Term updated successfully + `; notice.classList.remove('is-hidden'); notice.querySelector('.delete').addEventListener('click', () => { notice.classList.add('is-hidden');
TermActions