You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
4.4 KiB
Twig

{% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}
{{ __('question.questions') }}
{% endblock %}
{% block content %}
<div class="container">
<div class="page-header">
<h1>
{{ block('title') }}
{% if not is_admin|default(false) %}
{{ m.button(m.icon('plus-lg'), url('questions/new'), 'secondary') }}
{% endif %}
</h1>
</div>
{% include 'layouts/parts/messages.twig' %}
<div class="row">
{% block row %}
<div class="col-md-12">
{% block questions %}
{% for question in questions %}
<div class="row mb-4">
<div class="col-md-12">
<div class="card {% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %}">
<div class="card-body {{ m.type_bg_class() }}">
{{ question.text|nl2br }}
</div>
<div class="card-footer d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ question.created_at.format(__('Y-m-d H:i')) }}
</div>
{% if has_permission_to('question.edit') %}
{{ m.user(question.user) }}
<div class="d-flex ms-auto">
{% endif %}
{% if question.user.id == user.id or has_permission_to('question.edit') %}
<form
class="pe-1"
action=""
enctype="multipart/form-data"
method="post"
>
{{ csrf() }}
{{ f.hidden('id', question.id) }}
{{ f.submit(m.icon('trash'), {'name': 'delete', 'btn_type': 'danger', 'btn_size': 'sm', 'title': __('form.delete')}) }}
</form>
{% endif %}
{% if has_permission_to('question.edit') %}
{{ m.button(m.icon('pencil-square'), url('admin/questions/' ~ question.id), null, 'sm') }}
</div>
{% endif %}
</div>
</div>
</div>
{% if question.answer %}
<div class="col-md-11 offset-md-1 mt-3">
<div class="card bg-info">
<div class="card-body {{ m.type_bg_class() }}">
{{ question.answer|markdown }}
</div>
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %} d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ question.updated_at.format(__('Y-m-d H:i')) }}
</div>
{{ m.user(question.answerer) }}
</div>
</div>
</div>
{% endif %}
</div> <!-- row -->
{% endfor %}
{% endblock %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}