add show-updated field
(if false, never show updated emblem in gallery view)
This commit is contained in:
parent
8d4ff29e56
commit
71c1458de3
1 changed files with 23 additions and 19 deletions
|
@ -36,11 +36,13 @@ import System.FilePath ((</>), takeBaseName, takeExtension, splitExtension)
|
|||
data Info =
|
||||
Info {
|
||||
date :: !Date,
|
||||
-- extra sort key after date
|
||||
-- | extra sort key after date
|
||||
-- e.g. multiple things on the same day might have a,b,c in @sortEx@ to
|
||||
-- put them in the right order in the gallery
|
||||
sortEx :: !Text,
|
||||
updates :: !(Map Date Text),
|
||||
-- | if false, don't show updated emblem even if @updates@ is non-empty
|
||||
showUpdated :: !Bool,
|
||||
title :: !Text,
|
||||
artist :: !(Maybe Artist), -- nothing = me, obv
|
||||
nsfwOnly :: !Bool,
|
||||
|
@ -111,7 +113,8 @@ instance HasField "latestYear" Info Int where
|
|||
getField = #year . #latestDate
|
||||
|
||||
|
||||
instance HasField "updated" Info Bool where getField = not . Map.null . #updates
|
||||
instance HasField "updated" Info Bool where
|
||||
getField (Info {updates, showUpdated}) = showUpdated && not (Map.null updates)
|
||||
|
||||
descFor :: Bool -> Info -> Maybe Text
|
||||
descFor nsfw (Info {desc, nsfwDesc}) = desc <> (guard nsfw *> nsfwDesc)
|
||||
|
@ -156,6 +159,7 @@ instance FromYAML Info where
|
|||
Info <$> m .: "date"
|
||||
<*> m .:? "sort" .!= ""
|
||||
<*> m .:? "updates" .!= []
|
||||
<*> m .:? "show-updated" .!= True
|
||||
<*> m .: "title"
|
||||
<*> m .:? "artist"
|
||||
<*> m .:? "nsfw-only" .!= False
|
||||
|
|
Loading…
Reference in a new issue