aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
authorJoris2015-09-05 14:14:25 +0200
committerJoris2015-09-05 14:14:25 +0200
commitcc6a51b5ca03ee1a3b5de7c32dd1324e1053f42a (patch)
treefe60948b87993908f73659c9dbd7ffd96498b7f8 /src/client/View
parent3b738e0d4cc65f314da7389d4542ec826ba0f454 (diff)
Renaming PaymentView to LoggedView
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Header.elm2
-rw-r--r--src/client/View/Page.elm2
-rw-r--r--src/client/View/Payments.elm14
-rw-r--r--src/client/View/Payments/Add.elm14
-rw-r--r--src/client/View/Payments/ExceedingPayer.elm14
-rw-r--r--src/client/View/Payments/Paging.elm38
-rw-r--r--src/client/View/Payments/Table.elm28
7 files changed, 56 insertions, 56 deletions
diff --git a/src/client/View/Header.elm b/src/client/View/Header.elm
index 1738d71..31d8b7c 100644
--- a/src/client/View/Header.elm
+++ b/src/client/View/Header.elm
@@ -27,7 +27,7 @@ renderHeader model =
text ""
SignInView _ ->
text ""
- PaymentView _ ->
+ LoggedView _ ->
button
[ class "signOut"
, onClick serverCommunications.address SC.SignOut
diff --git a/src/client/View/Page.elm b/src/client/View/Page.elm
index 7015317..199c67f 100644
--- a/src/client/View/Page.elm
+++ b/src/client/View/Page.elm
@@ -27,5 +27,5 @@ renderMain model =
renderLoading
SignInView signInView ->
renderSignIn model signInView
- PaymentView paymentsView ->
+ LoggedView paymentsView ->
renderPayments model paymentsView
diff --git a/src/client/View/Payments.elm b/src/client/View/Payments.elm
index 256e686..b51c9a0 100644
--- a/src/client/View/Payments.elm
+++ b/src/client/View/Payments.elm
@@ -7,19 +7,19 @@ import Html.Attributes exposing (..)
import Model exposing (Model)
import Model.Payment exposing (Payments)
-import Model.View.PaymentView exposing (PaymentView)
+import Model.View.LoggedView exposing (LoggedView)
import View.Payments.ExceedingPayer exposing (exceedingPayers)
import View.Payments.Add exposing (addPayment)
import View.Payments.Table exposing (paymentsTable)
import View.Payments.Paging exposing (paymentsPaging)
-renderPayments : Model -> PaymentView -> Html
-renderPayments model paymentView =
+renderPayments : Model -> LoggedView -> Html
+renderPayments model loggedView =
div
[ class "payments" ]
- [ exceedingPayers model paymentView
- , addPayment model paymentView
- , paymentsTable model paymentView
- , paymentsPaging paymentView
+ [ exceedingPayers model loggedView
+ , addPayment model loggedView
+ , paymentsTable model loggedView
+ , paymentsPaging loggedView
]
diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm
index 32233ed..77d40ea 100644
--- a/src/client/View/Payments/Add.elm
+++ b/src/client/View/Payments/Add.elm
@@ -17,7 +17,7 @@ import Update.Payment.Add exposing (..)
import Model exposing (Model)
import Model.View.Payment.Add exposing (..)
import Model.Translations exposing (getMessage)
-import Model.View.PaymentView exposing (PaymentView)
+import Model.View.LoggedView exposing (LoggedView)
import View.Events exposing (onSubmitPrevDefault)
import View.Icon exposing (renderIcon)
@@ -25,18 +25,18 @@ import View.Icon exposing (renderIcon)
import Utils.Maybe exposing (isJust)
import Utils.Either exposing (toMaybeError)
-addPayment : Model -> PaymentView -> Html
-addPayment model paymentView =
+addPayment : Model -> LoggedView -> Html
+addPayment model loggedView =
H.form
[ class "add"
- , case (validateName paymentView.add.name model.translations, validateCost paymentView.add.cost model.translations) of
+ , case (validateName loggedView.add.name model.translations, validateCost loggedView.add.cost model.translations) of
(Ok name, Ok cost) ->
- onSubmitPrevDefault serverCommunications.address (SC.AddPayment paymentView.me name cost)
+ onSubmitPrevDefault serverCommunications.address (SC.AddPayment loggedView.me name cost)
(resName, resCost) ->
onSubmitPrevDefault actions.address (UpdatePayment <| UpdateAdd <| AddError (toMaybeError resName) (toMaybeError resCost))
]
- [ addPaymentName paymentView.add
- , addPaymentCost model paymentView.add
+ [ addPaymentName loggedView.add
+ , addPaymentCost model loggedView.add
, button
[ type' "submit" ]
[ text (getMessage "Add" model.translations)]
diff --git a/src/client/View/Payments/ExceedingPayer.elm b/src/client/View/Payments/ExceedingPayer.elm
index f249383..88b3a72 100644
--- a/src/client/View/Payments/ExceedingPayer.elm
+++ b/src/client/View/Payments/ExceedingPayer.elm
@@ -9,23 +9,23 @@ import List
import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payers exposing (..)
-import Model.View.PaymentView exposing (PaymentView)
+import Model.View.LoggedView exposing (LoggedView)
import Model.Translations exposing (getMessage)
-exceedingPayers : Model -> PaymentView -> Html
-exceedingPayers model paymentView =
+exceedingPayers : Model -> LoggedView -> Html
+exceedingPayers model loggedView =
div
[ class "exceedingPayers" ]
- (List.map (exceedingPayer model paymentView) (getOrderedExceedingPayers paymentView.payers))
+ (List.map (exceedingPayer model loggedView) (getOrderedExceedingPayers loggedView.payers))
-exceedingPayer : Model -> PaymentView -> ExceedingPayer -> Html
-exceedingPayer model paymentView payer =
+exceedingPayer : Model -> LoggedView -> ExceedingPayer -> Html
+exceedingPayer model loggedView payer =
div
[ class "exceedingPayer" ]
[ span
[ class "userName" ]
[ payer.userId
- |> getUserName paymentView.users
+ |> getUserName loggedView.users
|> Maybe.withDefault "−"
|> text
]
diff --git a/src/client/View/Payments/Paging.elm b/src/client/View/Payments/Paging.elm
index c3db819..b06d749 100644
--- a/src/client/View/Payments/Paging.elm
+++ b/src/client/View/Payments/Paging.elm
@@ -6,7 +6,7 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-import Model.View.PaymentView exposing (..)
+import Model.View.LoggedView exposing (..)
import Model.Payment exposing (perPage)
import ServerCommunication as SC exposing (serverCommunications)
@@ -19,23 +19,23 @@ import View.Icon exposing (renderIcon)
showedPages : Int
showedPages = 5
-paymentsPaging : PaymentView -> Html
-paymentsPaging paymentView =
- let maxPage = ceiling (toFloat paymentView.paymentsCount / toFloat perPage)
- pages = truncatePages paymentView.currentPage [1..maxPage]
+paymentsPaging : LoggedView -> Html
+paymentsPaging loggedView =
+ let maxPage = ceiling (toFloat loggedView.paymentsCount / toFloat perPage)
+ pages = truncatePages loggedView.currentPage [1..maxPage]
in if maxPage == 1
then
text ""
else
ul
[ class "pages" ]
- ( ( if paymentView.currentPage > 1
- then [ firstPage, previousPage paymentView ]
+ ( ( if loggedView.currentPage > 1
+ then [ firstPage, previousPage loggedView ]
else []
)
- ++ ( List.map (paymentsPage paymentView) pages)
- ++ ( if paymentView.currentPage < maxPage
- then [ nextPage paymentView, lastPage maxPage ]
+ ++ ( List.map (paymentsPage loggedView) pages)
+ ++ ( if loggedView.currentPage < maxPage
+ then [ nextPage loggedView, lastPage maxPage ]
else []
)
)
@@ -62,19 +62,19 @@ firstPage =
]
[ renderIcon "fast-backward" ]
-previousPage : PaymentView -> Html
-previousPage paymentView =
+previousPage : LoggedView -> Html
+previousPage loggedView =
li
[ class "page"
- , onClick serverCommunications.address (SC.UpdatePage (paymentView.currentPage - 1))
+ , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage - 1))
]
[ renderIcon "backward" ]
-nextPage : PaymentView -> Html
-nextPage paymentView =
+nextPage : LoggedView -> Html
+nextPage loggedView =
li
[ class "page"
- , onClick serverCommunications.address (SC.UpdatePage (paymentView.currentPage + 1))
+ , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage + 1))
]
[ renderIcon "forward" ]
@@ -86,9 +86,9 @@ lastPage maxPage =
]
[ renderIcon "fast-forward" ]
-paymentsPage : PaymentView -> Int -> Html
-paymentsPage paymentView page =
- let onCurrentPage = page == paymentView.currentPage
+paymentsPage : LoggedView -> Int -> Html
+paymentsPage loggedView page =
+ let onCurrentPage = page == loggedView.currentPage
in li
[ class ("page" ++ (if onCurrentPage then " current" else ""))
, onClick serverCommunications.address <|
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm
index 743a8a9..5374c44 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/Payments/Table.elm
@@ -15,7 +15,7 @@ import String exposing (append)
import Model exposing (Model)
import Model.User exposing (getUserName)
import Model.Payment exposing (..)
-import Model.View.PaymentView exposing (PaymentView)
+import Model.View.LoggedView exposing (LoggedView)
import Model.Translations exposing (getMessage)
import ServerCommunication as SC exposing (serverCommunications)
@@ -26,8 +26,8 @@ import Update.Payment exposing (..)
import View.Icon exposing (renderIcon)
import View.Date exposing (..)
-paymentsTable : Model -> PaymentView -> Html
-paymentsTable model paymentView =
+paymentsTable : Model -> LoggedView -> Html
+paymentsTable model loggedView =
div
[ class "table" ]
([ div
@@ -38,20 +38,20 @@ paymentsTable model paymentView =
, div [ class "cell date" ] [ renderIcon "calendar" ]
, div [ class "cell" ] []
]
- ] ++ (paymentLines model paymentView))
+ ] ++ (paymentLines model loggedView))
-paymentLines : Model -> PaymentView -> List Html
-paymentLines model paymentView =
- paymentView.payments
+paymentLines : Model -> LoggedView -> List Html
+paymentLines model loggedView =
+ loggedView.payments
|> Dict.toList
|> List.sortBy (\(_, payment) -> Date.toTime payment.creation)
|> List.reverse
- |> List.map (paymentLine model paymentView)
+ |> List.map (paymentLine model loggedView)
-paymentLine : Model -> PaymentView -> PaymentWithId -> Html
-paymentLine model paymentView (id, payment) =
+paymentLine : Model -> LoggedView -> PaymentWithId -> Html
+paymentLine model loggedView (id, payment) =
a
- [ class ("row " ++ (if paymentView.edition == Just id then "edition" else ""))
+ [ class ("row " ++ (if loggedView.edition == Just id then "edition" else ""))
, onClick actions.address (UpdatePayment (ToggleEdit id))
]
[ div [ class "cell category" ] [ text payment.name ]
@@ -59,7 +59,7 @@ paymentLine model paymentView (id, payment) =
, div
[ class "cell user" ]
[ payment.userId
- |> getUserName paymentView.users
+ |> getUserName loggedView.users
|> Maybe.withDefault "−"
|> text
]
@@ -72,11 +72,11 @@ paymentLine model paymentView (id, payment) =
[ class "longDate" ]
[ text (renderLongDate payment.creation model.translations) ]
]
- , if paymentView.me == payment.userId
+ , if loggedView.me == payment.userId
then
div
[ class "cell remove"
- , onClick serverCommunications.address (SC.DeletePayment id payment.userId payment.cost paymentView.currentPage)
+ , onClick serverCommunications.address (SC.DeletePayment id payment.userId payment.cost loggedView.currentPage)
]
[ renderIcon "times" ]
else