From b0d80a5458d7ba4546e5f01f5b6398ea6d23f981 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 27 Mar 2016 21:59:46 +0200 Subject: Move view and models files --- src/client/elm/View/Date.elm | 59 ------------------------------------------ src/client/elm/View/Expand.elm | 25 ------------------ src/client/elm/View/Price.elm | 38 --------------------------- 3 files changed, 122 deletions(-) delete mode 100644 src/client/elm/View/Date.elm delete mode 100644 src/client/elm/View/Expand.elm delete mode 100644 src/client/elm/View/Price.elm (limited to 'src/client/elm/View') diff --git a/src/client/elm/View/Date.elm b/src/client/elm/View/Date.elm deleted file mode 100644 index 81c5112..0000000 --- a/src/client/elm/View/Date.elm +++ /dev/null @@ -1,59 +0,0 @@ -module View.Date - ( renderShortDate - , renderLongDate - ) where - -import Date exposing (..) -import String - -import Model.Translations exposing (..) - -renderShortDate : Date -> Translations -> String -renderShortDate date translations = - let params = - [ String.pad 2 '0' (toString (Date.day date)) - , String.pad 2 '0' (toString (getMonthNumber (Date.month date))) - , toString (Date.year date) - ] - in getParamMessage params "ShortDate" translations - -renderLongDate : Date -> Translations -> String -renderLongDate date translations = - let params = - [ toString (Date.day date) - , (getMessage (getMonthKey (Date.month date)) translations) - , toString (Date.year date) - ] - in getParamMessage params "LongDate" translations - -getMonthNumber : Month -> Int -getMonthNumber month = - case month of - Jan -> 1 - Feb -> 2 - Mar -> 3 - Apr -> 4 - May -> 5 - Jun -> 6 - Jul -> 7 - Aug -> 8 - Sep -> 9 - Oct -> 10 - Nov -> 11 - Dec -> 12 - -getMonthKey : Month -> String -getMonthKey month = - case month of - Jan -> "January" - Feb -> "February" - Mar -> "March" - Apr -> "April" - May -> "May" - Jun -> "June" - Jul -> "July" - Aug -> "August" - Sep -> "September" - Oct -> "October" - Nov -> "November" - Dec -> "December" diff --git a/src/client/elm/View/Expand.elm b/src/client/elm/View/Expand.elm deleted file mode 100644 index 53b4fe5..0000000 --- a/src/client/elm/View/Expand.elm +++ /dev/null @@ -1,25 +0,0 @@ -module View.Expand - ( expand - , ExpandType(..) - ) where - -import Html exposing (..) -import Html.Attributes exposing (..) - -import View.Icon exposing (renderIcon) - -type ExpandType = ExpandUp | ExpandDown - -expand : ExpandType -> Bool -> Html -expand expandType isExpanded = - div - [ class "expand" ] - [ renderIcon (chevronIcon expandType isExpanded) ] - -chevronIcon : ExpandType -> Bool -> String -chevronIcon expandType isExpanded = - case (expandType, isExpanded) of - (ExpandUp, True) -> "chevron-down" - (ExpandUp, False) -> "chevron-up" - (ExpandDown, True) -> "chevron-up" - (ExpandDown, False) -> "chevron-down" diff --git a/src/client/elm/View/Price.elm b/src/client/elm/View/Price.elm deleted file mode 100644 index be665a8..0000000 --- a/src/client/elm/View/Price.elm +++ /dev/null @@ -1,38 +0,0 @@ -module View.Price - ( price - ) where - -import String exposing (..) - -import Model exposing (Model) -import Model.Translations exposing (getMessage) - -price : Model -> Int -> String -price model amount = - ( formatInt amount - ++ " " - ++ model.conf.currency - ) - -formatInt : Int -> String -formatInt n = - abs n - |> toString - |> toList - |> List.reverse - |> group 3 - |> List.intersperse [' '] - |> List.concat - |> List.reverse - |> fromList - |> append (if n < 0 then "-" else "") - -group : Int -> List a -> List (List a) -group n xs = - if List.length xs <= n - then - [xs] - else - let take = List.take n xs - drop = List.drop n xs - in take :: (group n drop) -- cgit v1.2.3