diff --git a/src/Frontend/Fragment/DelegationTab.hs b/src/Frontend/Fragment/DelegationTab.hs index dc2b4a76..9bc640d8 100644 --- a/src/Frontend/Fragment/DelegationTab.hs +++ b/src/Frontend/Fragment/DelegationTab.hs @@ -18,9 +18,13 @@ import qualified Frontend.Path as U renderDelegations :: forall m. Monad m => Bool -> DelegationListsMap -> HtmlT m () -renderDelegations showScope delegations = do - ul_ [class_ "small-avatar-list"] $ renderLi `mapM_` sortBy orddeleg (flatten delegations) +renderDelegations showScope delegations = + ul_ [class_ "small-avatar-list"] $ do + forM_ ds renderLi + when (null ds) $ p_ [class_ "container-not-found"] "Keine Beauftragung" where + ds = sortBy orddeleg (flatten delegations) + flatten :: DelegationListsMap -> [(DScopeFull, (User, [User]))] flatten (DelegationListsMap xs) = concat $ f <$> xs where f (dscope, DelegateeLists lists) = (dscope,) <$> lists diff --git a/src/Frontend/Fragment/IdeaList.hs b/src/Frontend/Fragment/IdeaList.hs index 6533f57c..89a375ea 100644 --- a/src/Frontend/Fragment/IdeaList.hs +++ b/src/Frontend/Fragment/IdeaList.hs @@ -104,17 +104,15 @@ instance ToHtml ListItemIdea where instance ToHtml ListItemIdeas where toHtmlRaw = toHtml - toHtml p@(ListItemIdeas _ctx whatPage ideasQuery []) = semanticDiv p $ do + toHtml p@(ListItemIdeas ctx whatPage ideasQuery ideasAndNumVoters) = semanticDiv p $ do ideaListHeader whatPage ideasQuery - div_ [class_ "container-not-found"] . toHtml $ "Keine Ideen" <> mCatInfo <> "." + for_ ideasAndNumVoters $ toHtml . ListItemIdea ctx whatPage + when (null ideasAndNumVoters) $ + div_ [class_ "container-not-found"] . toHtml $ "Keine Ideen" <> mCatInfo <> "." where mCatInfo = ideasQuery ^. ideasQueryF . _IdeasWithCat . uilabeledST . to (" in der Kategorie " <>) - toHtml p@(ListItemIdeas ctx whatPage ideasQuery ideasAndNumVoters) = semanticDiv p $ do - ideaListHeader whatPage ideasQuery - for_ ideasAndNumVoters $ toHtml . ListItemIdea ctx whatPage - ideaListHeader :: Monad m => WhatListPage -> IdeasQuery -> HtmlT m () ideaListHeader whatListPage ideasQuery = do diff --git a/src/Frontend/Page/Overview.hs b/src/Frontend/Page/Overview.hs index b8546428..080ae023 100644 --- a/src/Frontend/Page/Overview.hs +++ b/src/Frontend/Page/Overview.hs @@ -73,7 +73,7 @@ instance ToHtml PageOverviewOfSpaces where toHtml p@(PageOverviewOfSpaces spaces) = semanticDiv' [class_ "container-main grid-view"] p $ f spaces where f :: forall m. (Monad m) => [IdeaSpace] -> HtmlT m () - f [] = p_ "Keine Ideenräume" + f [] = p_ [class_ "container-not-found"] "Keine Ideenräume" f rs@(_:_) = forM_ rs g g :: forall m. (Monad m) => IdeaSpace -> HtmlT m () @@ -123,6 +123,7 @@ instance ToHtml PageOverviewOfTopics where when (CanCreateTopic `elem` capabilities ctx) $ button_ [onclick_ (U.createTopic space), class_ "btn-cta m-large"] "+ Neues Thema" + when (null topics) $ p_ [class_ "container-not-found"] "Keine Thema." forM_ topics $ \topic -> do div_ [class_ "col-1-3 theme-grid-col"] $ do div_ [class_ ("theme-grid-item phase-" <> cs (show (topic ^. topicPhase)))] $ do diff --git a/src/Frontend/Page/User.hs b/src/Frontend/Page/User.hs index 87b3e516..45073a08 100644 --- a/src/Frontend/Page/User.hs +++ b/src/Frontend/Page/User.hs @@ -246,7 +246,10 @@ delegationButtons delegatee delegate delegations = do `elem` delegations but = postButton_ [class_ "btn-cta heroic-cta", jsReloadOnClick] - forM_ (commonSchoolClasses delegatee delegate) $ \clss -> do + classes = commonSchoolClasses delegatee delegate + when (null classes) $ + p_ [class_ "container-not-found"] "No class in common" -- TODO english + forM_ classes $ \clss -> do if isActiveDelegation (DScopeIdeaSpace (ClassSpace clss)) then do but (U.withdrawDelegationOnClassSpace delegate clss)