aboutsummaryrefslogtreecommitdiff
path: root/server/lib/Uplcg/Views.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-23 12:30:59 +0200
committerJasper Van der Jeugt2020-08-23 12:30:59 +0200
commitbea39f31ff13e0cd039d024e2708c1405429abf9 (patch)
tree6e92189b84ccda84dd68d2d5b250f5986dcda820 /server/lib/Uplcg/Views.hs
parent963c135da14cf1be5d09368ab6e19b4907779ac9 (diff)
Show errors on same page
Diffstat (limited to 'server/lib/Uplcg/Views.hs')
-rw-r--r--server/lib/Uplcg/Views.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/lib/Uplcg/Views.hs b/server/lib/Uplcg/Views.hs
index c3ef1cc..b5f733c 100644
--- a/server/lib/Uplcg/Views.hs
+++ b/server/lib/Uplcg/Views.hs
@@ -34,8 +34,8 @@ template title body = H.docTypeHtml $ do
" version "
H.toHtml version
-rooms :: [RoomView] -> [Deck] -> H.Html
-rooms rids decks = template "Untitled PL Card Game" $
+rooms :: [RoomView] -> [Deck] -> Maybe String -> H.Html
+rooms rids decks mbError = template "Untitled PL Card Game" $
H.div H.! A.class_ "rooms" $ do
H.h1 "Rooms"
if null rids
@@ -50,14 +50,17 @@ rooms rids decks = template "Untitled PL Card Game" $
H.br
H.h1 "Create Room"
+ case mbError of
+ Nothing -> mempty
+ Just err -> H.p H.! A.class_ "error" $ H.toHtml err
H.form H.! A.method "POST" H.! A.action "/rooms" $ do
- H.label H.! A.for "name" $ "Room name: "
+ H.label H.! A.for "name" $ "Room identifier (alphanumeric only): "
H.input H.! A.type_ "text" H.! A.name "id"
H.br
H.label H.! A.for "name" $ "Password (optional): "
H.input H.! A.type_ "text" H.! A.name "password"
H.br
- H.label H.! A.for "deck" $ "Cards: "
+ H.label H.! A.for "deck" $ "Card set to use: "
H.select H.! A.name "deck" $ for_ decks $ \deck ->
H.option H.! A.value (H.toValue deck) $ H.toHtml deck
H.br