This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blog-slim.old/views/pages/post_form.twig
2026-03-09 14:46:14 +01:00

55 lines
1.4 KiB
Twig

{% extends "layout.twig" %}
{% block title %}
{% if post is defined and post is not null and post.id > 0 %}
Éditer l'article
{% else %}
Créer un article
{% endif %}
{% endblock %}
{% block content %}
<h2>
{% if post is defined and post is not null and post.id > 0 %}
Éditer l'article
{% else %}
Créer un article
{% endif %}
</h2>
{# Formulaire identifié pour le script JavaScript #}
<form id="articleForm" method="post" action="{{ action }}">
<p>
<label for="title">Titre<br>
<input type="text" id="title" name="title" value="{{ post.title|default('') }}" required maxlength="255">
</label>
</p>
<p>
<label for="editor">Contenu<br>
<textarea id="editor" name="content" rows="6" required>{{ post.content|default('') }}</textarea>
</label>
</p>
<p>
<button type="submit" class="btn btn-primary">
{% if post is defined and post is not null and post.id > 0 %}
Mettre à jour
{% else %}
Enregistrer
{% endif %}
</button>
<a href="/admin" class="btn btn-secondary">Annuler</a>
</p>
</form>
{% if post is defined and post is not null and post.id > 0 %}
<hr>
<small>
Créé le : {{ post.createdAt|date("d/m/Y à H:i") }}<br>
Modifié le : {{ post.updatedAt|date("d/m/Y à H:i") }}
</small>
{% endif %}
{% endblock %}