diff options
author | Daniel Gnoutcheff <gnoutchd@softwarefreedom.org> | 2016-05-27 16:00:00 -0400 |
---|---|---|
committer | Daniel Gnoutcheff <gnoutchd@softwarefreedom.org> | 2018-09-26 18:11:11 -0400 |
commit | a1a17acb326020f1b57f587230cb439e901784df (patch) | |
tree | 358a1ea916a242609a981ff46e2a6814a2208cec /Handler/Journal.hs | |
parent | f1a294e5ddb8ae0ccdcef1a12561e603ff996cfe (diff) |
Ported to Debian jessie
Most of the churn here comes from rebasing the Yesod boilerplate.
Diffstat (limited to 'Handler/Journal.hs')
-rw-r--r-- | Handler/Journal.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Handler/Journal.hs b/Handler/Journal.hs index dc68fa5..aa9d18c 100644 --- a/Handler/Journal.hs +++ b/Handler/Journal.hs @@ -25,19 +25,15 @@ import qualified Data.Map as Map typeCsv :: ContentType typeCsv = "text/csv; charset=utf-8" -newtype RepCsv = RepCsv Content -instance HasReps RepCsv where - chooseRep (RepCsv c) _ = return (typeCsv, c) - -getJournalR :: JReportType -> Text -> Handler RepCsv +getJournalR :: JReportType -> Text -> Handler TypedContent getJournalR jrt ledger = do ledgers <- fmap hledgerConfig getYesod case Map.lookup ledger ledgers of Nothing -> notFound Just fn -> do csv <- liftIO $ (jReport jrt) fn - setHeader "Content-Disposition" (T.concat ["attachment; filename=", ledger, "-", (T.pack . show) jrt, ".csv"]) - return $ RepCsv $ toContent csv + addHeader "Content-Disposition" (T.concat ["attachment; filename=", ledger, "-", (T.pack . show) jrt, ".csv"]) + sendResponse (typeCsv, toContent csv) where jReport PandL = pAndL jReport Assets = assets |