mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 20:02:27 +03:00
;web: maintain queries in all other links, too
This commit is contained in:
parent
ec27eb6b17
commit
ebe021b0c8
@ -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
|
||||
|
||||
|
@ -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 .
|
||||
|
@ -15,6 +15,8 @@ module Hledger.Web.Widget.Common
|
||||
, writeJournalTextIfValidAndChanged
|
||||
, journalFile404
|
||||
, transactionFragment
|
||||
, removeInacct
|
||||
, replaceInacct
|
||||
) where
|
||||
|
||||
import Data.Default (def)
|
||||
|
@ -21,7 +21,7 @@
|
||||
$forall (torig, tacct, split, _acct, amt, bal) <- items
|
||||
<tr ##{tindex torig} title="#{showTransaction torig}" style="vertical-align:top;">
|
||||
<td .date>
|
||||
<a href="@{JournalR}##{transactionFrag torig}">
|
||||
<a href="@?{(JournalR, [("q", T.unwords $ removeInacct q)])}##{transactionFrag torig}">
|
||||
#{show (tdate tacct)}
|
||||
<td>
|
||||
#{textElideRight 30 (tdescription tacct)}
|
||||
|
Loading…
Reference in New Issue
Block a user