diff options
Diffstat (limited to 'src/client/View/SignIn.elm')
-rw-r--r-- | src/client/View/SignIn.elm | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/client/View/SignIn.elm b/src/client/View/SignIn.elm index 02ee1bd..a45adc7 100644 --- a/src/client/View/SignIn.elm +++ b/src/client/View/SignIn.elm @@ -2,7 +2,7 @@ module View.SignIn ( renderSignIn ) where -import Html exposing (..) +import Html as H exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) @@ -16,20 +16,21 @@ import ServerCommunication exposing (serverCommunications) import Model.View.SignInView exposing (..) +import View.Events exposing (onSubmitPrevDefault) + renderSignIn : SignInView -> Html renderSignIn signInView = div [ class "signIn" ] - [ div - [ class "form" ] + [ H.form + [ onSubmitPrevDefault serverCommunications.address (SC.SignIn signInView.login) ] [ input [ value signInView.login , on "input" targetValue (Signal.message actions.address << UpdateSignIn << UpdateLogin) - , onEnter serverCommunications.address (SC.SignIn signInView.login) ] [] , button - [ onClick serverCommunications.address (SC.SignIn signInView.login) ] + [] [ text "Sign in" ] ] , div @@ -37,12 +38,6 @@ renderSignIn signInView = [ signInResult signInView ] ] -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) - signInResult : SignInView -> Html signInResult signInView = case signInView.result of |