kbin-core/templates/post/comment/_form_comment.html.twig
Ernest Wiśniewski c1d6917707 Markdown toolbar
2023-04-02 15:41:47 +02:00

49 lines
1.8 KiB
Twig

{% if edit is not defined %}
{% set edit = false %}
{% endif %}
{% if edit %}
{% set title = 'edit_comment'|trans %}
{% set action = path('post_comment_edit', {magazine_name: post.magazine.name, post_id: post.id, comment_id: comment.id}) %}
{% else %}
{% set title = 'add_comment'|trans %}
{% set action = path('post_comment_create', {magazine_name: post.magazine.name, post_id: post.id, parent_comment_id: parent is defined and parent ? parent.id : null}) %}
{% endif %}
<h3 hidden>{{ title }}</h3>
{{ form_start(form, {action: action, attr: {class: edit ? 'comment-edit replace' : 'comment-add'}}) }}
<div class="row">
{{ component('editor_toolbar', {id: 'post_comment_body'}) }}
{{ form_row(form.body, {label: false}) }}
</div>
<div class="row actions">
<ul>
<li>
<button type="button"
class="btn btn__secondary"
aria-label="{{ 'markdown_howto'|trans }}"
title="{{ 'markdown_howto'|trans }}">
<i class="fa-solid fa-circle-question"></i>
</button>
</li>
<li class="dropdown">
<button type="button"
class="btn btn__secondary"
aria-label="{{ 'add_media'|trans }}"
title="{{ 'add_media'|trans }}">
<i class="fa-solid fa-photo-film"></i>
</button>
<div class="dropdown__menu">
{% include 'layout/_form_media.html.twig' %}
</div>
</li>
<li class="select">
{{ form_row(form.lang, {label: false}) }}
</li>
<li>
{{ form_row(form.submit, {label: edit ? 'edit_comment' : 'add_comment', attr: {class: 'btn btn__primary', 'data-action': 'subject#sendForm'}}) }}
</li>
</ul>
</div>
{{ form_end(form) }}