Paginate list of sharers on the server

This commit is contained in:
fr33domlover 2016-06-06 14:05:06 +00:00
parent 893d91acd8
commit f53768de7e
2 changed files with 11 additions and 1 deletions

View file

@ -32,12 +32,18 @@ import Yesod.Persist.Core (runDB, getBy404)
import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Ident (ShrIdent, shr2text)
import Vervis.Paginate
import Vervis.Settings (widgetFile)
import Vervis.Widget.Sharer (sharerLinkW)
getSharersR :: Handler Html
getSharersR = do
sharers <- runDB $ selectList [] [Asc SharerIdent]
(sharers, navModel) <- getPageAndNav $ \ off lim ->
runDB $ do
total <- count ([] :: [Filter Sharer])
ss <- selectList [] [OffsetBy off, LimitTo lim, Asc SharerIdent]
return (total, ss)
let pageNav = navWidget navModel
defaultLayout $(widgetFile "sharer/list")
getSharerR :: ShrIdent -> Handler Html

View file

@ -15,7 +15,11 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<p>
These are the people and groups registered in this Vervis instance.
^{pageNav}
<ul>
$forall Entity _ sharer <- sharers
<li>
^{sharerLinkW sharer}
^{pageNav}