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 tagSlug = do
packages <- fmap (map (\(E.Value v) -> v)) $ runDB $
E.select $ E.from $ \tag -> do
E.where_ (tag E.^. TagTag E.==. E.val tagSlug)
packages <- fmap (map (\(E.Value t,E.Value s) -> (t,strip s))) $ runDB $
E.select $ E.from $ \(tag,meta) -> do
E.where_ (tag E.^. TagTag E.==. E.val tagSlug E.&&.
meta E.^. MetadataName E.==. 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
defaultLayout $ do
setTitle $ "Stackage tag"
$(widgetFile "tag")
where strip x = fromMaybe x (stripSuffix "." x)

View File

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