{% from 'utils.html.twig' import ico %}
{% extends 'website/main.template.html.twig' %}
{% block body %}
{% include 'website/includes/search-section.html.twig' %}
{% embed 'website/includes/page-title.html.twig' with { pageTitle: getLanguage('forum', 'forum') }%}
{% block migalhas %}
<a href="{{ path('home') }}">{{ getLanguage('home', 'forum') }}</a> / <span>{{ getLanguage('forum', 'forum') }}</span>
{% endblock %}
{% endembed %}
<div class="container">
<div class="contem-busca">
<form class="busca-lista" action="{{ path('forumItem', { id: forum.id, slug: slug }) }}" method="GET">
<input id="input-search-forum-detail" type="text" name="search" placeholder="{{ getLanguage('search_the_forum', 'forum') }} …">
<button type="submit">
<i class="material-icons">search</i>
</button>
</form>
{% if user %}
<button class="btn-acao" onclick="window.refEditor.openTab()"><span class="material-icons">add_circle_outline</span>{{ getLanguage('comment', 'forum') }}</button>
{% endif %}
</div>
{# QUESTÃO #}
<div class="forum-pergunta">
<a class="seta" href="{{ path('forum') }}">
<span class="material-icons">arrow_back</span>
</a>
<h2>{{ forum.getTitle(true) }}</h2>
{% include 'website/forum/forum-detail-box.html.twig' with { forumItem: forum, layout: 'question' } %}
{# MODAL -- OHTERS LIKES #}
{% embed "website/includes/modal.html.twig" with {'id': 'modal-others-likes-question', 'title': getLanguage('all_likes', 'forum'), 'classes': 'modal-forum' } %}
{% block content %}
{% include 'website/includes/modal-others-likes.html.twig' with { forumItem: forum, layout: 'question' } %}
{% endblock %}
{% endembed %}
</div>
</div>
{# RESPOSTAS #}
<div id="contem-answers" class="container questao-respostas" data-url="{{ path('forumItemAnswers', { id: forum.id }) }}">
{% include 'website/forum/forum-list-answers.html.twig' with { init: true }%}
</div>
{% if user %}
{# ABA EDITOR -- RESPOSTA #}
{% embed 'website/includes/text-editor.html.twig' with {
titulo: getLanguage('reply_to_topic', 'forum'),
formId: 'formSendAnswer',
action: path('registerForum'),
method: 'post',
} %}
{% block campos %}
<input type="hidden" id="topico-resposta-user" name="user" value="{{ user.id }}">
<input type="hidden" id="topico-resposta-forum" name="forum" value="{{ forum.id }}">
<input type="hidden" id="topico-resposta-titulo" name="title" value="{{ forum.getTitle(true) }}">
<input type="hidden" id="topico-resposta-categoria" name="forumCategory" value="{{ forum.forumCategory.id }}">
<div class="editor-wrap">
<textarea class="editor js--editor" id="topico-resposta-text" name="text" required></textarea>
</div>
{% endblock %}
{% endembed %}
{# MODAL -- EDITAR TÓPICO #}
{% embed "website/includes/modal.html.twig" with {'id': 'modal-editar-topico', 'title': getLanguage('edit_topic', 'forum'), 'classes': 'modal-forum' } %}
{% block content %}
{% from 'utils.html.twig' import ico, switch %}
<form id="forumFormEditTopic"
action="{{ path('editForum', { id: forum.id }) }}"
method="put" class="form-geral">
<input type="hidden" id="topico-novo-user" name="user" value="{{ user.id }}">
<input type="hidden" id="topico-forum" name="forum" value="{{ forum.id }}">
<input type="hidden" id="url-file-delete" name="urlFileDelete" value="{{ path('fileDeleteUpload') }}">
<div class="cp">
<label for="topico-novo-titulo">{{ getLanguage('topic_title', 'forum') }}</label>
<input type="text" id="topico-novo-titulo" name="title" value="{{ forum.getTitle(true) }}" required>
</div>
<div class="cp">
<label>{{ getLanguage('topic_text', 'forum') }}</label>
<textarea class="modal-textbox js--editor-modal" id="topico-novo-texto" name="text" required>
{{ forum.getText(true)|raw }}
</textarea>
</div>
<div class="cp-cols cp-2 modal-forum">
<div class="cp cp-gd categoria">
<label for="topico-novo-categoria">{{ getLanguage('category', 'forum') }}</label>
<select id="topico-novo-categoria" name="forumCategory" class="custom-select">
{% for forumCategory in forumCategories %}
<option value="{{ forumCategory.id }}">{{ forumCategory.category }}</option>
{% endfor %}
</select>
</div>
{% if not isLow(getPermission("website", "forum", "edit")) %}
<div class="cp cp-6 status">
<label for="topico-novo-status">{{ getLanguage('status', 'forum') }}</label>
{{ switch({
name: 'status',
classes: ['wid'],
checked: (forum.status == isForumStatusDefault ? true : false),
attribs: 'id="topico-novo-status"',
insideLabel: [getLanguage('published', 'forum'), getLanguage('filed', 'forum')],
})}}
</div>
{% endif %}
</div>
{# CAPTCHA #}
{% include 'website/includes/captcha-form.html.twig' with { formName: 'forumFormEditTopic' } %}
<nav class="actions">
<button type="button" class="js--modal-fecha cancel">{{ getLanguage('cancel', 'forum') }}</button>
<button type="submit" class="btn-continuar-peq">{{ getLanguage('send', 'forum') }}<i class="loader">{{ ico('loader-wish') }}</i></button>
</nav>
</form>
{% endblock %}
{% endembed %}
{% endif %}
{% endblock %}
{% block overlay %}
<div class="loader-page">
<i class="loader">{{ ico('loader-wish') }}</i>
</div>
{% endblock %}