2020-12-18 18:27:10 +01:00
|
|
|
{% extends 'layouts/app.twig' %}
|
|
|
|
{% import 'macros/base.twig' as m %}
|
|
|
|
{% import 'macros/form.twig' as f %}
|
|
|
|
|
2024-02-18 17:50:08 +01:00
|
|
|
{% block title %}
|
|
|
|
{% if is_admin | default(false) %}
|
|
|
|
{{ __('question.admin') }}
|
|
|
|
{% else %}
|
|
|
|
{{ __('question.questions') }}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2020-12-18 18:27:10 +01:00
|
|
|
|
2024-02-18 21:06:46 +01:00
|
|
|
{% block contact_options %}
|
|
|
|
{% for name,opt in config('contact_options') %}
|
|
|
|
{% set url = opt is iterable ? opt[0] : opt %}
|
|
|
|
{% set permission = opt is iterable ? opt[1] : null %}
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if not permission or can(permission) %}
|
2024-02-18 21:06:46 +01:00
|
|
|
<a href="
|
|
|
|
{%- if url starts with '/' %}
|
|
|
|
{{ url(url) }}
|
|
|
|
{%- else -%}
|
|
|
|
{{ url }}
|
|
|
|
{%- endif %}"
|
|
|
|
{%- if not (url starts with '/') %}
|
|
|
|
target="_blank" rel="noopener"
|
|
|
|
{%- endif %}>
|
|
|
|
{{ __(name) }}
|
|
|
|
</a>{% if not loop.last %},{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock %}
|
|
|
|
|
2020-12-18 18:27:10 +01:00
|
|
|
{% block content %}
|
|
|
|
<div class="container">
|
|
|
|
<div class="page-header">
|
|
|
|
<h1>
|
|
|
|
{{ block('title') }}
|
2024-02-18 17:50:08 +01:00
|
|
|
{% if is_admin | default(false) %}
|
|
|
|
{{ m.button(m.icon('question-lg'), url('/faq'), 'secondary', null, __('faq.faq')) }}
|
|
|
|
{% else %}
|
|
|
|
{{ m.button(m.icon('plus-lg'), url('/questions/new'), 'secondary') }}
|
|
|
|
{% endif %}
|
2020-12-18 18:27:10 +01:00
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% include 'layouts/parts/messages.twig' %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
{% block row %}
|
|
|
|
<div class="col-md-12">
|
|
|
|
{% block questions %}
|
2021-12-10 20:48:17 +01:00
|
|
|
{% block faq_text %}
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if can('faq.view') %}
|
2024-02-18 17:50:08 +01:00
|
|
|
{% if not is_admin | default(false) %}
|
2024-02-18 21:06:46 +01:00
|
|
|
<p>
|
|
|
|
{{ __('question.faq_link', [url('/faq')]) | raw }}
|
|
|
|
</p>
|
2024-02-18 17:50:08 +01:00
|
|
|
{% endif %}
|
2021-12-10 20:48:17 +01:00
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2024-02-18 21:06:46 +01:00
|
|
|
{%- block info_text %}
|
|
|
|
{% if config('contact_options') and not is_admin|default(false) %}
|
|
|
|
<p>
|
|
|
|
{{ m.info(__('question.contact_options') ~ block('contact_options'), true) }}
|
|
|
|
</p>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2021-12-10 20:48:17 +01:00
|
|
|
|
2020-12-18 18:27:10 +01:00
|
|
|
{% 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 %}">
|
2021-08-05 01:00:12 +02:00
|
|
|
<div class="card-body bg-body">
|
2020-12-18 18:27:10 +01:00
|
|
|
{{ question.text|nl2br }}
|
|
|
|
</div>
|
|
|
|
|
2023-12-06 21:15:54 +01:00
|
|
|
<div class="card-footer {{ m.type_bg_class() }} d-flex align-items-center">
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="me-3">
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div>
|
2020-12-18 18:27:10 +01:00
|
|
|
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if can('question.edit') %}
|
2022-06-06 13:00:37 +02:00
|
|
|
{{ m.user(question.user, {'pronoun': true}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
|
2023-11-05 16:29:07 +01:00
|
|
|
<div class="d-flex ms-auto">
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if can('question.edit') %}
|
2023-12-21 13:08:29 +01:00
|
|
|
{{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm', __('form.edit')) }}
|
2023-11-05 16:29:07 +01:00
|
|
|
{% endif %}
|
2020-12-18 18:27:10 +01:00
|
|
|
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if question.user.id == user.id or can('question.edit') %}
|
2023-11-05 16:29:07 +01:00
|
|
|
<form class="ps-1" method="post" action="">
|
|
|
|
{{ csrf() }}
|
|
|
|
{{ f.hidden('id', question.id) }}
|
2023-11-10 16:20:01 +01:00
|
|
|
{{ f.delete(null, {
|
|
|
|
'size': 'sm',
|
|
|
|
'confirm_title': __('question.delete.title', [question.text[:40]|e]),
|
|
|
|
'confirm_button_text': __('form.delete'),
|
|
|
|
}) }}
|
2023-11-05 16:29:07 +01:00
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-12-18 18:27:10 +01:00
|
|
|
</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">
|
2023-07-26 20:25:28 +02:00
|
|
|
<div class="card-body bg-body {{ m.type_text_class() }}">
|
2020-12-18 18:27:10 +01:00
|
|
|
{{ question.answer|markdown }}
|
|
|
|
</div>
|
2023-12-06 21:15:54 +01:00
|
|
|
<div class="card-footer {{ m.type_bg_class() }} d-flex align-items-center {{ m.type_text_class() }}">
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="me-3">
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ question.updated_at.format(__('general.datetime')) }}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div>
|
2022-06-06 13:00:37 +02:00
|
|
|
{{ m.user(question.answerer, {'pronoun': true}) }}
|
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 %}
|