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

69 lines
2.1 KiB
Twig
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "layout.twig" %}
{% block title %}
{% if post is defined and post.id is defined %}
Éditer larticle
{% else %}
Créer un article
{% endif %}
{% endblock %}
{% block content %}
<h2>
{% if post is defined 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>
<p>
<label>Contenu<br>
<textarea id="editor" name="content" rows="6" {# required <- removed because conflicts with TinyMCE#}>{{ post.content|default('') }}</textarea>
</label>
</p>
<button type="submit">
{% if post is defined and post.id is defined %}Mettre à jour{% else %}Enregistrer{% endif %}
</button>
</form>
<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', // assure le bon chemin relatif
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 %}