sheet list icons cleaned

This commit is contained in:
Steffen Jost 2019-05-15 14:16:21 +02:00
parent 7cda3e9f2e
commit e712552397
4 changed files with 35 additions and 18 deletions

View File

@ -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)

View File

@ -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
<i .fas .fa-#{iconName}>|]
-- We collect all used icons here for an overview.
-- For consistency, some conditional icons are also provided, e.g. `isIvisble`
iconQuestion :: Markup
iconQuestion = [shamlet|<i .fas .fa-question-circle>|]
iconQuestion = fontAwesomeIcon "question-circle"
iconHint :: Markup
iconHint = [shamlet|<i .fas .fa-life-ring>|]
iconHint = fontAwesomeIcon "life-ring"
iconSolution :: Markup
iconSolution = [shamlet|<i .fas .fa-exclamation-circle>|]
iconSolution =fontAwesomeIcon "exclamation-circle"
iconMarking :: Markup
iconMarking = [shamlet|<i .fas .fa-check-circle>|]
iconMarking = fontAwesomeIcon "check-circle"
fileDownload :: Markup
fileDownload = [shamlet|<i .fas .fa-file-download>|]
fileDownload = fontAwesomeIcon "file-download"
zipDownload :: Markup
zipDownload = [shamlet|<i .fas .fa-file-archive>|]
zipDownload = fontAwesomeIcon "file-archive"
-- Conditional icons
isVisible :: Bool -> Markup
-- ^ Display an icon that denotes that something™ is visible or invisible
isVisible True = [shamlet|<i .fas .fa-eye>|]
isVisible False = [shamlet|<i .fas .fa-eye-slash>|]
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|<i .fas .fa-comment-alt>|]
hasComment False = [shamlet|<i .fas .fa-comment-slash>|] -- 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|<i .fas .fa-check>|]
hasTickmark True = fontAwesomeIcon "check"
hasTickmark False = mempty
isBad :: Bool -> Markup
-- ^ Display an icon that denotes that something™ is bad
isBad True = [shamlet|<i .fas .fa-bolt>|] -- or times?!
isBad True = fontAwesomeIcon "bolt" -- or times?!
isBad False = mempty
isNew :: Bool -> Markup
isNew True = [shamlet|<i .fas .fa-seedling>|] -- was exclamation
isNew True = fontAwesomeIcon "seedling" -- was exclamation
isNew False = mempty
boolSymbol :: Bool -> Markup
boolSymbol True = [shamlet|<i .fas .fa-check>|]
boolSymbol False = [shamlet|<i .fas .fa-times>|]
boolSymbol True = fontAwesomeIcon "check"
boolSymbol False = fontAwesomeIcon "times"

View File

@ -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;

View File

@ -1,3 +1,3 @@
$newline never
<a href=@{route}>
^{widget}
^{widget}