Refactor listing challenges
This commit is contained in:
parent
c15dd30804
commit
5b05c4441c
@ -8,12 +8,17 @@ getListChallengesR = generalListChallenges [ChallengeArchived !=. Just True]
|
|||||||
getListArchivedChallengesR :: Handler Html
|
getListArchivedChallengesR :: Handler Html
|
||||||
getListArchivedChallengesR = generalListChallenges [ChallengeArchived ==. Just True]
|
getListArchivedChallengesR = generalListChallenges [ChallengeArchived ==. Just True]
|
||||||
|
|
||||||
|
generalListChallenges :: [Filter Challenge] -> Handler Html
|
||||||
generalListChallenges filterExpr = do
|
generalListChallenges filterExpr = do
|
||||||
challenges <- runDB $ selectList filterExpr [Desc ChallengeStarred, Desc ChallengeStamp]
|
challenges <- getChallenges filterExpr
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle "List challenges"
|
setTitle "List challenges"
|
||||||
$(widgetFile "list-challenges")
|
$(widgetFile "list-challenges")
|
||||||
|
|
||||||
|
getChallenges :: [Filter Challenge] -> Handler [Entity Challenge]
|
||||||
|
getChallenges filterExpr = runDB $ selectList filterExpr [Desc ChallengeStarred, Desc ChallengeStamp]
|
||||||
|
|
||||||
|
listChallengesCore :: [Entity Challenge] -> Widget
|
||||||
listChallengesCore challenges = $(widgetFile "list-challenges-core")
|
listChallengesCore challenges = $(widgetFile "list-challenges-core")
|
||||||
|
|
||||||
getChallengeImageR :: ChallengeId -> Handler Html
|
getChallengeImageR :: ChallengeId -> Handler Html
|
||||||
|
Loading…
Reference in New Issue
Block a user