Merge branch '328-formular-zum-kontakt-mit-kursteilnehmern' of gitlab.cip.ifi.lmu.de:jost/UniWorX into 328-formular-zum-kontakt-mit-kursteilnehmern
This commit is contained in:
commit
28486657ea
@ -739,7 +739,7 @@ NavigationFavourites: Favoriten
|
|||||||
|
|
||||||
CommSubject: Betreff
|
CommSubject: Betreff
|
||||||
CommRecipients: Empfänger
|
CommRecipients: Empfänger
|
||||||
CommDuplicateRecipients recipients@TextList: #{pluralDE (length recipients) "Doppelter" "Doppelte"} Empfänger: #{intercalate ", " recipients}
|
CommDuplicateRecipients n@Int: #{tshow n} #{pluralDE n "doppelter" "doppelte"} Empfänger ignoriert
|
||||||
CommSuccess n@Int: Nachricht wurde an #{tshow n} Empfänger versandt
|
CommSuccess n@Int: Nachricht wurde an #{tshow n} Empfänger versandt
|
||||||
|
|
||||||
CommCourseHeading: Kursmitteilung
|
CommCourseHeading: Kursmitteilung
|
||||||
|
|||||||
@ -80,31 +80,35 @@ commR CommunicationRoute{..} = do
|
|||||||
[ pure ( AddRecipientGroups
|
[ pure ( AddRecipientGroups
|
||||||
, Set.unions <$> apreq (multiSelectField . return $ mkOptionList
|
, Set.unions <$> apreq (multiSelectField . return $ mkOptionList
|
||||||
[ Option (mr g) (Set.fromList $ map (Right . entityKey . snd) recs) (toPathPiece g) | (g,recs) <- Map.toList suggestedRecipients ]
|
[ Option (mr g) (Set.fromList $ map (Right . entityKey . snd) recs) (toPathPiece g) | (g,recs) <- Map.toList suggestedRecipients ]
|
||||||
) ("" & addName (nudge . toPathPiece $ AddRecipientGroups)) Nothing
|
) (fslI AddRecipientGroups & addName (nudge . toPathPiece $ AddRecipientGroups)) Nothing
|
||||||
)
|
)
|
||||||
, do
|
, do
|
||||||
(g,recs) <- Map.toList suggestedRecipients
|
(g,recs) <- Map.toList suggestedRecipients
|
||||||
return ( AddRecipientGroup g
|
return ( AddRecipientGroup g
|
||||||
, Set.unions <$> apreq (multiSelectField . return $ mkOptionList
|
, Set.unions <$> apreq (multiSelectField . return $ mkOptionList
|
||||||
[ Option userDisplayName (Set.singleton $ Right rid) (toPathPiece cid) | (cid, Entity rid User{..}) <- recs ]
|
[ Option userDisplayName (Set.singleton $ Right rid) (toPathPiece cid) | (cid, Entity rid User{..}) <- recs ]
|
||||||
) ("" & addName (nudge . toPathPiece $ AddRecipientGroup g)) Nothing
|
) (fslI (AddRecipientGroup g) & addName (nudge . toPathPiece $ AddRecipientGroup g)) Nothing
|
||||||
)
|
)
|
||||||
, pure ( AddRecipientCustom
|
, pure ( AddRecipientCustom
|
||||||
, Set.fromList . map (Left . CI.mk) <$> apreq multiEmailField ("" & addName (nudge $ toPathPiece AddRecipientCustom)) Nothing )
|
, Set.fromList . map (Left . CI.mk) <$> apreq multiEmailField (fslI AddRecipientCustom & addName (nudge $ toPathPiece AddRecipientCustom)) Nothing )
|
||||||
]
|
]
|
||||||
(addRes, addWdgt) <- multiActionM addOptions ("" & addName (nudge "select")) Nothing csrf
|
(addRes, addWdgt) <- multiActionM addOptions ("foobar" & addName (nudge "select")) Nothing csrf
|
||||||
-- lookupUserDisplayName :: UserId -> UserDisplayName
|
-- lookupUserDisplayName :: UserId -> UserDisplayName
|
||||||
lookupUserDisplayName <- liftHandlerT . runDB $ do
|
-- lookupUserDisplayName <- liftHandlerT . runDB $ do
|
||||||
let uids = toListOf (_FormSuccess . folded . _Right) addRes
|
-- let uids = toListOf (_FormSuccess . folded . _Right) addRes
|
||||||
names <- forM uids getJustEntity
|
-- names <- forM uids getJustEntity
|
||||||
return $ \uid -> case filter ((== uid) . entityKey) names of
|
-- return $ \uid -> case filter ((== uid) . entityKey) names of
|
||||||
[Entity _ User{..}] -> userDisplayName
|
-- [Entity _ User{..}] -> userDisplayName
|
||||||
_other -> error "UserId lookpup failed"
|
-- _other -> error "UserId lookpup failed"
|
||||||
let addRes' = addRes <&> \newSet oldMap -> if
|
let addRes' = addRes <&> \newSet oldMap ->
|
||||||
| collisions <- newSet `Set.intersection` Set.fromList (Map.elems oldMap)
|
-- if
|
||||||
, not $ Set.null collisions ->
|
-- | collisions <- newSet `Set.intersection` Set.fromList (Map.elems oldMap)
|
||||||
FormFailure [ mr . MsgCommDuplicateRecipients . map (either CI.original lookupUserDisplayName) $ Set.toList collisions ]
|
-- , not $ Set.null collisions ->
|
||||||
| otherwise -> FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList newSet
|
-- -- FormFailure [ mr . MsgCommDuplicateRecipients . map (either CI.original lookupUserDisplayName) $ Set.toList collisions ]
|
||||||
|
-- FormFailure [ mr . MsgCommDuplicateRecipients $ Set.size collisions ]
|
||||||
|
-- | otherwise -> FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList newSet
|
||||||
|
let freshSet = newSet `Set.difference` Set.fromList (Map.elems oldMap)
|
||||||
|
in FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList freshSet
|
||||||
|
|
||||||
addWdgt' = mconcat [ toWidget csrf, addWdgt, fvInput submitView ]
|
addWdgt' = mconcat [ toWidget csrf, addWdgt, fvInput submitView ]
|
||||||
return (addRes', addWdgt')
|
return (addRes', addWdgt')
|
||||||
|
|||||||
@ -135,7 +135,7 @@
|
|||||||
|
|
||||||
if (tableFilterForm) {
|
if (tableFilterForm) {
|
||||||
gatherTableFilterInputs(tableFilterForm);
|
gatherTableFilterInputs(tableFilterForm);
|
||||||
addTableFilterEventListeners();
|
addTableFilterEventListeners(tableFilterForm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTableFilterEventListeners() {
|
function addTableFilterEventListeners(tableFilterForm) {
|
||||||
tableFilterInputs.search.forEach(function(input) {
|
tableFilterInputs.search.forEach(function(input) {
|
||||||
var debouncedInput = debounce(function() {
|
var debouncedInput = debounce(function() {
|
||||||
if (input.value.length === 0 || input.value.length > 2) {
|
if (input.value.length === 0 || input.value.length > 2) {
|
||||||
@ -188,7 +188,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
element.addEventListener('submit', function(event) {
|
tableFilterForm.addEventListener('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
updateFromTableFilter();
|
updateFromTableFilter();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user