Only include <fieldset> if recipient category has content
This commit is contained in:
parent
b74de0f88d
commit
07e8b5e203
@ -158,6 +158,7 @@ commR CommunicationRoute{..} = do
|
|||||||
checkedIdentBase <- newIdent
|
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
|
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
|
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
|
categoryIndices c = Set.filter ((== c) . unEnumPosition . fst) $ review liveCoords liveliness
|
||||||
$(widgetFile "widgets/communication/recipientLayout")
|
$(widgetFile "widgets/communication/recipientLayout")
|
||||||
miDelete :: MapLiveliness (EnumLiveliness RecipientCategory) ListLength -> (EnumPosition RecipientCategory, ListPosition) -> MaybeT (MForm Handler) (Map (EnumPosition RecipientCategory, ListPosition) (EnumPosition RecipientCategory, ListPosition))
|
miDelete :: MapLiveliness (EnumLiveliness RecipientCategory) ListLength -> (EnumPosition RecipientCategory, ListPosition) -> MaybeT (MForm Handler) (Map (EnumPosition RecipientCategory, ListPosition) (EnumPosition RecipientCategory, ListPosition))
|
||||||
|
|||||||
@ -5,10 +5,10 @@ $forall category <- activeCategories
|
|||||||
<label .recipient-category__label for=#{checkedIdent category}>
|
<label .recipient-category__label for=#{checkedIdent category}>
|
||||||
_{category}
|
_{category}
|
||||||
|
|
||||||
$# TODO: only add fieldset if there are options to choose from
|
$if hasContent category
|
||||||
<fieldset .recipient-category__fieldset uw-interactive-fieldset .interactive-fieldset__target data-conditional-input=#{checkedIdent category}>
|
<fieldset .recipient-category__fieldset uw-interactive-fieldset .interactive-fieldset__target data-conditional-input=#{checkedIdent category}>
|
||||||
$forall optIx <- categoryIndices category
|
$forall optIx <- categoryIndices category
|
||||||
^{cellWdgts ! optIx}
|
^{cellWdgts ! optIx}
|
||||||
|
|
||||||
$maybe addWdgt <- addWdgts !? (1, (EnumPosition category, 0))
|
$maybe addWdgt <- addWdgts !? (1, (EnumPosition category, 0))
|
||||||
^{addWdgt}
|
^{addWdgt}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user