diff --git a/contao/dca/tl_survey.php b/contao/dca/tl_survey.php index d99f4d7..c9869e1 100644 --- a/contao/dca/tl_survey.php +++ b/contao/dca/tl_survey.php @@ -54,11 +54,10 @@ $GLOBALS['TL_DCA']['tl_survey'] = [ 'href' => 'act=edit', 'icon' => 'header.svg', ], - 'publishSurvey' => [ - 'label' => &$GLOBALS['TL_LANG']['tl_survey']['publishSurvey'], - 'href' => 'act=toggle&field=published', - 'icon' => 'visible.svg', - 'button_callback' => [SurveyDcaListener::class, 'generatePublishSurveyButton'], + 'publishedWarning' => [ + 'label' => &$GLOBALS['TL_LANG']['tl_survey']['publishedWarning'], + 'icon' => 'important.svg', + 'button_callback' => [SurveyDcaListener::class, 'generatePublishedWarningButton'], ], 'toggleActive' => [ 'label' => &$GLOBALS['TL_LANG']['tl_survey']['toggleActive'], @@ -141,13 +140,11 @@ $GLOBALS['TL_DCA']['tl_survey'] = [ 'label' => &$GLOBALS['TL_LANG']['tl_survey']['published'], 'inputType' => 'checkbox', 'eval' => ['tl_class' => 'w50 m12'], - 'save_callback' => [[SurveyDcaListener::class, 'savePublishedState']], 'sql' => "char(1) NOT NULL default ''", ], 'isActive' => [ 'label' => &$GLOBALS['TL_LANG']['tl_survey']['isActive'], 'inputType' => 'checkbox', - 'save_callback' => [[SurveyDcaListener::class, 'saveActiveState']], 'sql' => "char(1) NOT NULL default ''", ], 'isTemplate' => [ diff --git a/contao/dca/tl_survey_condition.php b/contao/dca/tl_survey_condition.php index 549e539..2f74c1f 100644 --- a/contao/dca/tl_survey_condition.php +++ b/contao/dca/tl_survey_condition.php @@ -12,9 +12,6 @@ $GLOBALS['TL_DCA']['tl_survey_condition'] = [ 'dataContainer' => DC_Table::class, 'ptable' => 'tl_survey', 'enableVersioning' => true, - 'onload_callback' => [ - [SurveyDcaListener::class, 'restrictSurveyConditionEditing'], - ], 'onsubmit_callback' => [ [SurveyDcaListener::class, 'touchSurveyConditionParent'], ], diff --git a/contao/dca/tl_survey_content.php b/contao/dca/tl_survey_content.php index 59e737e..5356d4d 100644 --- a/contao/dca/tl_survey_content.php +++ b/contao/dca/tl_survey_content.php @@ -12,9 +12,6 @@ $GLOBALS['TL_DCA']['tl_survey_content'] = [ 'dataContainer' => DC_Table::class, 'ptable' => 'tl_survey', 'enableVersioning' => true, - 'onload_callback' => [ - [SurveyDcaListener::class, 'restrictSurveyContentEditing'], - ], 'onsubmit_callback' => [ [SurveyDcaListener::class, 'touchSurveyContentParent'], ], diff --git a/contao/languages/de/tl_survey.php b/contao/languages/de/tl_survey.php index 8fd7e81..92f51f5 100644 --- a/contao/languages/de/tl_survey.php +++ b/contao/languages/de/tl_survey.php @@ -19,6 +19,7 @@ $GLOBALS['TL_LANG']['tl_survey']['published'] = ['Veröffentlicht', 'Die Umfrage $GLOBALS['TL_LANG']['tl_survey']['isActive'] = ['Vorübergehend aktiv', 'Schaltet eine bereits veröffentlichte Umfrage öffentlich an oder aus.']; $GLOBALS['TL_LANG']['tl_survey']['isLocked'] = ['Gesperrt', 'Struktur ist wegen vorhandener Antworten gesperrt.']; $GLOBALS['TL_LANG']['tl_survey']['publishSurvey'] = ['Umfrage veröffentlichen', 'Veröffentlicht die Umfrage endgültig.']; +$GLOBALS['TL_LANG']['tl_survey']['publishedWarning'] = ['Veröffentlichungshinweis', 'Zeigt einen Warnhinweis bei veröffentlichten Umfragen.']; $GLOBALS['TL_LANG']['tl_survey']['toggleActive'] = ['Sichtbarkeit umschalten', 'Schaltet die veröffentlichte Umfrage vorübergehend an oder aus.']; $GLOBALS['TL_LANG']['tl_survey']['assignedMembers'] = ['Zugewiesene Mitglieder', 'Wählen Sie die Mitglieder aus, die diese Umfrage bearbeiten dürfen.']; $GLOBALS['TL_LANG']['tl_survey']['assignedMembersFilter'] = ['Zugewiesene Benutzer', 'Filtert die Liste nach einem zugewiesenen Benutzer.']; diff --git a/contao/languages/en/tl_survey.php b/contao/languages/en/tl_survey.php index 5b62b64..7bf1b17 100644 --- a/contao/languages/en/tl_survey.php +++ b/contao/languages/en/tl_survey.php @@ -19,6 +19,7 @@ $GLOBALS['TL_LANG']['tl_survey']['published'] = ['Published', 'Make the survey p $GLOBALS['TL_LANG']['tl_survey']['isActive'] = ['Temporarily active', 'Turns an already published survey on or off publicly.']; $GLOBALS['TL_LANG']['tl_survey']['isLocked'] = ['Locked', 'Structure is locked because answers already exist.']; $GLOBALS['TL_LANG']['tl_survey']['publishSurvey'] = ['Publish survey', 'Publishes the survey permanently.']; +$GLOBALS['TL_LANG']['tl_survey']['publishedWarning'] = ['Publication warning', 'Shows a warning hint for already published surveys.']; $GLOBALS['TL_LANG']['tl_survey']['toggleActive'] = ['Toggle visibility', 'Temporarily switches the published survey on or off.']; $GLOBALS['TL_LANG']['tl_survey']['assignedMembers'] = ['Assigned members', 'Choose the members who are allowed to edit this survey.']; $GLOBALS['TL_LANG']['tl_survey']['assignedMembersFilter'] = ['Assigned users', 'Filters the list by an assigned user.']; diff --git a/contao/templates/frontend/_survey_assets.html.twig b/contao/templates/frontend/_survey_assets.html.twig index ffd3cfa..4267275 100644 --- a/contao/templates/frontend/_survey_assets.html.twig +++ b/contao/templates/frontend/_survey_assets.html.twig @@ -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; - } }