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

@@ -1,68 +1,55 @@
{% extends "layout.twig" %}
{% block title %}
{% if post is defined and post is not null and post.id is defined %}
Éditer larticle
{% 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 %}
{% endblock %}
{% block content %}
<h2>
{% if post is defined and post is not null and post.id is defined %}
Éditer larticle
{% else %}
Créer un article
{% endif %}
</h2>
{# Formulaire identifié pour le script JavaScript #}
<form id="articleForm" method="post" action="{{ action }}">
<p>
<label>Titre<br>
<input type="text" name="title"
value="{{ post.title|default('') }}" required>
</label>
</p>
{% if post is defined and post is not null and post.id > 0 %}
Éditer l'article
{% else %}
Créer un article
{% endif %}
<p>
<label>Contenu<br>
<textarea id="editor" name="content" rows="6">{{ post.content|default('') }}</textarea>
</label>
</p>
{# 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>
<button type="submit">
{% if post is defined and post is not null and post.id is defined %}Mettre à jour{% else %}Enregistrer{% endif %}
<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>
</form>
<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 %}
<p><a href="/admin">Retour à ladmin</a></p>
{% endblock %}
{% block scripts %}
<script src="/js/tinymce/tinymce.min.js" referrerpolicy="origin" crossorigin="anonymous"></script>
<script>
tinymce.init({
selector: '#editor',
base_url: '/js/tinymce',
license_key: 'gpl',
height: 400,
menubar: false,
plugins: [
'advlist', 'autolink', 'lists', 'link', 'image',
'charmap', 'preview', 'anchor', 'searchreplace',
'visualblocks', 'code', 'fullscreen',
'insertdatetime', 'media', 'table',
'help', 'wordcount'
],
toolbar: [
'undo redo | formatselect | bold italic underline |',
'alignleft aligncenter alignright alignjustify |',
'bullist numlist outdent indent | link image media |',
'removeformat | help'
].join(' '),
content_style: 'body {font-family:Helvetica,Arial,sans-serif;font-size:14px}'
});
</script>
{% endblock %}
{% block scripts %}