mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
Provide a link to snapshot's changes
This commit is contained in:
parent
160f2b02f9
commit
1ab01273bc
@ -11,13 +11,13 @@ import qualified Data.HashMap.Strict as HashMap
|
||||
import Data.These
|
||||
import Data.Time (FormatTime)
|
||||
import Stackage.Database
|
||||
import Stackage.Database.Types (sortNicely)
|
||||
import Stackage.Database.Types (sortNicely, previousSnapName)
|
||||
import Stackage.Snapshot.Diff
|
||||
|
||||
getStackageHomeR :: SnapName -> Handler Html
|
||||
getStackageHomeR name = do
|
||||
Entity sid snapshot <- lookupSnapshot name >>= maybe notFound return
|
||||
|
||||
snapNames <- map snapshotName . snd <$> getSnapshots 0 0
|
||||
let hoogleForm =
|
||||
let queryText = "" :: Text
|
||||
exact = False
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
module Stackage.Database.Types
|
||||
( SnapName (..)
|
||||
, sortNicely
|
||||
, previousSnapName
|
||||
) where
|
||||
|
||||
import ClassyPrelude.Conduit
|
||||
@ -26,6 +27,10 @@ sortNicely :: [SnapName] -> [SnapName]
|
||||
sortNicely ns = reverse (sort lts) ++ reverse (sort nightly)
|
||||
where (lts, nightly) = partition isLTS ns
|
||||
|
||||
previousSnapName :: [SnapName] -> SnapName -> SnapName
|
||||
previousSnapName ns n =
|
||||
fromMaybe n $ maximumMay $ filter (< n) $ filter ((isLTS n ==) . isLTS) ns
|
||||
|
||||
instance PersistField SnapName where
|
||||
toPersistValue = toPersistValue . toPathPiece
|
||||
fromPersistValue v = do
|
||||
|
||||
@ -5,6 +5,9 @@ $newline never
|
||||
<p>
|
||||
Published on #{yearMonthDay (snapshotCreated snapshot)}
|
||||
<span .separator>
|
||||
<span>
|
||||
<a href=@{StackageDiffR (previousSnapName snapNames name) name}>View changes
|
||||
<span .separator>
|
||||
<span>
|
||||
stack #
|
||||
<code>resolver: #{toPathPiece name}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user