diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 0a3b8c3fe..754d27a95 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -194,7 +194,7 @@ getSheetListR tid ssh csh = do , sortable (Just "visible-from") (i18nCell MsgAccessibleSince) $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _, _)} -> foldMap (dateTimeCellVisible now) sheetVisibleFrom , sortable (toNothing "downloads") (i18nCell MsgFiles) - $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _, existFiles)} -> mconcat + $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _, existFiles)} -> listCell [ icnCell & addIconFixedWidth | let existingSFTs = hasSFT existFiles , sft <- [minBound..maxBound] @@ -203,7 +203,7 @@ getSheetListR tid ssh csh = do , let icnCell = if sft `elem` existingSFTs then linkEmptyCell link icn else spacerCell - ] + ] id & cellAttrs <>~ [("class","list--inline list--space-separated")] , sortable (Just "submission-since") (i18nCell MsgSheetActiveFrom) $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _, _)} -> dateTimeCell sheetActiveFrom , sortable (Just "submission-until") (i18nCell MsgSheetActiveTo) diff --git a/src/Utils.hs b/src/Utils.hs index c45171ed5..1fb39b1b6 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -123,33 +123,39 @@ type WidgetSiteless = forall site. forall m. (MonadIO m, MonadThrow m, MonadBase -- Icons -- ----------- +-- Create an icon from font-awesome without additional space +fontAwesomeIcon :: Text -> Markup +fontAwesomeIcon iconName = + [shamlet|$newline never + |] + -- We collect all used icons here for an overview. -- For consistency, some conditional icons are also provided, e.g. `isIvisble` iconQuestion :: Markup -iconQuestion = [shamlet||] +iconQuestion = fontAwesomeIcon "question-circle" iconHint :: Markup -iconHint = [shamlet||] +iconHint = fontAwesomeIcon "life-ring" iconSolution :: Markup -iconSolution = [shamlet||] +iconSolution =fontAwesomeIcon "exclamation-circle" iconMarking :: Markup -iconMarking = [shamlet||] +iconMarking = fontAwesomeIcon "check-circle" fileDownload :: Markup -fileDownload = [shamlet||] +fileDownload = fontAwesomeIcon "file-download" zipDownload :: Markup -zipDownload = [shamlet||] +zipDownload = fontAwesomeIcon "file-archive" -- Conditional icons isVisible :: Bool -> Markup -- ^ Display an icon that denotes that something™ is visible or invisible -isVisible True = [shamlet||] -isVisible False = [shamlet||] +isVisible True = fontAwesomeIcon "eye" +isVisible False = fontAwesomeIcon "eye-slash" -- -- For documentation on how to avoid these unneccessary functions -- we implement them here just once for the first icon: @@ -165,26 +171,26 @@ maybeIsVisibleWidget = toWidget . foldMap isVisible -- Other _frequently_ used icons: hasComment :: Bool -> Markup -- ^ Display an icon that denotes that something™ has a comment or not -hasComment True = [shamlet||] -hasComment False = [shamlet||] -- comment-alt-slash is not available for free +hasComment True = fontAwesomeIcon "comment-alt" +hasComment False = fontAwesomeIcon "comment-slash" -- comment-alt-slash is not available for free hasTickmark :: Bool -> Markup -- ^ Display an icon that denotes that something™ is okay -hasTickmark True = [shamlet||] +hasTickmark True = fontAwesomeIcon "check" hasTickmark False = mempty isBad :: Bool -> Markup -- ^ Display an icon that denotes that something™ is bad -isBad True = [shamlet||] -- or times?! +isBad True = fontAwesomeIcon "bolt" -- or times?! isBad False = mempty isNew :: Bool -> Markup -isNew True = [shamlet||] -- was exclamation +isNew True = fontAwesomeIcon "seedling" -- was exclamation isNew False = mempty boolSymbol :: Bool -> Markup -boolSymbol True = [shamlet||] -boolSymbol False = [shamlet||] +boolSymbol True = fontAwesomeIcon "check" +boolSymbol False = fontAwesomeIcon "times" diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index 558ee6e0d..644ad3d11 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -465,6 +465,17 @@ ul.list--inline { } } +.list--space-separated li { + &::after { + content: ' '; + white-space: pre; + } + + &:last-of-type::after { + content: none; + } +} + /* DEFINITION LIST */ .deflist { display: grid; diff --git a/templates/table/cell/link.hamlet b/templates/table/cell/link.hamlet index 0ced27282..cdf41888f 100644 --- a/templates/table/cell/link.hamlet +++ b/templates/table/cell/link.hamlet @@ -1,3 +1,3 @@ $newline never - ^{widget} + ^{widget} \ No newline at end of file