aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm')
-rw-r--r--src/client/elm/LoggedIn/Action.elm0
-rw-r--r--src/client/elm/LoggedIn/Model.elm0
-rw-r--r--src/client/elm/LoggedIn/Update.elm0
-rw-r--r--src/client/elm/LoggedIn/View.elm0
-rw-r--r--src/client/elm/Model.elm5
-rw-r--r--src/client/elm/Model/Action.elm5
-rw-r--r--src/client/elm/Model/View.elm5
-rw-r--r--src/client/elm/SignIn/Action.elm (renamed from src/client/elm/Model/Action/SignInAction.elm)6
-rw-r--r--src/client/elm/SignIn/Model.elm (renamed from src/client/elm/Model/View/SignInView.elm)12
-rw-r--r--src/client/elm/SignIn/Update.elm (renamed from src/client/elm/Update/SignIn.elm)13
-rw-r--r--src/client/elm/SignIn/View.elm (renamed from src/client/elm/View/SignIn.elm)30
-rw-r--r--src/client/elm/Update.elm13
-rw-r--r--src/client/elm/View.elm5
13 files changed, 50 insertions, 44 deletions
diff --git a/src/client/elm/LoggedIn/Action.elm b/src/client/elm/LoggedIn/Action.elm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/client/elm/LoggedIn/Action.elm
diff --git a/src/client/elm/LoggedIn/Model.elm b/src/client/elm/LoggedIn/Model.elm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/client/elm/LoggedIn/Model.elm
diff --git a/src/client/elm/LoggedIn/Update.elm b/src/client/elm/LoggedIn/Update.elm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/client/elm/LoggedIn/Update.elm
diff --git a/src/client/elm/LoggedIn/View.elm b/src/client/elm/LoggedIn/View.elm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/client/elm/LoggedIn/View.elm
diff --git a/src/client/elm/Model.elm b/src/client/elm/Model.elm
index 7852c9a..3d2eb2b 100644
--- a/src/client/elm/Model.elm
+++ b/src/client/elm/Model.elm
@@ -7,10 +7,11 @@ import Time exposing (Time)
import Json.Decode as Json
import Model.View exposing (..)
-import Model.View.SignInView exposing (initSignInView)
import Model.Translations exposing (..)
import Model.Conf exposing (..)
+import SignIn.Model as SignInModel
+
import Utils.Maybe exposing (isJust)
type alias Model =
@@ -24,7 +25,7 @@ initialModel : Time -> String -> String -> Maybe String -> Model
initialModel initialTime translations conf mbSignInError =
{ view =
if isJust mbSignInError
- then SignInView (initSignInView mbSignInError)
+ then SignInView (SignInModel.init mbSignInError)
else LoadingView
, currentTime = initialTime
, translations =
diff --git a/src/client/elm/Model/Action.elm b/src/client/elm/Model/Action.elm
index 60c1aca..3d06521 100644
--- a/src/client/elm/Model/Action.elm
+++ b/src/client/elm/Model/Action.elm
@@ -5,16 +5,17 @@ module Model.Action
import Time exposing (Time)
import Signal exposing (Address)
-import Model.Action.SignInAction exposing (SignInAction)
import Model.Action.LoggedInAction exposing (LoggedInAction)
import Model.Init exposing (Init)
+import SignIn.Action as SignInAction
+
type Action =
NoOp
| SignIn String
| UpdateTime Time
| GoLoggedInView Init
- | UpdateSignIn SignInAction
+ | UpdateSignIn SignInAction.Action
| UpdateLoggedIn LoggedInAction
| GoSignInView
| SignOut
diff --git a/src/client/elm/Model/View.elm b/src/client/elm/Model/View.elm
index 90c0e53..7fc42af 100644
--- a/src/client/elm/Model/View.elm
+++ b/src/client/elm/Model/View.elm
@@ -3,10 +3,11 @@ module Model.View
) where
import Model.Payment exposing (Payments)
-import Model.View.SignInView exposing (..)
import Model.View.LoggedInView exposing (..)
+import SignIn.Model as SignInModel
+
type View =
LoadingView
- | SignInView SignInView
+ | SignInView SignInModel.Model
| LoggedInView LoggedInView
diff --git a/src/client/elm/Model/Action/SignInAction.elm b/src/client/elm/SignIn/Action.elm
index bead018..1f93f4e 100644
--- a/src/client/elm/Model/Action/SignInAction.elm
+++ b/src/client/elm/SignIn/Action.elm
@@ -1,8 +1,8 @@
-module Model.Action.SignInAction
- ( SignInAction(..)
+module SignIn.Action
+ ( Action(..)
) where
-type SignInAction =
+type Action =
UpdateLogin String
| WaitingServer
| ValidLogin
diff --git a/src/client/elm/Model/View/SignInView.elm b/src/client/elm/SignIn/Model.elm
index f72d05a..e01de12 100644
--- a/src/client/elm/Model/View/SignInView.elm
+++ b/src/client/elm/SignIn/Model.elm
@@ -1,16 +1,16 @@
-module Model.View.SignInView
- ( SignInView
- , initSignInView
+module SignIn.Model
+ ( Model
+ , init
) where
-type alias SignInView =
+type alias Model =
{ login : String
, waitingServer : Bool
, result : Maybe (Result String String)
}
-initSignInView : Maybe String -> SignInView
-initSignInView mbSignInError =
+init : Maybe String -> Model
+init mbSignInError =
{ login = ""
, waitingServer = False
, result = Maybe.map Err mbSignInError
diff --git a/src/client/elm/Update/SignIn.elm b/src/client/elm/SignIn/Update.elm
index ade5761..f4152a6 100644
--- a/src/client/elm/Update/SignIn.elm
+++ b/src/client/elm/SignIn/Update.elm
@@ -1,13 +1,14 @@
-module Update.SignIn
- ( updateSignIn
+module SignIn.Update
+ ( update
) where
-import Model.View.SignInView exposing (..)
-import Model.Action.SignInAction exposing (..)
+import SignIn.Model exposing (..)
+import SignIn.Action exposing (..)
+
import Model.Translations exposing (getMessage, Translations)
-updateSignIn : Translations -> SignInAction -> SignInView -> SignInView
-updateSignIn translations action signInView =
+update : Translations -> Action -> Model -> Model
+update translations action signInView =
case action of
UpdateLogin login ->
{ signInView |
diff --git a/src/client/elm/View/SignIn.elm b/src/client/elm/SignIn/View.elm
index acff960..2f63651 100644
--- a/src/client/elm/View/SignIn.elm
+++ b/src/client/elm/SignIn/View.elm
@@ -1,5 +1,5 @@
-module View.SignIn
- ( renderSignIn
+module SignIn.View
+ ( view
) where
import Html as H exposing (..)
@@ -8,46 +8,46 @@ import Html.Events exposing (..)
import Signal exposing (Address)
import Json.Decode as Json
+import SignIn.Action as SignInAction
+import SignIn.Model as SignInModel
+
import Update exposing (..)
-import Update.SignIn exposing (..)
import Model exposing (Model)
import Model.Action exposing (..)
-import Model.Action.SignInAction exposing (..)
-import Model.View.SignInView exposing (..)
import Model.Translations exposing (getMessage)
import View.Events exposing (onSubmitPrevDefault)
import View.Icon exposing (renderSpinIcon)
-renderSignIn : Address Action -> Model -> SignInView -> Html
-renderSignIn address model signInView =
+view : Address Action -> Model -> SignInModel.Model -> Html
+view address model signInModel =
div
[ class "signIn" ]
[ H.form
- [ onSubmitPrevDefault address (SignIn signInView.login) ]
+ [ onSubmitPrevDefault address (SignIn signInModel.login) ]
[ input
- [ value signInView.login
- , on "input" targetValue (Signal.message address << UpdateSignIn << UpdateLogin)
+ [ value signInModel.login
+ , on "input" targetValue (Signal.message address << UpdateSignIn << SignInAction.UpdateLogin)
, type' "text"
, autocomplete True
]
[]
, button
[]
- [ if signInView.waitingServer
+ [ if signInModel.waitingServer
then renderSpinIcon
else text (getMessage "SignIn" model.translations)
]
]
, div
[ class "result" ]
- [ signInResult model signInView ]
+ [ signInResult model signInModel ]
]
-signInResult : Model -> SignInView -> Html
-signInResult model signInView =
- case signInView.result of
+signInResult : Model -> SignInModel.Model -> Html
+signInResult model signInModel =
+ case signInModel.result of
Just result ->
case result of
Ok login ->
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index 1625167..8b443a0 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -11,14 +11,15 @@ import Server
import Model exposing (Model)
import Model.Translations exposing (getMessage)
import Model.Action exposing (..)
-import Model.Action.SignInAction as SignInAction exposing (SignInAction)
import Model.Action.LoggedInAction exposing (LoggedInAction)
import Model.View as V
-import Model.View.SignInView exposing (..)
import Model.View.LoggedInView exposing (..)
+import SignIn.Model as SignInModel
+import SignIn.Action as SignInAction
+import SignIn.Update as SignInUpdate
+
import Update.LoggedIn exposing (updateLoggedIn)
-import Update.SignIn exposing (updateSignIn)
import Utils.Http exposing (errorKey)
@@ -48,7 +49,7 @@ update action model =
({ model | currentTime = time }, Effects.none)
GoSignInView ->
- ({ model | view = V.SignInView (initSignInView Nothing) }, Effects.none)
+ ({ model | view = V.SignInView (SignInModel.init Nothing) }, Effects.none)
UpdateSignIn signInAction ->
(applySignIn model signInAction, Effects.none)
@@ -64,11 +65,11 @@ update action model =
|> Effects.task
)
-applySignIn : Model -> SignInAction -> Model
+applySignIn : Model -> SignInAction.Action -> Model
applySignIn model signInAction =
case model.view of
V.SignInView signInView ->
- { model | view = V.SignInView (updateSignIn model.translations signInAction signInView) }
+ { model | view = V.SignInView (SignInUpdate.update model.translations signInAction signInView) }
_ ->
model
diff --git a/src/client/elm/View.elm b/src/client/elm/View.elm
index 473caae..d29f814 100644
--- a/src/client/elm/View.elm
+++ b/src/client/elm/View.elm
@@ -11,9 +11,10 @@ import Model.View exposing (..)
import View.Header exposing (renderHeader)
import View.Loading exposing (renderLoading)
-import View.SignIn exposing (renderSignIn)
import View.LoggedIn exposing (renderLoggedIn)
+import SignIn.View as SignInView
+
view : Address Action -> Model -> Html
view address model =
div
@@ -28,6 +29,6 @@ renderMain address model =
LoadingView ->
renderLoading address
SignInView signInView ->
- renderSignIn address model signInView
+ SignInView.view address model signInView
LoggedInView loggedInView ->
renderLoggedIn address model loggedInView