From 38d78d6df9de6fac082ce7a1a7dc371037e2c2ec Mon Sep 17 00:00:00 2001 From: julien Date: Mon, 9 Mar 2026 14:27:52 +0100 Subject: [PATCH] Simplified --- src/Routes/web.php | 26 -- .../a8/a8a112b9f839398a4c36c8749dbe2f2d.php | 225 ++++++++++++++++++ views/pages/post_form.twig | 42 +++- 3 files changed, 260 insertions(+), 33 deletions(-) delete mode 100644 src/Routes/web.php create mode 100644 var/cache/twig/a8/a8a112b9f839398a4c36c8749dbe2f2d.php diff --git a/src/Routes/web.php b/src/Routes/web.php deleted file mode 100644 index fcbab76..0000000 --- a/src/Routes/web.php +++ /dev/null @@ -1,26 +0,0 @@ -get('/', [$controller, 'index']); - $app->get('/admin', [$controller, 'admin']); - $app->get('/admin/edit/{id}', [$controller, 'form']); - $app->post('/admin/create', [$controller, 'create']); - $app->post('/admin/edit/{id}', [$controller, 'update']); - $app->post('/admin/delete/{id}', [$controller, 'delete']); -}; diff --git a/var/cache/twig/a8/a8a112b9f839398a4c36c8749dbe2f2d.php b/var/cache/twig/a8/a8a112b9f839398a4c36c8749dbe2f2d.php new file mode 100644 index 0000000..1b4385f --- /dev/null +++ b/var/cache/twig/a8/a8a112b9f839398a4c36c8749dbe2f2d.php @@ -0,0 +1,225 @@ + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->blocks = [ + 'title' => [$this, 'block_title'], + 'content' => [$this, 'block_content'], + 'scripts' => [$this, 'block_scripts'], + ]; + } + + protected function doGetParent(array $context): bool|string|Template|TemplateWrapper + { + // line 1 + return "layout.twig"; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + $this->parent = $this->load("layout.twig", 1); + yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + /** + * @return iterable + */ + public function block_title(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 4 + if (((array_key_exists("post", $context) && !(null === ($context["post"] ?? null))) && (CoreExtension::getAttribute($this->env, $this->source, ($context["post"] ?? null), "id", [], "any", false, false, false, 4) > 0))) { + // line 5 + yield "Éditer l'article +"; + } else { + // line 7 + yield "Créer un article +"; + } + yield from []; + } + + // line 11 + /** + * @return iterable + */ + public function block_content(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 12 + yield " +

+ "; + // line 14 + if (((array_key_exists("post", $context) && !(null === ($context["post"] ?? null))) && (CoreExtension::getAttribute($this->env, $this->source, ($context["post"] ?? null), "id", [], "any", false, false, false, 14) > 0))) { + // line 15 + yield " Éditer l'article + "; + } else { + // line 17 + yield " Créer un article + "; + } + // line 19 + yield "

+ +"; + // line 22 + yield "
env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["action"] ?? null), "html", null, true); + yield "\"> +

+ +

+ +

+ +

+ +

+ + Annuler +

+
+ +"; + // line 47 + if (((array_key_exists("post", $context) && !(null === ($context["post"] ?? null))) && (CoreExtension::getAttribute($this->env, $this->source, ($context["post"] ?? null), "id", [], "any", false, false, false, 47) > 0))) { + // line 48 + yield "
+ + Créé le : "; + // line 50 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, ($context["post"] ?? null), "createdAt", [], "any", false, false, false, 50), "d/m/Y à H:i"), "html", null, true); + yield "
+ Modifié le : "; + // line 51 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, ($context["post"] ?? null), "updatedAt", [], "any", false, false, false, 51), "d/m/Y à H:i"), "html", null, true); + yield " +
+"; + } + // line 54 + yield " +"; + yield from []; + } + + // line 57 + /** + * @return iterable + */ + public function block_scripts(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 58 + yield " + +"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "pages/post_form.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function isTraitable(): bool + { + return false; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 169 => 58, 162 => 57, 156 => 54, 150 => 51, 146 => 50, 142 => 48, 140 => 47, 133 => 42, 129 => 40, 125 => 38, 123 => 37, 114 => 31, 105 => 25, 98 => 22, 94 => 19, 90 => 17, 86 => 15, 84 => 14, 80 => 12, 73 => 11, 66 => 7, 62 => 5, 60 => 4, 53 => 3, 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "pages/post_form.twig", "/home/julien/Documents/Git/julien/blog-slim/views/pages/post_form.twig"); + } +} diff --git a/views/pages/post_form.twig b/views/pages/post_form.twig index 6c3b8f6..8e1d793 100644 --- a/views/pages/post_form.twig +++ b/views/pages/post_form.twig @@ -10,11 +10,13 @@ Créer un article {% block content %} -{% if post is defined and post is not null and post.id > 0 %} -Éditer l'article -{% else %} -Créer un article -{% endif %} +

+ {% if post is defined and post is not null and post.id > 0 %} + Éditer l'article + {% else %} + Créer un article + {% endif %} +

{# Formulaire identifié pour le script JavaScript #}
@@ -26,7 +28,8 @@ Créer un article

@@ -52,4 +55,29 @@ Créer un article {% endblock %} -{% block scripts %} \ No newline at end of file +{% block scripts %} + + +{% endblock %} \ No newline at end of file