diff --git a/src/Handler/Utils/Communication.hs b/src/Handler/Utils/Communication.hs index 1ccf45abc..d0ebfb186 100644 --- a/src/Handler/Utils/Communication.hs +++ b/src/Handler/Utils/Communication.hs @@ -158,6 +158,7 @@ commR CommunicationRoute{..} = do checkedIdentBase <- newIdent let checkedCategories = Set.mapMonotonic (unEnumPosition . fst) . Set.filter (\k' -> Map.foldrWithKey (\k (_, checkState) -> (||) $ k == k' && checkState /= FormSuccess False && (checkState /= FormMissing || maybe True snd (chosenRecipients' !? k))) False state) $ Map.keysSet state checkedIdent c = checkedIdentBase <> "-" <> toPathPiece c + hasContent c = not (null $ categoryIndices c) || Map.member (1, (EnumPosition c, 0)) addWdgts categoryIndices c = Set.filter ((== c) . unEnumPosition . fst) $ review liveCoords liveliness $(widgetFile "widgets/communication/recipientLayout") miDelete :: MapLiveliness (EnumLiveliness RecipientCategory) ListLength -> (EnumPosition RecipientCategory, ListPosition) -> MaybeT (MForm Handler) (Map (EnumPosition RecipientCategory, ListPosition) (EnumPosition RecipientCategory, ListPosition)) diff --git a/static/js/utils/form.js b/static/js/utils/form.js index 367d4dba1..a68f56b9f 100644 --- a/static/js/utils/form.js +++ b/static/js/utils/form.js @@ -146,7 +146,7 @@ var INTERACTIVE_FIELDSET_UTIL_NAME = 'interactiveFieldset'; var INTERACTIVE_FIELDSET_UTIL_SELECTOR = '[uw-interactive-fieldset]'; - var INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR = '.interactive-fieldset--target'; + var INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR = '.interactive-fieldset__target'; var INTERACTIVE_FIELDSET_INITIALIZED_CLASS = 'interactive-fieldset--initialized'; var INTERACTIVE_FIELDSET_CHILD_SELECTOR = 'input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])'; @@ -182,15 +182,10 @@ } conditionalValue = element.dataset.conditionalValue; - if (element.matches(INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR)) { + target = element.closest(INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR); + if (!target || element.matches(INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR)) { target = element; } - if (!target) { - target = element.closest(INTERACTIVE_FIELDSET_UTIL_TARGET_SELECTOR); - } - if (!target) { - throw new Error('Interactive Fieldset needs to be a target or have a target-ancestor!'); - } childInputs = Array.from(element.querySelectorAll(INTERACTIVE_FIELDSET_CHILD_SELECTOR)); @@ -216,7 +211,7 @@ function updateVisibility() { var active = matchesConditionalValue() && !conditionalInput.disabled; - + target.classList.toggle('hidden', !active); childInputs.forEach(function(el) { diff --git a/templates/widgets/aform/aform.hamlet b/templates/widgets/aform/aform.hamlet index 00f8755f2..460ca1ba7 100644 --- a/templates/widgets/aform/aform.hamlet +++ b/templates/widgets/aform/aform.hamlet @@ -11,7 +11,7 @@ $case formLayout

^{fvLabel view} $else -
+
$if not (Blaze.null $ fvLabel view)