diff --git a/Handler/Buy.hs b/Handler/Buy.hs index f7ff726..c3021b8 100644 --- a/Handler/Buy.hs +++ b/Handler/Buy.hs @@ -10,6 +10,7 @@ getBuyR uId bId = do mTup <- checkData uId bId case mTup of Just (user, bev) -> do + master <- getYesod (buyWidget, enctype) <- generateFormPost buyForm defaultLayout $ do $(widgetFile "buy") @@ -49,6 +50,7 @@ getBuyCashR bId = do mBev <- runDB $ get bId case mBev of Just bev -> do + master <- getYesod (buyCashWidget, enctype) <- generateFormPost buyForm defaultLayout $ do $(widgetFile "buyCash") diff --git a/Handler/Select.hs b/Handler/Select.hs index 4cbe03d..e1a81ed 100644 --- a/Handler/Select.hs +++ b/Handler/Select.hs @@ -10,6 +10,7 @@ getSelectR uId = do mUser <- runDB $ get uId case mUser of Just user -> do + master <- getYesod beverages <- runDB $ selectList [BeverageAmount >=. 0] [Desc BeverageIdent] defaultLayout $ do $(widgetFile "select") diff --git a/Handler/Summary.hs b/Handler/Summary.hs index 04493e9..8ddee2b 100644 --- a/Handler/Summary.hs +++ b/Handler/Summary.hs @@ -5,6 +5,7 @@ import Data.List as L getSummaryR :: Handler Html getSummaryR = do + master <- getYesod bevs <- runDB $ selectList [] [Asc BeverageIdent] defaultLayout $ do $(widgetFile "summary") diff --git a/Settings.hs b/Settings.hs index 6114f04..15e8673 100644 --- a/Settings.hs +++ b/Settings.hs @@ -54,6 +54,7 @@ data AppSettings = AppSettings -- ^ Google Analytics code , appEmail :: Text -- ^ notification address + , appCurrency :: Text } instance FromJSON AppSettings where @@ -80,6 +81,7 @@ instance FromJSON AppSettings where -- appCopyright <- o .: "copyright" appAnalytics <- o .:? "analytics" appEmail <- o .: "email" + appCurrency <- o .: "currency" return AppSettings {..} diff --git a/config/settings.yml b/config/settings.yml index be02d79..6614319 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -27,3 +27,4 @@ database: #analytics: UA-YOURCODE email: "nek0@momen" +currency: "€" diff --git a/templates/buy.hamlet b/templates/buy.hamlet index c9f7218..288a787 100644 --- a/templates/buy.hamlet +++ b/templates/buy.hamlet @@ -3,7 +3,7 @@ $doctype 5

Kauf von #{beverageIdent bev}

- Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev)) / 100)} + Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev)) / 100)} #{appCurrency $ appSettings master}

^{buyWidget} diff --git a/templates/buyCash.hamlet b/templates/buyCash.hamlet index 5282a03..d42e5a7 100644 --- a/templates/buyCash.hamlet +++ b/templates/buyCash.hamlet @@ -3,7 +3,7 @@ $doctype 5

Kauf von #{beverageIdent bev}

- Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev + 50)) / 100)} + Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev + 50)) / 100)} #{appCurrency $ appSettings master} ^{buyCashWidget} diff --git a/templates/select.hamlet b/templates/select.hamlet index ede8fc3..c65cbdf 100644 --- a/templates/select.hamlet +++ b/templates/select.hamlet @@ -3,7 +3,7 @@ $doctype 5