mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
Restyle snapshots page
This commit is contained in:
parent
8f0e0e7aa3
commit
a6bb737cc8
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
module Handler.Snapshots where
|
module Handler.Snapshots where
|
||||||
|
|
||||||
import Import
|
import Data.Time.Clock
|
||||||
import qualified Database.Esqueleto as E
|
import qualified Database.Esqueleto as E
|
||||||
|
import Formatting
|
||||||
|
import Formatting.Time
|
||||||
|
import Import
|
||||||
|
|
||||||
-- This is a handler function for the GET request method on the HomeR
|
-- This is a handler function for the GET request method on the HomeR
|
||||||
-- resource pattern. All of your resource patterns are defined in
|
-- resource pattern. All of your resource patterns are defined in
|
||||||
@ -14,7 +17,9 @@ import qualified Database.Esqueleto as E
|
|||||||
-- inclined, or create a single monolithic file.
|
-- inclined, or create a single monolithic file.
|
||||||
getAllSnapshotsR :: Handler Html
|
getAllSnapshotsR :: Handler Html
|
||||||
getAllSnapshotsR = do
|
getAllSnapshotsR = do
|
||||||
stackages <- runDB $ E.select $ E.from $ \(stackage `E.InnerJoin` user) -> do
|
now <- liftIO getCurrentTime
|
||||||
|
groups <- fmap (groupBy (on (==) (\(_,_,uploaded,_,_) -> uploaded)) . map (uncrapify now)) $
|
||||||
|
runDB $ E.select $ E.from $ \(stackage `E.InnerJoin` user) -> do
|
||||||
E.on (stackage E.^. StackageUser E.==. user E.^. UserId)
|
E.on (stackage E.^. StackageUser E.==. user E.^. UserId)
|
||||||
E.orderBy [E.desc $ stackage E.^. StackageUploaded]
|
E.orderBy [E.desc $ stackage E.^. StackageUploaded]
|
||||||
return
|
return
|
||||||
@ -31,3 +36,6 @@ getAllSnapshotsR = do
|
|||||||
, css_bootstrap_responsive_css
|
, css_bootstrap_responsive_css
|
||||||
])
|
])
|
||||||
$(widgetFile "all-snapshots")
|
$(widgetFile "all-snapshots")
|
||||||
|
where uncrapify now c =
|
||||||
|
let (E.Value ident, E.Value title, E.Value uploaded, E.Value display, E.Value handle) = c
|
||||||
|
in (ident,title,format (diff True) (diffUTCTime uploaded now),display,handle)
|
||||||
|
|||||||
@ -128,6 +128,7 @@ library
|
|||||||
, yesod-form >= 1.3.14
|
, yesod-form >= 1.3.14
|
||||||
, yesod-static >= 1.2
|
, yesod-static >= 1.2
|
||||||
, zlib
|
, zlib
|
||||||
|
, unordered-containers
|
||||||
-- Avoid https://github.com/haskell/cabal/issues/1202
|
-- Avoid https://github.com/haskell/cabal/issues/1202
|
||||||
, Cabal >= 1.18
|
, Cabal >= 1.18
|
||||||
, lifted-base
|
, lifted-base
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
<div .container>
|
<div .container>
|
||||||
<h1>All Snapshots
|
<h1>Snapshots
|
||||||
|
$forall stackages <- groups
|
||||||
|
$forall (_, _, uploaded, _, _) <- take 1 stackages
|
||||||
|
<h3>
|
||||||
|
#{uploaded}
|
||||||
<ul .snapshots>
|
<ul .snapshots>
|
||||||
$forall (E.Value ident, E.Value title, E.Value uploaded, E.Value display, E.Value handle) <- stackages
|
$forall (ident, title, uploaded, display, handle) <- stackages
|
||||||
<li>
|
<li>
|
||||||
|
<strong>
|
||||||
<a href=@{StackageHomeR ident}>
|
<a href=@{StackageHomeR ident}>
|
||||||
#{title}
|
#{title}
|
||||||
<i>by #{display} (#{handle}) on #{show uploaded}
|
<p>
|
||||||
|
#{display} (#{handle})
|
||||||
|
|||||||
@ -1 +1,23 @@
|
|||||||
.snapshots > li { line-height: 1.5em; }
|
.snapshots > li {
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0 0 1.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snapshots > li > p {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snapshots {
|
||||||
|
margin: 1em 0 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
border-bottom: 1px solid #aaa;
|
||||||
|
padding-bottom: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user