55 lines
1.4 KiB
Twig
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 %}
|
|
|
|
{% 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 #}
|
|
<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 %}
|
|
|
|
{% block scripts %} |