engelsystem/resources/views/pages/questions/overview.twig

84 lines
4.0 KiB
Twig
Raw Normal View History

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) %}
{{ 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 %}
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
{{ question.text|nl2br }}
</div>
<div class="panel-footer">
{{ m.icon('clock') }} {{ question.created_at.format(__('Y-m-d H:i')) }}
2020-12-18 18:27:10 +01:00
{% if has_permission_to('question.edit') %}
&nbsp;{{ m.user(question.user) }}
{% endif %}
{% if question.user.id == user.id or has_permission_to('question.edit') %}
<form
action=""
enctype="multipart/form-data"
method="post"
class="pull-right"
>
{{ 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') %}
<span class="pull-right">
2021-07-23 01:52:19 +02:00
{{ m.button(m.icon('pencil-square'), url('admin/questions/' ~ question.id), null, 'sm') }}
2020-12-18 18:27:10 +01:00
</span>
{% endif %}
</div>
</div>
</div>
{% if question.answer %}
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-info">
<div class="panel-body">
{{ question.answer|markdown }}
</div>
<div class="panel-footer">
{{ m.icon('clock') }} {{ question.updated_at.format(__('Y-m-d H:i')) }}
2020-12-18 18:27:10 +01:00
&nbsp;{{ m.user(question.answerer) }}
</div>
</div>
</div>
{% endif %}
</div>
{% endfor %}
{% endblock %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}