Simplified

This commit is contained in:
julien
2026-03-09 14:17:05 +01:00
parent e65d79cccb
commit eff05b0971
18 changed files with 1012 additions and 523 deletions

View File

@@ -0,0 +1,72 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* partials/_header.twig */
class __TwigTemplate_722bfa8935490dbfa02149909963bc2e extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 1
yield "<header>
<h1>
<a href=\"/\">Mon Blog</a> |
<a href=\"/admin\">Admin</a>
</h1>
</header>
";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "partials/_header.twig";
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "partials/_header.twig", "/home/julien/Documents/Git/julien/blog-slim/views/partials/_header.twig");
}
}

View File

@@ -0,0 +1,84 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* partials/_footer.twig */
class __TwigTemplate_f24e585e1ab9b18bf721f5ade85d5894 extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 1
yield "<footer class=\"site-footer\">
<p>&copy; ";
// line 2
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate("now", "Y"), "html", null, true);
yield " Mon Blog Tous droits réservés.</p>
<nav>
<a href=\"\">À propos</a> |
<a href=\"\">Contact</a>
</nav>
</footer>
";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "partials/_footer.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 45 => 2, 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "partials/_footer.twig", "/home/julien/Documents/Git/julien/blog-slim/views/partials/_footer.twig");
}
}

View File

@@ -0,0 +1,151 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* pages/home.twig */
class __TwigTemplate_9471f8175ca69249c24a559aa9930d1d extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
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'],
];
}
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<null|scalar|\Stringable>
*/
public function block_title(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
yield "Mon Blog";
yield from [];
}
// line 5
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_content(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 6
$context['_parent'] = $context;
$context['_seq'] = CoreExtension::ensureTraversable(($context["posts"] ?? null));
$context['_iterated'] = false;
foreach ($context['_seq'] as $context["_key"] => $context["post"]) {
// line 7
yield "<article class=\"post\">
<h2>";
// line 8
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "title", [], "any", false, false, false, 8), "html", null, true);
yield "</h2>
<div class=\"post-meta\">
<small>Publié le ";
// line 11
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "createdAt", [], "any", false, false, false, 11), "d/m/Y à H:i"), "html", null, true);
yield "</small>
";
// line 12
if ((($tmp = CoreExtension::getAttribute($this->env, $this->source, $context["post"], "isRecent", [7], "method", false, false, false, 12)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
// line 13
yield " <span class=\"badge badge-new\">Nouveau</span>
";
}
// line 15
yield " </div>
<p>";
// line 17
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "getExcerpt", [200], "method", false, false, false, 17), "html", null, true);
yield "</p>
<p>
<a href=\"/article/";
// line 20
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "getSlug", [], "method", false, false, false, 20), "html", null, true);
yield "\">Lire la suite →</a>
</p>
</article>
";
$context['_iterated'] = true;
}
// line 23
if (!$context['_iterated']) {
// line 24
yield "<p>Aucun article publié.</p>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_key'], $context['post'], $context['_parent'], $context['_iterated']);
$context = array_intersect_key($context, $_parent) + $_parent;
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "pages/home.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 114 => 24, 112 => 23, 104 => 20, 98 => 17, 94 => 15, 90 => 13, 88 => 12, 84 => 11, 78 => 8, 75 => 7, 70 => 6, 63 => 5, 52 => 3, 41 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "pages/home.twig", "/home/julien/Documents/Git/julien/blog-slim/views/pages/home.twig");
}
}

View File

@@ -0,0 +1,158 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* layout.twig */
class __TwigTemplate_589a65738a57deabe1e7c4440aeb0288 extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
'title' => [$this, 'block_title'],
'content' => [$this, 'block_content'],
'scripts' => [$this, 'block_scripts'],
];
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 1
yield "<!DOCTYPE html>
<html lang=\"fr\">
<head>
<meta charset=\"UTF-8\">
<title>";
// line 5
yield from $this->unwrap()->yieldBlock('title', $context, $blocks);
yield "</title>
";
// line 7
yield " <style>
body {font-family: Arial, sans-serif; margin: 2rem;}
.post {border-bottom: 1px solid #ccc; padding: 1rem 0;}
.admin-actions a,
.admin-actions form {margin-right: .5rem;}
</style>
</head>
<body>
";
// line 17
yield " ";
yield from $this->load("partials/_header.twig", 17)->unwrap()->yield($context);
// line 18
yield "
";
// line 20
yield " <main>
";
// line 21
yield from $this->unwrap()->yieldBlock('content', $context, $blocks);
// line 22
yield " </main>
";
// line 25
yield " ";
yield from $this->load("partials/_footer.twig", 25)->unwrap()->yield($context);
// line 26
yield "
";
// line 28
yield " ";
// line 29
yield " ";
yield from $this->unwrap()->yieldBlock('scripts', $context, $blocks);
// line 30
yield "</body>
</html>
";
yield from [];
}
// line 5
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_title(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
yield "Mon Blog";
yield from [];
}
// line 21
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_content(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
yield from [];
}
// line 29
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_scripts(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "layout.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 121 => 29, 111 => 21, 100 => 5, 92 => 30, 89 => 29, 87 => 28, 84 => 26, 81 => 25, 77 => 22, 75 => 21, 72 => 20, 69 => 18, 66 => 17, 55 => 7, 51 => 5, 45 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "layout.twig", "/home/julien/Documents/Git/julien/blog-slim/views/layout.twig");
}
}

View File

@@ -0,0 +1,182 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* pages/admin.twig */
class __TwigTemplate_9953ee20db26573f1b0e2b3758f3423d extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
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'],
];
}
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<null|scalar|\Stringable>
*/
public function block_title(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
yield "Admin Gestion des articles";
yield from [];
}
// line 5
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_content(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 6
yield "<h2>Gestion des articles</h2>
<!-- Lien d'ajout -->
<p>
<a href=\"/admin/edit/0\" class=\"btn btn-primary\">+ Ajouter un article</a>
</p>
";
// line 13
if ((($tmp = !Twig\Extension\CoreExtension::testEmpty(($context["posts"] ?? null))) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
// line 14
yield "<table class=\"admin-table\">
<thead>
<tr>
<th>Titre</th>
<th>Créé le</th>
<th>Modifié le</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
";
// line 24
$context['_parent'] = $context;
$context['_seq'] = CoreExtension::ensureTraversable(($context["posts"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["post"]) {
// line 25
yield " <tr>
<td>
<strong>";
// line 27
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "title", [], "any", false, false, false, 27), "html", null, true);
yield "</strong>
";
// line 28
if ((($tmp = CoreExtension::getAttribute($this->env, $this->source, $context["post"], "isRecent", [7], "method", false, false, false, 28)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
// line 29
yield " <span class=\"badge badge-new\">Nouveau</span>
";
}
// line 31
yield " </td>
<td>";
// line 32
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "createdAt", [], "any", false, false, false, 32), "d/m/Y H:i"), "html", null, true);
yield "</td>
<td>";
// line 33
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "updatedAt", [], "any", false, false, false, 33), "d/m/Y H:i"), "html", null, true);
yield "</td>
<td class=\"admin-actions\">
<a href=\"/admin/edit/";
// line 35
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 35), "html", null, true);
yield "\" class=\"btn btn-sm btn-secondary\">Éditer</a>
<form method=\"post\" action=\"/admin/delete/";
// line 37
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 37), "html", null, true);
yield "\" style=\"display:inline;\">
<button type=\"submit\" class=\"btn btn-sm btn-danger\"
onclick=\"return confirm('Supprimer cet article ?')\">
Supprimer
</button>
</form>
</td>
</tr>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_key'], $context['post'], $context['_parent']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 46
yield " </tbody>
</table>
";
} else {
// line 49
yield "<p><em>Aucun article à gérer.</em></p>
";
}
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "pages/admin.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 148 => 49, 143 => 46, 128 => 37, 123 => 35, 118 => 33, 114 => 32, 111 => 31, 107 => 29, 105 => 28, 101 => 27, 97 => 25, 93 => 24, 81 => 14, 79 => 13, 70 => 6, 63 => 5, 52 => 3, 41 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "pages/admin.twig", "/home/julien/Documents/Git/julien/blog-slim/views/pages/admin.twig");
}
}