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 and question.id ? __('question.edit') : __('question.add') }}{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="container">
|
2023-10-25 17:38:23 +02:00
|
|
|
<h1>
|
2023-12-21 13:08:29 +01:00
|
|
|
{{ m.button(m.icon('chevron-left'), url('/questions'), null, 'sm', __('general.back')) }}
|
2023-10-25 17:38:23 +02:00
|
|
|
{{ block('title') }}
|
|
|
|
</h1>
|
2020-12-18 18:27:10 +01:00
|
|
|
|
|
|
|
{% include 'layouts/parts/messages.twig' %}
|
|
|
|
|
|
|
|
{% if question and question.id %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<p>
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ question.updated_at.format(__('general.datetime')) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
|
|
|
|
{% if question.updated_at != question.created_at %}
|
|
|
|
 {{ __('form.updated') }}
|
|
|
|
<br>
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<form action="" enctype="multipart/form-data" method="post">
|
|
|
|
{{ csrf() }}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2023-04-19 22:34:08 +02:00
|
|
|
{{ f.textarea('text', __('question.question'), {
|
|
|
|
'required': true,
|
|
|
|
'rows': 10,
|
|
|
|
'value': question ? question.text : '',
|
|
|
|
}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
{% if is_admin|default(false) %}
|
2023-04-19 22:34:08 +02:00
|
|
|
{{ f.textarea('answer', __('question.answer'), {
|
|
|
|
'required': true,
|
|
|
|
'rows': 10, 'value': question ? question.answer : '',
|
|
|
|
}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
|
2023-11-05 16:29:07 +01:00
|
|
|
{{ f.submit(__('form.save'), {'icon_left': 'save'}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% if is_admin|default(false) %}
|
2021-07-24 12:38:23 +02:00
|
|
|
{{ f.submit(m.icon('eye'), {'name': 'preview', 'btn_type': 'info', 'title': __('form.preview')}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% if question and question.id %}
|
2023-11-10 16:20:01 +01:00
|
|
|
{{ f.delete(__('form.delete'), {'confirm_title': __('question.delete.title', [question.text[:40]|e])}) }}
|
2020-12-18 18:27:10 +01:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if question %}
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="row mt-3">
|
2020-12-18 18:27:10 +01:00
|
|
|
<div class="col-md-12">
|
|
|
|
<h2>{{ __('form.preview') }}</h2>
|
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="card {% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %} mb-4">
|
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>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if question.answer %}
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="col-md-11 offset-md-1">
|
|
|
|
<div class="card bg-info">
|
2021-08-05 01:00:12 +02:00
|
|
|
<div class="card-body bg-body">
|
2020-12-18 18:27:10 +01:00
|
|
|
{{ question.answer|markdown }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|