2020-12-18 18:27:10 +01:00
|
|
|
{% 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) %}
|
2021-07-22 21:22:21 +02:00
|
|
|
{{ m.button(m.icon('plus-lg'), url('questions/new'), 'secondary') }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% include 'layouts/parts/messages.twig' %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
{% block row %}
|
|
|
|
<div class="col-md-12">
|
|
|
|
{% block questions %}
|
|
|
|
{% for question in questions %}
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="row mb-4">
|
2020-12-18 18:27:10 +01:00
|
|
|
<div class="col-md-12">
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="card {% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %}">
|
|
|
|
<div class="card-body {{ m.type_bg_class() }}">
|
2020-12-18 18:27:10 +01:00
|
|
|
{{ question.text|nl2br }}
|
|
|
|
</div>
|
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
<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>
|
2020-12-18 18:27:10 +01:00
|
|
|
|
|
|
|
{% if has_permission_to('question.edit') %}
|
2021-07-24 12:38:23 +02:00
|
|
|
{{ m.user(question.user) }}
|
|
|
|
<div class="d-flex ms-auto">
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if question.user.id == user.id or has_permission_to('question.edit') %}
|
|
|
|
<form
|
2021-07-24 12:38:23 +02:00
|
|
|
class="pe-1"
|
2020-12-18 18:27:10 +01:00
|
|
|
action=""
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
method="post"
|
|
|
|
>
|
|
|
|
{{ csrf() }}
|
|
|
|
{{ f.hidden('id', question.id) }}
|
2021-07-23 01:52:19 +02:00
|
|
|
{{ f.submit(m.icon('trash'), {'name': 'delete', 'btn_type': 'danger', 'btn_size': 'sm', 'title': __('form.delete')}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if has_permission_to('question.edit') %}
|
2021-07-24 12:38:23 +02:00
|
|
|
{{ m.button(m.icon('pencil-square'), url('admin/questions/' ~ question.id), null, 'sm') }}
|
|
|
|
</div>
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% if question.answer %}
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="col-md-11 offset-md-1 mt-3">
|
|
|
|
<div class="card bg-info">
|
|
|
|
<div class="card-body {{ m.type_bg_class() }}">
|
2020-12-18 18:27:10 +01:00
|
|
|
{{ question.answer|markdown }}
|
|
|
|
</div>
|
2021-07-24 12:38:23 +02:00
|
|
|
<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) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div> <!-- row -->
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endfor %}
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|