mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-11 19:58:28 +01:00
Separate page for all snapshots of a package
This commit is contained in:
parent
af2552041c
commit
b498d0a041
@ -245,3 +245,32 @@ postPackageUntagR packageName =
|
||||
,TagTag ==. slug
|
||||
,TagVoter ==. uid]))
|
||||
Nothing -> error "Need a slug"
|
||||
|
||||
getPackageSnapshotsR :: PackageName -> Handler Html
|
||||
getPackageSnapshotsR pn =
|
||||
do let haddocksLink ident version =
|
||||
HaddockR ident [concat [toPathPiece pn, "-", toPathPiece version]]
|
||||
muid <- maybeAuthId
|
||||
snapshots <- (runDB .
|
||||
fmap (map reformat) .
|
||||
E.select . E.from)
|
||||
(\(p,s) ->
|
||||
do E.where_ $
|
||||
(p ^. PackageStackage E.==. s ^. StackageId) &&.
|
||||
(p ^. PackageName' E.==. E.val pn)
|
||||
E.orderBy [E.desc $ s ^. StackageUploaded]
|
||||
return
|
||||
(p ^. PackageVersion
|
||||
,s ^. StackageTitle
|
||||
,s ^. StackageSlug
|
||||
,s ^. StackageHasHaddocks))
|
||||
defaultLayout
|
||||
(do setTitle ("Packages for " >> toHtml pn)
|
||||
$(combineStylesheets 'StaticR
|
||||
[css_font_awesome_min_css])
|
||||
$(widgetFile "package-snapshots"))
|
||||
where reformat (Value version,Value title,Value ident,Value hasHaddocks) =
|
||||
(version
|
||||
,fromMaybe title (stripPrefix "Stackage build for " title)
|
||||
,ident
|
||||
,hasHaddocks)
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
/system SystemR GET
|
||||
/haddock/#SnapSlug/*Texts HaddockR GET
|
||||
/package/#PackageName PackageR GET
|
||||
/package/#PackageName/snapshots PackageSnapshotsR GET
|
||||
/package PackageListR GET
|
||||
/compressor-status CompressorStatusR GET
|
||||
/package/#PackageName/like PackageLikeR POST
|
||||
|
||||
21
templates/package-snapshots.hamlet
Normal file
21
templates/package-snapshots.hamlet
Normal file
@ -0,0 +1,21 @@
|
||||
$newline never
|
||||
<div .container #snapshot-home .content>
|
||||
<div .row>
|
||||
<div .span12>
|
||||
<h1>Snapshots containing #{toHtml pn}
|
||||
<table .table .snapshots>
|
||||
<thead>
|
||||
<th colspan=2>
|
||||
Package
|
||||
<th>
|
||||
Snapshot
|
||||
$forall (version, title, slug, hasHaddocks) <- snapshots
|
||||
<tr>
|
||||
<td>
|
||||
$if hasHaddocks
|
||||
<a href=@{haddocksLink slug version}>
|
||||
Docs
|
||||
<td>
|
||||
#{version}
|
||||
<td>
|
||||
<a href=@{SnapshotR slug StackageHomeR}>#{fromMaybe title $ stripSuffix ", exclusive" title}
|
||||
Loading…
Reference in New Issue
Block a user