Skip to content

Commit

Permalink
fixed zip download links
Browse files Browse the repository at this point in the history
  • Loading branch information
nevrome committed Feb 11, 2025
1 parent 3d369c6 commit d45c543
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/Poseidon/ServerHTML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ archivePage archiveName maybeArchiveSpecURL archiveZip mapMarkers pacs = do
-- archives with more info
case maybeArchiveSpecURL of
Just url -> H.td $ H.a ! A.href (H.stringValue url <> "/" <> H.toValue pacName) $ H.toMarkup ("GitHub" :: String)
Nothing -> return ()
OP.when archiveZip $
H.td $ H.a ! A.href ("/zip_file/" <> H.toValue pacName) $ H.toMarkup ("Download" :: String)
Nothing -> H.td $ H.string "n/a"
if archiveZip
then H.td $ H.a ! A.href ("/zip_file/" <> H.toValue pacName <> "?archive=" <> H.toValue archiveName) $ H.toMarkup ("Download" :: String)
else H.td $ H.string "n/a"

Check warning on line 245 in src/Poseidon/ServerHTML.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/ServerHTML.hs#L240-L245

Added lines #L240 - L245 were not covered by tests

packageVersionPage ::
String -> String -> Maybe Version
Expand Down Expand Up @@ -290,7 +291,7 @@ packageVersionPage
H.toMarkup $ renderMaybeVersion v
OP.when archiveZip $ do
H.toMarkup (" | " :: String)
H.a ! A.href ("/zip_file/" <> H.toValue pacName <> "?package_version=" <> H.toValue (renderMaybeVersion v)) $
H.a ! A.href ("/zip_file/" <> H.toValue pacName <> "?package_version=" <> H.toValue (renderMaybeVersion v) <> "&archive=" <> H.toValue archiveName) $
H.toMarkup ("Download" :: String)
H.details $ do
H.summary "Bibliography (in bibtex format)"
Expand All @@ -300,13 +301,11 @@ packageVersionPage
H.div ! A.style "float: right; text-align: right;" $ do
case pacVersion of
Nothing -> do
H.form ! A.action ("/zip_file/" <> H.toValue pacName) ! A.method "get" $ do
H.button ! A.type_ "submit" ! A.class_ "button" $
H.toMarkup ("Download" :: String)
Just v ->
H.form ! A.action ("/zip_file/" <> H.toValue pacName <> "?package_version=" <> H.toValue (showVersion v)) ! A.method "get" $ do
H.button ! A.type_ "submit" ! A.class_ "button" $
H.toMarkup ("Download" :: String)
H.a ! A.href ("/zip_file/" <> H.toValue pacName <> "?archive=" <> H.toValue archiveName) $
H.toMarkup ("Download" :: String)
Just v -> do
H.a ! A.href ("/zip_file/" <> H.toValue pacName <> "?package_version=" <> H.toValue (showVersion v) <> "&archive=" <> H.toValue archiveName) $
H.toMarkup ("Download" :: String)

Check warning on line 308 in src/Poseidon/ServerHTML.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/ServerHTML.hs#L300-L308

Added lines #L300 - L308 were not covered by tests
-- sample table
H.table $ do
H.tr $ do
Expand Down

0 comments on commit d45c543

Please sign in to comment.