From 0b6f0fa29075178b45cb17d2932003ab4b342280 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 6 Sep 2015 16:23:48 +0200 Subject: Use buttons or links when elements are clickable --- src/client/View/Payments/Add.elm | 11 ++++++----- src/client/View/Payments/Paging.elm | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/client/View') diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm index deffb95..f352f1f 100644 --- a/src/client/View/Payments/Add.elm +++ b/src/client/View/Payments/Add.elm @@ -28,8 +28,7 @@ import Utils.Either exposing (toMaybeError) addPayment : Model -> LoggedView -> Html addPayment model loggedView = H.form - [ class "add" - , case (validateName loggedView.add.name model.translations, validateCost loggedView.add.cost model.translations) of + [ case (validateName loggedView.add.name model.translations, validateCost loggedView.add.cost model.translations) of (Ok name, Ok cost) -> let action = case loggedView.add.frequency of @@ -43,7 +42,8 @@ addPayment model loggedView = , addPaymentCost model loggedView.add , paymentFrequency model loggedView.add , button - [ type' "submit" ] + [ type' "submit" + , class "add" ] [ text (getMessage "Add" model.translations)] ] @@ -91,8 +91,9 @@ addPaymentCost model addPayment = paymentFrequency : Model -> AddPayment -> Html paymentFrequency model addPayment = - div - [ class "frequency" + button + [ type' "button" + , class "frequency" , onClick actions.address (UpdateLoggedView << UpdateAdd <| ToggleFrequency) ] [ div diff --git a/src/client/View/Payments/Paging.elm b/src/client/View/Payments/Paging.elm index 53df3b3..b9a0109 100644 --- a/src/client/View/Payments/Paging.elm +++ b/src/client/View/Payments/Paging.elm @@ -27,7 +27,7 @@ paymentsPaging loggedView = then text "" else - ul + div [ class "pages" ] ( ( if loggedView.currentPage > 1 then [ firstPage, previousPage loggedView ] @@ -56,7 +56,7 @@ truncatePages currentPage pages = firstPage : Html firstPage = - li + button [ class "page" , onClick serverCommunications.address (SC.UpdatePage 1) ] @@ -64,7 +64,7 @@ firstPage = previousPage : LoggedView -> Html previousPage loggedView = - li + button [ class "page" , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage - 1)) ] @@ -72,7 +72,7 @@ previousPage loggedView = nextPage : LoggedView -> Html nextPage loggedView = - li + button [ class "page" , onClick serverCommunications.address (SC.UpdatePage (loggedView.currentPage + 1)) ] @@ -80,7 +80,7 @@ nextPage loggedView = lastPage : Int -> Html lastPage maxPage = - li + button [ class "page" , onClick serverCommunications.address (SC.UpdatePage maxPage) ] @@ -89,7 +89,7 @@ lastPage maxPage = paymentsPage : LoggedView -> Int -> Html paymentsPage loggedView page = let onCurrentPage = page == loggedView.currentPage - in li + in button [ class ("page" ++ (if onCurrentPage then " current" else "")) , onClick serverCommunications.address <| if onCurrentPage then SC.NoCommunication else SC.UpdatePage page -- cgit v1.2.3