aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Header.elm2
-rw-r--r--src/client/View/LoggedIn.elm27
-rw-r--r--src/client/View/LoggedIn/Add.elm (renamed from src/client/View/Payments/Add.elm)34
-rw-r--r--src/client/View/LoggedIn/ExceedingPayer.elm (renamed from src/client/View/Payments/ExceedingPayer.elm)16
-rw-r--r--src/client/View/LoggedIn/Monthly.elm (renamed from src/client/View/Payments/Monthly.elm)34
-rw-r--r--src/client/View/LoggedIn/Paging.elm (renamed from src/client/View/Payments/Paging.elm)42
-rw-r--r--src/client/View/LoggedIn/Table.elm (renamed from src/client/View/Payments/Table.elm)34
-rw-r--r--src/client/View/Page.elm6
-rw-r--r--src/client/View/Payments.elm27
9 files changed, 111 insertions, 111 deletions
diff --git a/src/client/View/Header.elm b/src/client/View/Header.elm
index 31d8b7c..9d31183 100644
--- a/src/client/View/Header.elm
+++ b/src/client/View/Header.elm
@@ -27,7 +27,7 @@ renderHeader model =
text ""
SignInView _ ->
text ""
- LoggedView _ ->
+ LoggedInView _ ->
button
[ class "signOut"
, onClick serverCommunications.address SC.SignOut
diff --git a/src/client/View/LoggedIn.elm b/src/client/View/LoggedIn.elm
new file mode 100644
index 0000000..57a8eb0
--- /dev/null
+++ b/src/client/View/LoggedIn.elm
@@ -0,0 +1,27 @@
+module View.LoggedIn
+ ( renderLoggedIn
+ ) where
+
+import Html exposing (..)
+import Html.Attributes exposing (..)
+
+import Model exposing (Model)
+import Model.Payment exposing (Payments)
+import Model.View.LoggedInView exposing (LoggedInView)
+
+import View.LoggedIn.ExceedingPayer exposing (exceedingPayers)
+import View.LoggedIn.Add exposing (addPayment)
+import View.LoggedIn.Monthly exposing (monthlyPayments)
+import View.LoggedIn.Table exposing (paymentsTable)
+import View.LoggedIn.Paging exposing (paymentsPaging)
+
+renderLoggedIn : Model -> LoggedInView -> Html
+renderLoggedIn model loggedInView =
+ div
+ [ class "payments" ]
+ [ exceedingPayers model loggedInView
+ , addPayment model loggedInView
+ , monthlyPayments model loggedInView
+ , paymentsTable model loggedInView
+ , paymentsPaging loggedInView
+ ]
diff --git a/src/client/View/Payments/Add.elm b/src/client/View/LoggedIn/Add.elm
index f352f1f..acdda2d 100644
--- a/src/client/View/Payments/Add.elm
+++ b/src/client/View/LoggedIn/Add.elm
@@ -1,4 +1,4 @@
-module View.Payments.Add
+module View.LoggedIn.Add
( addPayment
) where
@@ -11,13 +11,13 @@ import Result exposing (..)
import ServerCommunication as SC exposing (serverCommunications)
import Update exposing (..)
-import Update.LoggedView exposing (..)
-import Update.LoggedView.Add exposing (..)
+import Update.LoggedIn exposing (..)
+import Update.LoggedIn.Add exposing (..)
import Model exposing (Model)
-import Model.View.Payment.Add exposing (..)
+import Model.View.LoggedIn.Add exposing (..)
import Model.Translations exposing (getMessage)
-import Model.View.LoggedView exposing (LoggedView)
+import Model.View.LoggedInView exposing (LoggedInView)
import View.Events exposing (onSubmitPrevDefault)
import View.Icon exposing (renderIcon)
@@ -25,22 +25,22 @@ import View.Icon exposing (renderIcon)
import Utils.Maybe exposing (isJust)
import Utils.Either exposing (toMaybeError)
-addPayment : Model -> LoggedView -> Html
-addPayment model loggedView =
+addPayment : Model -> LoggedInView -> Html
+addPayment model loggedInView =
H.form
- [ case (validateName loggedView.add.name model.translations, validateCost loggedView.add.cost model.translations) of
+ [ case (validateName loggedInView.add.name model.translations, validateCost loggedInView.add.cost model.translations) of
(Ok name, Ok cost) ->
let action =
- case loggedView.add.frequency of
- Punctual -> SC.AddPayment loggedView.me name cost
+ case loggedInView.add.frequency of
+ Punctual -> SC.AddPayment loggedInView.me name cost
Monthly -> SC.AddMonthlyPayment name cost
in onSubmitPrevDefault serverCommunications.address action
(resName, resCost) ->
- onSubmitPrevDefault actions.address (UpdateLoggedView <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost))
+ onSubmitPrevDefault actions.address (UpdateLoggedIn <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost))
]
- [ addPaymentName loggedView.add
- , addPaymentCost model loggedView.add
- , paymentFrequency model loggedView.add
+ [ addPaymentName loggedInView.add
+ , addPaymentCost model loggedInView.add
+ , paymentFrequency model loggedInView.add
, button
[ type' "submit"
, class "add" ]
@@ -54,7 +54,7 @@ addPaymentName addPayment =
[ input
[ id "nameInput"
, value addPayment.name
- , on "input" targetValue (Signal.message actions.address << UpdateLoggedView << UpdateAdd << UpdateName)
+ , on "input" targetValue (Signal.message actions.address << UpdateLoggedIn << UpdateAdd << UpdateName)
, maxlength 20
]
[]
@@ -75,7 +75,7 @@ addPaymentCost model addPayment =
[ input
[ id "costInput"
, value addPayment.cost
- , on "input" targetValue (Signal.message actions.address << UpdateLoggedView << UpdateAdd << UpdateCost)
+ , on "input" targetValue (Signal.message actions.address << UpdateLoggedIn << UpdateAdd << UpdateCost)
, maxlength 7
]
[]
@@ -94,7 +94,7 @@ paymentFrequency model addPayment =
button
[ type' "button"
, class "frequency"
- , onClick actions.address (UpdateLoggedView << UpdateAdd <| ToggleFrequency)
+ , onClick actions.address (UpdateLoggedIn << UpdateAdd <| ToggleFrequency)
]
[ div
[ class ("punctual" ++ if addPayment.frequency == Punctual then " selected" else "") ]
diff --git a/src/client/View/Payments/ExceedingPayer.elm b/src/client/View/LoggedIn/ExceedingPayer.elm
index 88b3a72..ea848b6 100644
--- a/src/client/View/Payments/ExceedingPayer.elm
+++ b/src/client/View/LoggedIn/ExceedingPayer.elm
@@ -1,4 +1,4 @@
-module View.Payments.ExceedingPayer
+module View.LoggedIn.ExceedingPayer
( exceedingPayers
) where
@@ -9,23 +9,23 @@ import List
import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payers exposing (..)
-import Model.View.LoggedView exposing (LoggedView)
+import Model.View.LoggedInView exposing (LoggedInView)
import Model.Translations exposing (getMessage)
-exceedingPayers : Model -> LoggedView -> Html
-exceedingPayers model loggedView =
+exceedingPayers : Model -> LoggedInView -> Html
+exceedingPayers model loggedInView =
div
[ class "exceedingPayers" ]
- (List.map (exceedingPayer model loggedView) (getOrderedExceedingPayers loggedView.payers))
+ (List.map (exceedingPayer model loggedInView) (getOrderedExceedingPayers loggedInView.payers))
-exceedingPayer : Model -> LoggedView -> ExceedingPayer -> Html
-exceedingPayer model loggedView payer =
+exceedingPayer : Model -> LoggedInView -> ExceedingPayer -> Html
+exceedingPayer model loggedInView payer =
div
[ class "exceedingPayer" ]
[ span
[ class "userName" ]
[ payer.userId
- |> getUserName loggedView.users
+ |> getUserName loggedInView.users
|> Maybe.withDefault "−"
|> text
]
diff --git a/src/client/View/Payments/Monthly.elm b/src/client/View/LoggedIn/Monthly.elm
index 944314c..14c3de7 100644
--- a/src/client/View/Payments/Monthly.elm
+++ b/src/client/View/LoggedIn/Monthly.elm
@@ -1,4 +1,4 @@
-module View.Payments.Monthly
+module View.LoggedIn.Monthly
( monthlyPayments
) where
@@ -7,22 +7,22 @@ import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Update exposing (..)
-import Update.LoggedView exposing (..)
-import Update.LoggedView.Monthly exposing (..)
+import Update.LoggedIn exposing (..)
+import Update.LoggedIn.Monthly exposing (..)
import Model exposing (Model)
-import Model.View.Payment.Monthly exposing (Monthly)
+import Model.View.LoggedIn.Monthly exposing (Monthly)
import Model.Payment exposing (Payments, Payment)
-import Model.View.LoggedView exposing (LoggedView)
+import Model.View.LoggedInView exposing (LoggedInView)
import Model.Translations exposing (getMessage, getParamMessage)
import ServerCommunication as SC exposing (serverCommunications)
import View.Icon exposing (renderIcon)
-monthlyPayments : Model -> LoggedView -> Html
-monthlyPayments model loggedView =
- let monthly = loggedView.monthly
+monthlyPayments : Model -> LoggedInView -> Html
+monthlyPayments model loggedInView =
+ let monthly = loggedInView.monthly
in if List.isEmpty monthly.payments
then
text ""
@@ -30,7 +30,7 @@ monthlyPayments model loggedView =
div
[ class ("monthlyPayments" ++ if monthly.visibleDetail then " detail" else "") ]
[ monthlyCount model monthly
- , if monthly.visibleDetail then paymentsTable model loggedView monthly else text ""
+ , if monthly.visibleDetail then paymentsTable model loggedInView monthly else text ""
]
monthlyCount : Model -> Monthly -> Html
@@ -39,7 +39,7 @@ monthlyCount model monthly =
key = if count > 1 then "PluralMonthlyCount" else "SingularMonthlyCount"
in button
[ class "count"
- , onClick actions.address (UpdateLoggedView << UpdateMonthly <| ToggleDetail)
+ , onClick actions.address (UpdateLoggedIn << UpdateMonthly <| ToggleDetail)
]
[ text (getParamMessage [toString count] key model.translations)
, div
@@ -50,17 +50,17 @@ monthlyCount model monthly =
]
]
-paymentsTable : Model -> LoggedView -> Monthly -> Html
-paymentsTable model loggedView monthly =
+paymentsTable : Model -> LoggedInView -> Monthly -> Html
+paymentsTable model loggedInView monthly =
div
[ class "table" ]
- ( List.map (paymentLine model loggedView) monthly.payments )
+ ( List.map (paymentLine model loggedInView) monthly.payments )
-paymentLine : Model -> LoggedView -> Payment -> Html
-paymentLine model loggedView payment =
+paymentLine : Model -> LoggedInView -> Payment -> Html
+paymentLine model loggedInView payment =
a
- [ class ("row" ++ (if loggedView.paymentEdition == Just payment.id then " edition" else ""))
- , onClick actions.address (UpdateLoggedView (ToggleEdit payment.id))
+ [ class ("row" ++ (if loggedInView.paymentEdition == Just payment.id then " edition" else ""))
+ , onClick actions.address (UpdateLoggedIn (ToggleEdit payment.id))
]
[ div [ class "cell" ] [ text (payment.name) ]
, div [ class "cell" ] [ text (toString payment.cost ++ " " ++ getMessage "MoneySymbol" model.translations) ]
diff --git a/src/client/View/Payments/Paging.elm b/src/client/View/LoggedIn/Paging.elm
index b9a0109..5d5f2db 100644
--- a/src/client/View/Payments/Paging.elm
+++ b/src/client/View/LoggedIn/Paging.elm
@@ -1,4 +1,4 @@
-module View.Payments.Paging
+module View.LoggedIn.Paging
( paymentsPaging
) where
@@ -6,36 +6,36 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-import Model.View.LoggedView exposing (..)
+import Model.View.LoggedInView exposing (..)
import Model.Payment exposing (perPage)
import ServerCommunication as SC exposing (serverCommunications)
import Update exposing (..)
-import Update.LoggedView exposing (..)
+import Update.LoggedIn exposing (..)
import View.Icon exposing (renderIcon)
showedPages : Int
showedPages = 5
-paymentsPaging : LoggedView -> Html
-paymentsPaging loggedView =
- let maxPage = ceiling (toFloat loggedView.paymentsCount / toFloat perPage)
- pages = truncatePages loggedView.currentPage [1..maxPage]
+paymentsPaging : LoggedInView -> Html
+paymentsPaging loggedInView =
+ let maxPage = ceiling (toFloat loggedInView.paymentsCount / toFloat perPage)
+ pages = truncatePages loggedInView.currentPage [1..maxPage]
in if maxPage == 1
then
text ""
else
div
[ class "pages" ]
- ( ( if loggedView.currentPage > 1
- then [ firstPage, previousPage loggedView ]
+ ( ( if loggedInView.currentPage > 1
+ then [ firstPage, previousPage loggedInView ]
else []
)
- ++ ( List.map (paymentsPage loggedView) pages)
- ++ ( if loggedView.currentPage < maxPage
- then [ nextPage loggedView, lastPage maxPage ]
+ ++ ( List.map (paymentsPage loggedInView) pages)
+ ++ ( if loggedInView.currentPage < maxPage
+ then [ nextPage loggedInView, lastPage maxPage ]
else []
)
)
@@ -62,19 +62,19 @@ firstPage =
]
[ renderIcon "fast-backward" ]
-previousPage : LoggedView -> Html
-previousPage loggedView =
+previousPage : LoggedInView -> Html
+previousPage loggedInView =
button
[ class "page"
- , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage - 1))
+ , onClick serverCommunications.address (SC.UpdatePage (loggedInView.currentPage - 1))
]
[ renderIcon "backward" ]
-nextPage : LoggedView -> Html
-nextPage loggedView =
+nextPage : LoggedInView -> Html
+nextPage loggedInView =
button
[ class "page"
- , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage + 1))
+ , onClick serverCommunications.address (SC.UpdatePage (loggedInView.currentPage + 1))
]
[ renderIcon "forward" ]
@@ -86,9 +86,9 @@ lastPage maxPage =
]
[ renderIcon "fast-forward" ]
-paymentsPage : LoggedView -> Int -> Html
-paymentsPage loggedView page =
- let onCurrentPage = page == loggedView.currentPage
+paymentsPage : LoggedInView -> Int -> Html
+paymentsPage loggedInView page =
+ let onCurrentPage = page == loggedInView.currentPage
in button
[ class ("page" ++ (if onCurrentPage then " current" else ""))
, onClick serverCommunications.address <|
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/LoggedIn/Table.elm
index 1646186..6342369 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/LoggedIn/Table.elm
@@ -1,4 +1,4 @@
-module View.Payments.Table
+module View.LoggedIn.Table
( paymentsTable
) where
@@ -15,22 +15,22 @@ import String exposing (append)
import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payment exposing (..)
-import Model.View.LoggedView exposing (LoggedView)
+import Model.View.LoggedInView exposing (LoggedInView)
import Model.Translations exposing (getMessage)
import ServerCommunication as SC exposing (serverCommunications)
import Update exposing (..)
-import Update.LoggedView exposing (..)
+import Update.LoggedIn exposing (..)
import View.Icon exposing (renderIcon)
import View.Date exposing (..)
-paymentsTable : Model -> LoggedView -> Html
-paymentsTable model loggedView =
+paymentsTable : Model -> LoggedInView -> Html
+paymentsTable model loggedInView =
div
[ class "table" ]
- ( headerLine model :: paymentLines model loggedView)
+ ( headerLine model :: paymentLines model loggedInView)
headerLine : Model -> Html
headerLine model =
@@ -43,25 +43,25 @@ headerLine model =
, div [ class "cell" ] []
]
-paymentLines : Model -> LoggedView -> List Html
-paymentLines model loggedView =
- loggedView.payments
+paymentLines : Model -> LoggedInView -> List Html
+paymentLines model loggedInView =
+ loggedInView.payments
|> List.sortBy (Date.toTime << .creation)
|> List.reverse
- |> List.map (paymentLine model loggedView)
+ |> List.map (paymentLine model loggedInView)
-paymentLine : Model -> LoggedView -> Payment -> Html
-paymentLine model loggedView payment =
+paymentLine : Model -> LoggedInView -> Payment -> Html
+paymentLine model loggedInView payment =
a
- [ class ("row" ++ (if loggedView.paymentEdition == Just payment.id then " edition" else ""))
- , onClick actions.address (UpdateLoggedView (ToggleEdit payment.id))
+ [ class ("row" ++ (if loggedInView.paymentEdition == Just payment.id then " edition" else ""))
+ , onClick actions.address (UpdateLoggedIn (ToggleEdit payment.id))
]
[ div [ class "cell category" ] [ text payment.name ]
, div [ class "cell cost" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
, div
[ class "cell user" ]
[ payment.userId
- |> getUserName loggedView.users
+ |> getUserName loggedInView.users
|> Maybe.withDefault "−"
|> text
]
@@ -74,11 +74,11 @@ paymentLine model loggedView payment =
[ class "longDate" ]
[ text (renderLongDate payment.creation model.translations) ]
]
- , if loggedView.me == payment.userId
+ , if loggedInView.me == payment.userId
then
div
[ class "cell delete"
- , onClick serverCommunications.address (SC.DeletePayment payment.id payment.userId payment.cost loggedView.currentPage)
+ , onClick serverCommunications.address (SC.DeletePayment payment.id payment.userId payment.cost loggedInView.currentPage)
]
[ renderIcon "times" ]
else
diff --git a/src/client/View/Page.elm b/src/client/View/Page.elm
index 199c67f..763734d 100644
--- a/src/client/View/Page.elm
+++ b/src/client/View/Page.elm
@@ -10,7 +10,7 @@ import Model.View exposing (..)
import View.Header exposing (renderHeader)
import View.Loading exposing (renderLoading)
import View.SignIn exposing (renderSignIn)
-import View.Payments exposing (renderPayments)
+import View.LoggedIn exposing (renderLoggedIn)
renderPage : Model -> Html
renderPage model =
@@ -27,5 +27,5 @@ renderMain model =
renderLoading
SignInView signInView ->
renderSignIn model signInView
- LoggedView paymentsView ->
- renderPayments model paymentsView
+ LoggedInView loggedInView ->
+ renderLoggedIn model loggedInView
diff --git a/src/client/View/Payments.elm b/src/client/View/Payments.elm
deleted file mode 100644
index ac19df7..0000000
--- a/src/client/View/Payments.elm
+++ /dev/null
@@ -1,27 +0,0 @@
-module View.Payments
- ( renderPayments
- ) where
-
-import Html exposing (..)
-import Html.Attributes exposing (..)
-
-import Model exposing (Model)
-import Model.Payment exposing (Payments)
-import Model.View.LoggedView exposing (LoggedView)
-
-import View.Payments.ExceedingPayer exposing (exceedingPayers)
-import View.Payments.Add exposing (addPayment)
-import View.Payments.Monthly exposing (monthlyPayments)
-import View.Payments.Table exposing (paymentsTable)
-import View.Payments.Paging exposing (paymentsPaging)
-
-renderPayments : Model -> LoggedView -> Html
-renderPayments model loggedView =
- div
- [ class "payments" ]
- [ exceedingPayers model loggedView
- , addPayment model loggedView
- , monthlyPayments model loggedView
- , paymentsTable model loggedView
- , paymentsPaging loggedView
- ]