fix download links for multipart pics

This commit is contained in:
Rhiannon Morris 2021-02-09 12:50:22 +01:00
parent 7488b6cbce
commit 9c11993f7e

View file

@ -191,19 +191,22 @@ makeButtonBar title images =
where alts = map (\(i, (im, sz)) -> altButton i im sz) $ zip [0..] images
altButton :: Int -> Image -> Size -> Builder
altButton i (Image {label, path, nsfw, warning}) (Size {width, height}) = [b|@0
altButton i img size = [b|@0
<li$nsfwClass>
<input type=radio$checked name=variant id="$idLabel" value="$path'"
data-link="$path"$warning'
data-link="$link"$warning'
data-width=$width data-height=$height>
<label for="$idLabel"$nsfwLabelClass>$label</label>
|]
where
Image {label, path, nsfw, warning, download} = img
Size {width, height} = size
nsfwClass = if nsfw then [b| class=nsfw|] else ""
nsfwLabelClass = if nsfw then [b| class=nsfw-label|] else ""
checked = if i == 0 then [b| checked|] else ""
idLabel = escId label
path' = pageFile path
link = fromMaybe path download
warning' = ifJust warning \(escAttr -> w) -> [b| data-warning="$w"|]
makeTags :: FilePath -> [Strict.Text] -> Builder