From 8e3a7bf1cb83bbb6e3dcd54308eefa52a29cd679 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 3 Jun 2016 20:27:16 +0200 Subject: Migrate to elm 0.17 --- src/client/elm/SignIn/Action.elm | 9 --------- src/client/elm/SignIn/Model.elm | 4 ++-- src/client/elm/SignIn/Msg.elm | 9 +++++++++ src/client/elm/SignIn/Update.elm | 8 ++++---- src/client/elm/SignIn/View.elm | 19 +++++++++---------- 5 files changed, 24 insertions(+), 25 deletions(-) delete mode 100644 src/client/elm/SignIn/Action.elm create mode 100644 src/client/elm/SignIn/Msg.elm (limited to 'src/client/elm/SignIn') diff --git a/src/client/elm/SignIn/Action.elm b/src/client/elm/SignIn/Action.elm deleted file mode 100644 index 1f93f4e..0000000 --- a/src/client/elm/SignIn/Action.elm +++ /dev/null @@ -1,9 +0,0 @@ -module SignIn.Action - ( Action(..) - ) where - -type Action = - UpdateLogin String - | WaitingServer - | ValidLogin - | ErrorLogin String diff --git a/src/client/elm/SignIn/Model.elm b/src/client/elm/SignIn/Model.elm index e01de12..19d4305 100644 --- a/src/client/elm/SignIn/Model.elm +++ b/src/client/elm/SignIn/Model.elm @@ -1,7 +1,7 @@ -module SignIn.Model +module SignIn.Model exposing ( Model , init - ) where + ) type alias Model = { login : String diff --git a/src/client/elm/SignIn/Msg.elm b/src/client/elm/SignIn/Msg.elm new file mode 100644 index 0000000..f753ebd --- /dev/null +++ b/src/client/elm/SignIn/Msg.elm @@ -0,0 +1,9 @@ +module SignIn.Msg exposing + ( Msg(..) + ) + +type Msg = + UpdateLogin String + | WaitingServer + | ValidLogin + | ErrorLogin String diff --git a/src/client/elm/SignIn/Update.elm b/src/client/elm/SignIn/Update.elm index f4152a6..28307e4 100644 --- a/src/client/elm/SignIn/Update.elm +++ b/src/client/elm/SignIn/Update.elm @@ -1,13 +1,13 @@ -module SignIn.Update +module SignIn.Update exposing ( update - ) where + ) import SignIn.Model exposing (..) -import SignIn.Action exposing (..) +import SignIn.Msg exposing (..) import Model.Translations exposing (getMessage, Translations) -update : Translations -> Action -> Model -> Model +update : Translations -> Msg -> Model -> Model update translations action signInView = case action of UpdateLogin login -> diff --git a/src/client/elm/SignIn/View.elm b/src/client/elm/SignIn/View.elm index d81d63a..2cec586 100644 --- a/src/client/elm/SignIn/View.elm +++ b/src/client/elm/SignIn/View.elm @@ -1,34 +1,33 @@ -module SignIn.View +module SignIn.View exposing ( view - ) where + ) import Html as H exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) -import Signal exposing (Address) import Json.Decode as Json -import SignIn.Action as SignInAction +import SignIn.Msg as SignInMsg import SignIn.Model as SignInModel import Update exposing (..) import Model exposing (Model) -import Action exposing (..) +import Msg exposing (..) import Model.Translations exposing (getMessage) import View.Events exposing (onSubmitPrevDefault) import View.Icon exposing (renderSpinIcon) -view : Address Action -> Model -> SignInModel.Model -> Html -view address model signInModel = +view : Model -> SignInModel.Model -> Html Msg +view model signInModel = div [ class "signIn" ] [ H.form - [ onSubmitPrevDefault address (SignIn signInModel.login) ] + [ onSubmitPrevDefault (SignIn signInModel.login) ] [ input [ value signInModel.login - , on "input" targetValue (Signal.message address << UpdateSignIn << SignInAction.UpdateLogin) + , on "input" (targetValue |> (Json.map <| (UpdateSignIn << SignInMsg.UpdateLogin))) , name "email" ] [] @@ -44,7 +43,7 @@ view address model signInModel = [ signInResult model signInModel ] ] -signInResult : Model -> SignInModel.Model -> Html +signInResult : Model -> SignInModel.Model -> Html Msg signInResult model signInModel = case signInModel.result of Just result -> -- cgit v1.2.3