Files
survey-bundle/contao/templates/frontend/member_survey_list.html.twig
T
2026-05-24 21:24:53 +02:00

56 lines
2.8 KiB
Twig

{% trans_default_domain 'messages' %}
{% include '@Survey/frontend/_survey_assets.html.twig' %}
{% include '@Survey/frontend/_survey_branding.html.twig' %}
{% set moduleHeadline = (headline is iterable ? headline.text|default('') : headline|default(''))|striptags|trim %}
<section class="survey-shell survey-grid">
{% if moduleHeadline %}
<header>
<h2>{{ moduleHeadline }}</h2>
</header>
{% endif %}
{% if loginRequired %}
<div class="survey-alert warning">{{ 'survey.list.login_required'|trans }}</div>
{% else %}
<div class="survey-button-row">
{% if createUrl %}
<a class="survey-button primary" href="{{ createUrl }}">{{ 'survey.list.create'|trans }}</a>
{% endif %}
</div>
<div class="survey-grid">
{% for survey in surveys %}
<article class="survey-card">
<div class="survey-meta">
<h3>{{ survey.title|striptags|trim }}</h3>
<span class="survey-badge {{ survey.published ? 'success' : 'neutral' }}">{{ survey.published ? 'survey.list.published'|trans : 'survey.list.draft'|trans }}</span>
{% if survey.isLocked %}
<span class="survey-badge warning">{{ 'survey.list.locked'|trans }}</span>
{% endif %}
</div>
<p>{{ (survey.description|striptags|trim) ?: 'survey.list.no_description'|trans }}</p>
<div class="survey-meta">
<span class="survey-badge neutral">{{ 'survey.list.questions'|trans({'%count%': survey.questionCount}) }}</span>
<span class="survey-badge neutral">{{ 'survey.list.answers'|trans({'%count%': survey.answerCount}) }}</span>
</div>
<div class="survey-button-row">
{% if survey.editUrl %}
<a class="survey-button primary" href="{{ survey.editUrl }}">{{ 'survey.list.edit'|trans }}</a>
{% endif %}
{% if survey.publicUrl %}
<a class="survey-button secondary" href="{{ survey.publicUrl }}" target="_blank" rel="noreferrer">{{ 'survey.list.public_view'|trans }}</a>
{% endif %}
{% if survey.resultsUrl %}
<a class="survey-button secondary" href="{{ survey.resultsUrl }}" target="_blank" rel="noreferrer">{{ 'survey.list.show_results'|trans }}</a>
{% endif %}
</div>
</article>
{% else %}
<div class="survey-card">{{ 'survey.list.empty'|trans }}</div>
{% endfor %}
</div>
{% endif %}
</section>