diff --git a/hledger-web/Hledger/Web/Handler/JournalR.hs b/hledger-web/Hledger/Web/Handler/JournalR.hs index 8ae91c26f..ce62aa568 100644 --- a/hledger-web/Hledger/Web/Handler/JournalR.hs +++ b/hledger-web/Hledger/Web/Handler/JournalR.hs @@ -13,19 +13,20 @@ import Hledger.Web.Import import Hledger.Web.WebOptions import Hledger.Web.Widget.AddForm (addModal) import Hledger.Web.Widget.Common - (accountQuery, mixedAmountAsHtml, transactionFragment) + (accountQuery, mixedAmountAsHtml, + transactionFragment, replaceInacct) -- | The formatted journal view, with sidebar. getJournalR :: Handler Html getJournalR = do checkServerSideUiEnabled - VD{caps, j, m, opts, qopts, today} <- getViewData + VD{caps, j, m, opts, q, qopts, today} <- getViewData when (CapView `notElem` caps) (permissionDenied "Missing the 'view' capability") let title = case inAccount qopts of Nothing -> "General Journal" Just (a, inclsubs) -> "Transactions in " <> a <> if inclsubs then "" else " (excluding subaccounts)" title' = title <> if m /= Any then ", filtered" else "" - acctlink a = (RegisterR, [("q", accountQuery a)]) + acctlink a = (RegisterR, [("q", replaceInacct q $ accountQuery a)]) (_, items) = transactionsReport (reportopts_ $ cliopts_ opts) j m transactionFrag = transactionFragment j diff --git a/hledger-web/Hledger/Web/Handler/RegisterR.hs b/hledger-web/Hledger/Web/Handler/RegisterR.hs index 18394f1fe..17c8d52a3 100644 --- a/hledger-web/Hledger/Web/Handler/RegisterR.hs +++ b/hledger-web/Hledger/Web/Handler/RegisterR.hs @@ -18,13 +18,14 @@ import Hledger.Web.Import import Hledger.Web.WebOptions import Hledger.Web.Widget.AddForm (addModal) import Hledger.Web.Widget.Common - (accountQuery, mixedAmountAsHtml, transactionFragment) + (accountQuery, mixedAmountAsHtml, + transactionFragment, removeInacct, replaceInacct) -- | The main journal/account register view, with accounts sidebar. getRegisterR :: Handler Html getRegisterR = do checkServerSideUiEnabled - VD{caps, j, m, opts, qopts, today} <- getViewData + VD{caps, j, m, opts, q, qopts, today} <- getViewData when (CapView `notElem` caps) (permissionDenied "Missing the 'view' capability") let (a,inclsubs) = fromMaybe ("all accounts",True) $ inAccount qopts @@ -34,7 +35,7 @@ getRegisterR = do let ropts = reportopts_ (cliopts_ opts) acctQuery = fromMaybe Any (inAccountQuery qopts) - acctlink acc = (RegisterR, [("q", accountQuery acc)]) + acctlink acc = (RegisterR, [("q", replaceInacct q $ accountQuery acc)]) otherTransAccounts = map (\(acct,(name,comma)) -> (acct, (T.pack name, T.pack comma))) . undecorateLinks . elideRightDecorated 40 . decorateLinks . diff --git a/hledger-web/Hledger/Web/Widget/Common.hs b/hledger-web/Hledger/Web/Widget/Common.hs index 43d4f189e..d09e92860 100644 --- a/hledger-web/Hledger/Web/Widget/Common.hs +++ b/hledger-web/Hledger/Web/Widget/Common.hs @@ -15,6 +15,8 @@ module Hledger.Web.Widget.Common , writeJournalTextIfValidAndChanged , journalFile404 , transactionFragment + , removeInacct + , replaceInacct ) where import Data.Default (def) diff --git a/hledger-web/templates/register.hamlet b/hledger-web/templates/register.hamlet index addfcca5c..ba978c429 100644 --- a/hledger-web/templates/register.hamlet +++ b/hledger-web/templates/register.hamlet @@ -21,7 +21,7 @@ $forall (torig, tacct, split, _acct, amt, bal) <- items - + #{show (tdate tacct)} #{textElideRight 30 (tdescription tacct)}