Separate survey list controls from editor view
This commit is contained in:
@@ -311,29 +311,21 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.survey-list-card__toggle-form {
|
||||
flex-shrink: 0;
|
||||
align-self: flex-start;
|
||||
.survey-list-card__head-actions {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-end;
|
||||
gap: 0.6rem;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.survey-publish-toggle--compact {
|
||||
min-height: 2.8rem;
|
||||
padding: 0.45rem 0.65rem 0.45rem 0.85rem;
|
||||
gap: 0.7rem;
|
||||
}
|
||||
|
||||
.survey-publish-toggle--compact .survey-publish-toggle__track {
|
||||
width: 3rem;
|
||||
height: 1.7rem;
|
||||
}
|
||||
|
||||
.survey-publish-toggle--compact .survey-publish-toggle__thumb {
|
||||
width: 1.4rem;
|
||||
height: 1.4rem;
|
||||
}
|
||||
|
||||
.survey-publish-toggle--compact.is-on .survey-publish-toggle__thumb {
|
||||
transform: translateX(1.25rem);
|
||||
.survey-list-card__stats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.85rem;
|
||||
color: var(--survey-gray-dark);
|
||||
font-weight: 600;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
|
||||
.survey-meta {
|
||||
@@ -343,21 +335,92 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.survey-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.25rem 0.65rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
background: rgba(162, 168, 180, 0.16);
|
||||
.survey-list-publish-form,
|
||||
.survey-list-eye-form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.survey-badge.success { background: rgba(0, 174, 151, 0.16); color: var(--survey-green); }
|
||||
.survey-badge.warning { background: rgba(236, 124, 50, 0.16); color: var(--survey-orange); }
|
||||
.survey-badge.neutral { background: rgba(162, 168, 180, 0.16); color: var(--survey-gray-dark); }
|
||||
.survey-list-publish-form {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.survey-list-publish-button[disabled] {
|
||||
opacity: 1;
|
||||
background: rgba(162, 168, 180, 0.4);
|
||||
border-color: rgba(162, 168, 180, 0.65);
|
||||
color: var(--survey-gray-dark);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.survey-list-publish-help {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: calc(100% + 0.35rem);
|
||||
width: 19rem;
|
||||
max-width: min(72vw, 19rem);
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(52, 58, 69, 0.94);
|
||||
color: #fff;
|
||||
padding: 0.5rem 0.65rem;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.3;
|
||||
box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-0.25rem);
|
||||
transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.survey-list-publish-form:hover .survey-list-publish-help,
|
||||
.survey-list-publish-form:focus-within .survey-list-publish-help {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.survey-visibility-eye {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(162, 168, 180, 0.62);
|
||||
background: rgba(162, 168, 180, 0.22);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: background 0.18s ease, border-color 0.18s ease;
|
||||
}
|
||||
|
||||
.survey-visibility-eye__icon {
|
||||
width: 1.25rem;
|
||||
height: 0.8rem;
|
||||
border: 2px solid currentColor;
|
||||
border-radius: 99px;
|
||||
position: relative;
|
||||
color: #7f8793;
|
||||
}
|
||||
|
||||
.survey-visibility-eye__icon::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 0.34rem;
|
||||
height: 0.34rem;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.survey-visibility-eye.is-on {
|
||||
background: rgba(0, 174, 151, 0.2);
|
||||
border-color: rgba(0, 174, 151, 0.68);
|
||||
}
|
||||
|
||||
.survey-visibility-eye.is-on .survey-visibility-eye__icon {
|
||||
color: #0a8378;
|
||||
}
|
||||
|
||||
.survey-button-row {
|
||||
display: flex;
|
||||
@@ -376,18 +439,6 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.survey-action-stack {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.survey-action-help {
|
||||
color: var(--survey-gray-dark);
|
||||
font-size: 0.92rem;
|
||||
line-height: 1.35;
|
||||
max-width: 28rem;
|
||||
}
|
||||
|
||||
.survey-publish-toggle-form {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -783,14 +834,16 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.survey-list-card__toggle-form {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
.survey-list-card__head-actions {
|
||||
margin-left: 0;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.survey-list-card__toggle-form .survey-publish-toggle {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
.survey-list-publish-help {
|
||||
left: 0;
|
||||
right: auto;
|
||||
width: min(92vw, 19rem);
|
||||
}
|
||||
|
||||
.survey-brand-strip {
|
||||
@@ -824,10 +877,6 @@
|
||||
padding: 0.95rem 1rem;
|
||||
}
|
||||
|
||||
.survey-publish-toggle:not(.survey-publish-toggle--compact) {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
@@ -48,27 +48,6 @@
|
||||
{% else %}
|
||||
<div class="survey-button-row survey-button-row--editor-actions">
|
||||
{% if backUrl %}<a class="survey-button secondary" href="{{ backUrl }}">{{ 'survey.edit.back_to_list'|trans }}</a>{% endif %}
|
||||
<div class="survey-action-stack">
|
||||
{% if not survey.published %}
|
||||
<form method="post" class="survey-action-form">
|
||||
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
||||
<input type="hidden" name="_survey_action" value="publish-survey">
|
||||
<input type="hidden" name="item_id" value="{{ survey.id }}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('publish-survey-' ~ survey.id) }}">
|
||||
<button class="survey-button primary" onclick="return confirm('{{ 'survey.edit.publish_confirm'|trans|e('js') }}');">{{ 'survey.edit.publish_survey'|trans }}</button>
|
||||
</form>
|
||||
<div class="survey-action-help">{{ 'survey.edit.publish_help'|trans }}</div>
|
||||
{% else %}
|
||||
<form method="post" class="survey-action-form">
|
||||
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
||||
<input type="hidden" name="_survey_action" value="toggle-active">
|
||||
<input type="hidden" name="item_id" value="{{ survey.id }}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('toggle-active-' ~ survey.id) }}">
|
||||
<button class="survey-button secondary">{{ survey.isActive ? 'survey.edit.deactivate_survey'|trans : 'survey.edit.activate_survey'|trans }}</button>
|
||||
</form>
|
||||
<div class="survey-action-help">{{ survey.isActive ? 'survey.edit.deactivate_help'|trans : 'survey.edit.activate_help'|trans }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if structureLocked|default(false) %}
|
||||
@@ -81,37 +60,6 @@
|
||||
<div class="survey-grid-columns survey-editor-layout">
|
||||
<div class="survey-question-editor-shell" data-survey-question-editor>
|
||||
<div class="survey-accordion-list handorgel" data-survey-handorgel>
|
||||
<article id="survey-metadata" class="survey-accordion-item">
|
||||
<h4 class="survey-accordion-header handorgel__header">
|
||||
<button
|
||||
type="button"
|
||||
class="survey-accordion-toggle handorgel__header__button"
|
||||
>
|
||||
<span class="survey-accordion-heading">
|
||||
<span class="survey-accordion-copy">
|
||||
<strong>Metadaten bearbeiten</strong>
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</h4>
|
||||
<div class="survey-accordion-panel handorgel__content">
|
||||
<div class="handorgel__content__inner">
|
||||
{{ form_start(surveyForm, {action: metadataFormActionUrl, attr: {class: 'survey-form-grid', id: surveyMetaFormId, 'data-survey-dirty-form': '1'}}) }}
|
||||
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
||||
<input type="hidden" name="{{ surveyForm.published.vars.full_name }}" value="{{ survey.published ? '1' : '0' }}">
|
||||
{{ form_widget(surveyForm._token) }}
|
||||
{{ form_errors(surveyForm) }}
|
||||
<label class="survey-label">{{ 'survey.edit.label_survey_title'|trans }}{{ form_widget(surveyForm.title) }}{{ form_errors(surveyForm.title) }}</label>
|
||||
<label class="survey-label">{{ 'survey.edit.label_description'|trans }}{{ form_widget(surveyForm.description) }}</label>
|
||||
<div class="survey-button-row survey-button-row--form-actions">
|
||||
<button class="survey-button primary">{{ 'survey.edit.save_metadata'|trans }}</button>
|
||||
<div class="survey-dirty-hint" data-survey-dirty-hint-for="{{ surveyMetaFormId }}" hidden>{{ 'survey.edit.dirty_metadata'|trans }}</div>
|
||||
</div>
|
||||
{{ form_end(surveyForm, {render_rest: false}) }}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{% for question in questions %}
|
||||
{% set questionAnchor = 'survey-question-' ~ question.id %}
|
||||
{% set isOpen = activeQuestionId == question.id %}
|
||||
|
||||
@@ -35,28 +35,51 @@
|
||||
<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>
|
||||
</div>
|
||||
<div class="survey-list-card__head-actions">
|
||||
<form method="post" class="survey-list-publish-form">
|
||||
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
||||
<input type="hidden" name="_survey_action" value="publish-survey">
|
||||
<input type="hidden" name="item_id" value="{{ survey.id }}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('publish-survey-' ~ survey.id) }}">
|
||||
<button
|
||||
type="submit"
|
||||
class="survey-button primary survey-list-publish-button"
|
||||
{% if survey.published %}disabled{% endif %}
|
||||
{% if not survey.published %}onclick="return confirm('{{ 'survey.edit.publish_confirm'|trans|e('js') }}');"{% endif %}
|
||||
>
|
||||
{{ survey.published ? 'survey.list.publish_done'|trans : 'survey.list.publish'|trans }}
|
||||
</button>
|
||||
{% if not survey.published %}
|
||||
<span class="survey-list-publish-help">{{ 'survey.list.publish_help'|trans }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="post" class="survey-list-eye-form">
|
||||
<input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
|
||||
<input type="hidden" name="_survey_action" value="toggle-active">
|
||||
<input type="hidden" name="item_id" value="{{ survey.id }}">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('toggle-active-' ~ survey.id) }}">
|
||||
<button type="submit" class="survey-visibility-eye{{ survey.isActive ? ' is-on' : '' }}" title="{{ survey.isActive ? 'survey.edit.deactivate_survey'|trans : 'survey.edit.activate_survey'|trans }}" aria-label="{{ survey.isActive ? 'survey.edit.deactivate_survey'|trans : 'survey.edit.activate_survey'|trans }}">
|
||||
<span class="survey-visibility-eye__icon" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
</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 class="survey-list-card__stats">
|
||||
<span>{{ 'survey.list.questions'|trans({'%count%': survey.questionCount}) }}</span>
|
||||
<span>{{ '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>
|
||||
{% if survey.published %}
|
||||
<span class="survey-button primary is-disabled" aria-disabled="true">{{ 'survey.list.edit'|trans }}</span>
|
||||
{% else %}
|
||||
<a class="survey-button primary" href="{{ survey.editUrl }}">{{ 'survey.list.edit'|trans }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if survey.publicUrl and survey.published and survey.isActive %}
|
||||
{% if survey.publicUrl and survey.published %}
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user