aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Page.elm22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/client/View/Page.elm b/src/client/View/Page.elm
index 1683cf3..eb86132 100644
--- a/src/client/View/Page.elm
+++ b/src/client/View/Page.elm
@@ -13,11 +13,14 @@ import Date exposing (Date)
import String exposing (append)
+import Json.Decode as Json
+
import Model exposing (Model)
import Model.Payment exposing (Payments, Payment)
import Model.View exposing (..)
import Update exposing (..)
+import Update.SignIn exposing (..)
import ServerCommunication as SC
import ServerCommunication exposing (serverCommunications)
@@ -38,7 +41,7 @@ renderHeader model =
[]
[ h1
[]
- [ text "Payments" ]
+ [ text "Shared Cost" ]
, case model.view of
LoadingView ->
text ""
@@ -57,7 +60,7 @@ renderMain model =
case model.view of
LoadingView ->
loadingView
- SignInView login ->
+ SignInView { login } ->
signInView login
PaymentView payments ->
paymentsView payments
@@ -67,18 +70,25 @@ loadingView = text ""
signInView : String -> Html
signInView login =
- H.form
+ div
[ class "signIn" ]
[ input
[ value login
- , on "input" targetValue (Signal.message actions.address << UpdateLogin)
+ , on "input" targetValue (Signal.message actions.address << UpdateSignIn << UpdateLogin)
+ , onEnter serverCommunications.address (SC.SignIn login)
]
[]
, button
[ onClick serverCommunications.address (SC.SignIn login) ]
- [ renderIcon "sign-in" ]
+ [ text "Sign in" ]
]
+onEnter : Signal.Address a -> a -> Attribute
+onEnter address value =
+ on "keydown"
+ (Json.customDecoder keyCode (\code -> if code == 13 then Ok () else Err ""))
+ (\_ -> Signal.message address value)
+
paymentsView : Payments -> Html
paymentsView payments =
table
@@ -112,5 +122,5 @@ paymentLine payment =
renderDate : Date -> String
renderDate date =
toString (Date.day date)
- |> flip append (" " ++ (toString (Date.month date)))
+ |> flip append (" " ++ (toString (Date.month date)) ++ ".")
|> flip append (" " ++ (toString (Date.year date)))