From 71d35bfa4f2a186745f37e6a7653214815829858 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 3 Nov 2014 13:50:14 +0200 Subject: [PATCH] More concise recommended list Problem: it's easy with the current "show four most recent" to run into situations where- for example- only GHC 7.8 has had a successful build in the past few days, and therefore it's the only snapshot that appears. This gives a more consistent and useful listing of recommended snapshots. Styling of this is up for debate. --- Handler/Home.hs | 33 ++++++++++++++++++--------------- templates/homepage.hamlet | 9 ++++----- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Handler/Home.hs b/Handler/Home.hs index 27ad410..1f81646 100644 --- a/Handler/Home.hs +++ b/Handler/Home.hs @@ -2,7 +2,7 @@ module Handler.Home where import Data.Slug -import Database.Esqueleto as E +import Database.Esqueleto as E hiding (isNothing) import Import hiding ((=.),on,(||.),(==.)) -- This is a handler function for the G request method on the HomeR @@ -14,20 +14,6 @@ import Import hiding ((=.),on,(||.),(==.)) -- inclined, or create a single monolithic file. getHomeR :: Handler Html getHomeR = do - fpHandle <- mkSlug "fpcomplete" - stackages <- runDB $ select $ from $ \(stackage `InnerJoin` user) -> do - on (stackage ^. StackageUser ==. user ^. UserId) - orderBy [desc $ stackage ^. StackageUploaded] - where_ (like (user ^. UserDisplay) (val "%@fpcomplete.com") ||. - user ^. UserHandle ==. val fpHandle) - limit 4 - return - ( stackage ^. StackageIdent - , stackage ^. StackageTitle - , stackage ^. StackageUploaded - , user ^. UserDisplay - , user ^. UserHandle - ) windowsLatest <- linkFor "unstable-ghc78hp-inclusive" restLatest <- linkFor "unstable-ghc78-inclusive" defaultLayout $ do @@ -48,3 +34,20 @@ getHomeR = do runDB . select . from + + addSnapshot title short = do + mex <- handlerToWidget $ linkFor $ name "exclusive" + min' <- handlerToWidget $ linkFor $ name "inclusive" + when (isJust mex || isJust min') + [whamlet| +
#{asHtml title} +
+ $maybe ex <- mex + exclusive + $if isJust mex && isJust min' + \ | # + $maybe in <- min' + inclusive + |] + where + name suffix = concat ["unstable-", short, "-", suffix] diff --git a/templates/homepage.hamlet b/templates/homepage.hamlet index 4fabac3..9372026 100644 --- a/templates/homepage.hamlet +++ b/templates/homepage.hamlet @@ -3,11 +3,10 @@ Stackage is an infrastructure to create stable builds of complete package sets. Think “stable Hackage”.

Recommended Snapshots -