Paginate list of sharers on the server
This commit is contained in:
parent
893d91acd8
commit
f53768de7e
2 changed files with 11 additions and 1 deletions
|
@ -32,12 +32,18 @@ import Yesod.Persist.Core (runDB, getBy404)
|
||||||
import Vervis.Foundation
|
import Vervis.Foundation
|
||||||
import Vervis.Model
|
import Vervis.Model
|
||||||
import Vervis.Model.Ident (ShrIdent, shr2text)
|
import Vervis.Model.Ident (ShrIdent, shr2text)
|
||||||
|
import Vervis.Paginate
|
||||||
import Vervis.Settings (widgetFile)
|
import Vervis.Settings (widgetFile)
|
||||||
import Vervis.Widget.Sharer (sharerLinkW)
|
import Vervis.Widget.Sharer (sharerLinkW)
|
||||||
|
|
||||||
getSharersR :: Handler Html
|
getSharersR :: Handler Html
|
||||||
getSharersR = do
|
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")
|
defaultLayout $(widgetFile "sharer/list")
|
||||||
|
|
||||||
getSharerR :: ShrIdent -> Handler Html
|
getSharerR :: ShrIdent -> Handler Html
|
||||||
|
|
|
@ -15,7 +15,11 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
<p>
|
<p>
|
||||||
These are the people and groups registered in this Vervis instance.
|
These are the people and groups registered in this Vervis instance.
|
||||||
|
|
||||||
|
^{pageNav}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
$forall Entity _ sharer <- sharers
|
$forall Entity _ sharer <- sharers
|
||||||
<li>
|
<li>
|
||||||
^{sharerLinkW sharer}
|
^{sharerLinkW sharer}
|
||||||
|
|
||||||
|
^{pageNav}
|
||||||
|
|
Loading…
Reference in a new issue