From 6496c1ef616f42b9747885ad0f46d8f02acf4886 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 7 Aug 2011 16:24:09 +0000 Subject: [PATCH] raw journal report -> journal entries report --- hledger-vty/Hledger/Vty/Main.hs | 2 +- hledger-web/Handlers.hs | 22 +++++++++++----------- hledger-web/routes | 20 ++++++++++---------- hledger/Hledger/Cli/Print.hs | 6 +++--- hledger/Hledger/Cli/Reports.hs | 24 ++++++++++++------------ 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/hledger-vty/Hledger/Vty/Main.hs b/hledger-vty/Hledger/Vty/Main.hs index 09effba80..46ed0d8b4 100644 --- a/hledger-vty/Hledger/Vty/Main.hs +++ b/hledger-vty/Hledger/Vty/Main.hs @@ -85,7 +85,7 @@ data Loc = Loc { data Screen = BalanceScreen -- ^ like hledger balance, shows accounts | RegisterScreen -- ^ like hledger register, shows transaction-postings | PrintScreen -- ^ like hledger print, shows journal transactions - -- | LedgerScreen -- ^ shows the raw journal + -- | LedgerScreen -- ^ shows the raw journal entries deriving (Eq,Show) -- | Run the vty (curses-style) ui. diff --git a/hledger-web/Handlers.hs b/hledger-web/Handlers.hs index c87508376..78e66fdd4 100644 --- a/hledger-web/Handlers.hs +++ b/hledger-web/Handlers.hs @@ -87,14 +87,14 @@ getJournalEditR = do setTitle "hledger-web journal edit form" addHamlet $ editform vd --- | The raw journal view, with sidebar. -getJournalRawR :: Handler RepHtml -getJournalRawR = do +-- | The journal entries view, with sidebar. +getJournalEntriesR :: Handler RepHtml +getJournalEntriesR = do vd@VD{..} <- getViewData let sidecontent = sidebar vd title = "Journal entries" ++ if m /= MatchAny then ", filtered" else "" :: String - maincontent = rawJournalReportAsHtml opts vd $ rawJournalReport opts nullfilterspec $ filterJournalTransactions2 m j + maincontent = entriesReportAsHtml opts vd $ entriesReport opts nullfilterspec $ filterJournalTransactions2 m j defaultLayout $ do setTitle "hledger-web journal" addHamlet [$hamlet| @@ -112,13 +112,13 @@ getJournalRawR = do ^{importform} |] --- | The raw journal view, no sidebar. +-- | The journal entries view, no sidebar. getJournalOnlyR :: Handler RepHtml getJournalOnlyR = do vd@VD{..} <- getViewData defaultLayout $ do setTitle "hledger-web journal only" - addHamlet $ rawJournalReportAsHtml opts vd $ rawJournalReport opts nullfilterspec $ filterJournalTransactions2 m j + addHamlet $ entriesReportAsHtml opts vd $ entriesReport opts nullfilterspec $ filterJournalTransactions2 m j ---------------------------------------------------------------------- @@ -209,7 +209,7 @@ accountsReportAsHtml _ vd@VD{..} (items',total) = Journal raw + entries   edit   @@ -271,15 +271,15 @@ accountOnlyQuery a = "inacctonly:" ++ quoteIfSpaced a -- (accountNameToAccountRe -- accountUrl :: AppRoute -> AccountName -> (AppRoute,[(String,ByteString)]) accountUrl r a = (r, [("q",pack $ accountQuery a)]) --- | Render a "RawJournalReport" as HTML for the raw journal view. -rawJournalReportAsHtml :: [Opt] -> ViewData -> RawJournalReport -> Hamlet AppRoute -rawJournalReportAsHtml _ vd items = [$hamlet| +-- | Render a "EntriesReport" as HTML for the journal entries view. +entriesReportAsHtml :: [Opt] -> ViewData -> EntriesReport -> Hamlet AppRoute +entriesReportAsHtml _ vd items = [$hamlet| $forall i <- numbered items ^{itemAsHtml vd i} |] where - itemAsHtml :: ViewData -> (Int, RawJournalReportItem) -> Hamlet AppRoute + itemAsHtml :: ViewData -> (Int, EntriesReportItem) -> Hamlet AppRoute itemAsHtml _ (n, t) = [$hamlet| diff --git a/hledger-web/routes b/hledger-web/routes index 243d127b2..b07a36f97 100644 --- a/hledger-web/routes +++ b/hledger-web/routes @@ -1,10 +1,10 @@ -/static StaticR Static getStatic -/favicon.ico FaviconR GET -/robots.txt RobotsR GET -/ RootR GET -/journal JournalR GET POST -/journal/raw JournalRawR GET -/journal/edit JournalEditR GET -/register RegisterR GET -/accounts AccountsR GET -/api/accounts AccountsJsonR GET +/static StaticR Static getStatic +/favicon.ico FaviconR GET +/robots.txt RobotsR GET +/ RootR GET +/journal JournalR GET POST +/journal/entries JournalEntriesR GET +/journal/edit JournalEditR GET +/register RegisterR GET +/accounts AccountsR GET +/api/accounts AccountsJsonR GET diff --git a/hledger/Hledger/Cli/Print.hs b/hledger/Hledger/Cli/Print.hs index 2c7340dcf..52975d024 100644 --- a/hledger/Hledger/Cli/Print.hs +++ b/hledger/Hledger/Cli/Print.hs @@ -24,9 +24,9 @@ print' opts args j = do putStr $ showTransactions opts (optsToFilterSpec opts args d) j showTransactions :: [Opt] -> FilterSpec -> Journal -> String -showTransactions opts fspec j = rawJournalReportAsText opts fspec $ rawJournalReport opts fspec j +showTransactions opts fspec j = entriesReportAsText opts fspec $ entriesReport opts fspec j -rawJournalReportAsText :: [Opt] -> FilterSpec -> RawJournalReport -> String -rawJournalReportAsText opts _ items = concatMap (showTransactionForPrint effective) items +entriesReportAsText :: [Opt] -> FilterSpec -> EntriesReport -> String +entriesReportAsText opts _ items = concatMap (showTransactionForPrint effective) items where effective = Effective `elem` opts diff --git a/hledger/Hledger/Cli/Reports.hs b/hledger/Hledger/Cli/Reports.hs index 7f488ab4f..2dfebc1bc 100644 --- a/hledger/Hledger/Cli/Reports.hs +++ b/hledger/Hledger/Cli/Reports.hs @@ -9,10 +9,10 @@ on the command-line options, should move to hledger-lib later. -} module Hledger.Cli.Reports ( - -- * Raw journal report - RawJournalReport, - RawJournalReportItem, - rawJournalReport, + -- * Entries report + EntriesReport, + EntriesReportItem, + entriesReport, -- * Postings report PostingsReport, PostingsReportItem, @@ -53,15 +53,15 @@ import Hledger.Cli.Utils ------------------------------------------------------------------------------- --- | A raw journal report is a list of whole transactions used to generate --- a raw journal view. Used by eg hledger's print command and --- hledger-web's raw journal view. -type RawJournalReport = [RawJournalReportItem] -type RawJournalReportItem = Transaction +-- | A journal entries report is a list of whole transactions as +-- originally entered in the journal (mostly). Used by eg hledger's print +-- command and hledger-web's journal entries view. +type EntriesReport = [EntriesReportItem] +type EntriesReportItem = Transaction --- | Select transactions for a raw journal report. -rawJournalReport :: [Opt] -> FilterSpec -> Journal -> RawJournalReport -rawJournalReport opts fspec j = sortBy (comparing tdate) $ jtxns $ filterJournalTransactions fspec j' +-- | Select transactions for an entries report. +entriesReport :: [Opt] -> FilterSpec -> Journal -> EntriesReport +entriesReport opts fspec j = sortBy (comparing tdate) $ jtxns $ filterJournalTransactions fspec j' where j' = journalSelectingDateFromOpts opts $ journalSelectingAmountFromOpts opts j