Use same style as packages list for tag page (#17)

@DanBurton @snoyberg
This commit is contained in:
Chris Done 2014-11-14 13:39:58 +01:00
parent eb00eb26b4
commit df66e5d982
2 changed files with 26 additions and 10 deletions

View File

@ -17,12 +17,14 @@ getTagListR = do
getTagR :: Slug -> Handler Html getTagR :: Slug -> Handler Html
getTagR tagSlug = do getTagR tagSlug = do
packages <- fmap (map (\(E.Value v) -> v)) $ runDB $ packages <- fmap (map (\(E.Value t,E.Value s) -> (t,strip s))) $ runDB $
E.select $ E.from $ \tag -> do E.select $ E.from $ \(tag,meta) -> do
E.where_ (tag E.^. TagTag E.==. E.val tagSlug) E.where_ (tag E.^. TagTag E.==. E.val tagSlug E.&&.
meta E.^. MetadataName E.==. tag E.^. TagPackage)
E.orderBy [E.asc (tag E.^. TagPackage)] E.orderBy [E.asc (tag E.^. TagPackage)]
return (tag E.^. TagPackage) return (tag E.^. TagPackage,meta E.^. MetadataSynopsis)
let tag = unSlug tagSlug let tag = unSlug tagSlug
defaultLayout $ do defaultLayout $ do
setTitle $ "Stackage tag" setTitle $ "Stackage tag"
$(widgetFile "tag") $(widgetFile "tag")
where strip x = fromMaybe x (stripSuffix "." x)

View File

@ -1,7 +1,21 @@
$newline never
<div .container> <div .container>
<h1>Packages tagged: #{tag} <h1>
<ul .packages> Packages tagged: #{tag} (
$forall package <- packages <a href=@{TagListR}>
<li> all tags
<a href=@{PackageR package}> )
#{package} <div .packages>
<table .table>
<thead>
<th>Package
<th>Synopsis
<tbody>
$forall (name,synopsis) <- packages
<tr>
<td>
<a href=@{PackageR name}>
#{name}
<td>
#{synopsis}