81 lines
4.8 KiB
Twig
81 lines
4.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">
|
|
{% for message in app.flashes('success') %}
|
|
<div class="survey-alert success">{{ message }}</div>
|
|
{% endfor %}
|
|
|
|
{% for message in app.flashes('error') %}
|
|
<div class="survey-alert error">{{ message }}</div>
|
|
{% endfor %}
|
|
|
|
{% 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 survey-list-grid">
|
|
{% for survey in surveys %}
|
|
<article class="survey-card survey-list-card">
|
|
<div class="survey-list-card__head">
|
|
<div class="survey-list-card__title-wrap">
|
|
<h3>{{ survey.title|striptags|trim }}</h3>
|
|
<div class="survey-meta">
|
|
<span class="survey-badge {{ survey.published ? 'success' : 'warning' }}">{{ survey.published ? 'survey.list.published'|trans : 'survey.list.draft'|trans }}</span>
|
|
{% if survey.published %}
|
|
<span class="survey-badge {{ survey.isActive ? 'success' : 'warning' }}">{{ survey.isActive ? 'survey.list.active'|trans : 'survey.list.inactive'|trans }}</span>
|
|
{% elseif survey.isLocked %}
|
|
<span class="survey-badge warning">{{ 'survey.list.locked'|trans }}</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="survey-meta survey-list-card__stats">
|
|
<span class="survey-badge neutral">{{ 'survey.list.questions'|trans({'%count%': survey.questionCount}) }}</span>
|
|
<span class="survey-badge neutral">{{ 'survey.list.participations'|trans({'%count%': survey.participationCount}) }}</span>
|
|
</div>
|
|
<div class="survey-button-row survey-list-card__actions">
|
|
{% if survey.editUrl %}
|
|
<a class="survey-button primary" href="{{ survey.editUrl }}">{{ 'survey.list.edit'|trans }}</a>
|
|
{% endif %}
|
|
{% if survey.publicUrl and survey.published and survey.isActive %}
|
|
<a class="survey-button secondary" href="{{ survey.publicUrl }}" target="_blank" rel="noreferrer">{{ 'survey.list.public_view'|trans }}</a>
|
|
{% elseif survey.publicUrl %}
|
|
<span class="survey-button secondary is-disabled" aria-disabled="true">{{ 'survey.list.public_view'|trans }}</span>
|
|
{% endif %}
|
|
{% if survey.draftUrl and not survey.published %}
|
|
<a class="survey-button secondary" href="{{ survey.draftUrl }}" target="_blank" rel="noreferrer">{{ 'survey.list.draft_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 %}
|
|
<form method="post" class="survey-question-action-form">
|
|
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
|
<input type="hidden" name="_survey_action" value="delete-survey">
|
|
<input type="hidden" name="item_id" value="{{ survey.id }}">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('delete-survey-' ~ survey.id) }}">
|
|
<button class="survey-button danger" onclick="return confirm('{{ 'survey.list.delete_confirm'|trans|e('js') }}') && confirm('{{ 'survey.list.delete_confirm_second'|trans|e('js') }}');">{{ 'survey.list.delete'|trans }}</button>
|
|
</form>
|
|
</div>
|
|
</article>
|
|
{% else %}
|
|
<div class="survey-card">{{ 'survey.list.empty'|trans }}</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</section> |