mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
Display count for tags list/sort by that count (#26)
This commit is contained in:
parent
df66e5d982
commit
77a81b7a2f
@ -7,10 +7,11 @@ import Import
|
|||||||
|
|
||||||
getTagListR :: Handler Html
|
getTagListR :: Handler Html
|
||||||
getTagListR = do
|
getTagListR = do
|
||||||
tags <- fmap (map (\(E.Value v) -> v)) $ runDB $
|
tags <- fmap (zip [0::Int ..] . (map (\(E.Value v,E.Value i) -> (v,i::Int)))) $ runDB $
|
||||||
E.selectDistinct $ E.from $ \tag -> do
|
E.select $ E.from $ \tag -> do
|
||||||
E.orderBy [E.asc (tag E.^. TagTag)]
|
E.groupBy (tag E.^. TagTag)
|
||||||
return (tag E.^. TagTag)
|
E.orderBy [E.desc (E.count (tag E.^. TagTag) :: E.SqlExpr (E.Value Int))]
|
||||||
|
return (tag E.^. TagTag, E.count (tag E.^. TagTag))
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle "Stackage tags"
|
setTitle "Stackage tags"
|
||||||
$(widgetFile "tag-list")
|
$(widgetFile "tag-list")
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
|
$newline never
|
||||||
<div .container>
|
<div .container>
|
||||||
<h1>Tags
|
<h1>Tags
|
||||||
<ul .tags>
|
<p .tags>
|
||||||
$forall tag <- tags
|
$forall (i,(tag,count)) <- tags
|
||||||
<li>
|
$if i /= 0
|
||||||
|
, #
|
||||||
|
<span .tag>
|
||||||
<a href=@{TagR tag}>
|
<a href=@{TagR tag}>
|
||||||
#{tag}
|
#{tag} #
|
||||||
|
<span .count>(#{count})
|
||||||
|
|||||||
@ -10,3 +10,7 @@
|
|||||||
h1 {
|
h1 {
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.count {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ $newline never
|
|||||||
|
|
||||||
<div .container>
|
<div .container>
|
||||||
<h1>
|
<h1>
|
||||||
Packages tagged: #{tag} (
|
Tag: #{tag} (
|
||||||
<a href=@{TagListR}>
|
<a href=@{TagListR}>
|
||||||
all tags
|
all tags
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user