mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 02:08:01 +03:00
ui: at depth 0 call account "All" (and fix register)
This commit is contained in:
parent
aa871c8074
commit
d4343f8de1
@ -86,7 +86,7 @@ asInit d reset ui@UIState{
|
||||
displayitem ((fullacct, shortacct, indent), bal) =
|
||||
AccountsScreenItem{asItemIndentLevel = indent
|
||||
,asItemAccountName = fullacct
|
||||
,asItemDisplayAccountName = if flat_ ropts' then fullacct else shortacct
|
||||
,asItemDisplayAccountName = replaceHiddenAccountsNameWith "All" $ if flat_ ropts' then fullacct else shortacct
|
||||
,asItemRenderedAmounts = map showAmountWithoutPrice amts -- like showMixedAmountOneLineWithoutPrice
|
||||
}
|
||||
where
|
||||
|
@ -44,7 +44,7 @@ registerScreen = RegisterScreen{
|
||||
,rsAccount = ""
|
||||
}
|
||||
|
||||
rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=a}
|
||||
rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=replaceHiddenAccountsNameWith "*" a}
|
||||
rsSetAccount _ scr = scr
|
||||
|
||||
rsInit :: Day -> Bool -> UIState -> UIState
|
||||
@ -107,7 +107,7 @@ rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
-- Minibuffer e -> [minibuffer e, maincontent]
|
||||
_ -> [maincontent]
|
||||
where
|
||||
toplabel = withAttr ("border" <> "bold") (str $ T.unpack rsAccount)
|
||||
toplabel = withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount)
|
||||
<+> togglefilters
|
||||
<+> str " transactions"
|
||||
<+> borderQueryStr (query_ ropts)
|
||||
|
@ -66,7 +66,7 @@ tsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
<+> str (" of "++show (length nts))
|
||||
<+> togglefilters
|
||||
<+> borderQueryStr (query_ ropts)
|
||||
<+> str (" in "++T.unpack acct++")")
|
||||
<+> str (" in "++T.unpack (replaceHiddenAccountsNameWith "All" acct)++")")
|
||||
togglefilters =
|
||||
case concat [
|
||||
if cleared_ ropts then ["cleared"] else []
|
||||
|
@ -104,6 +104,16 @@ borderKeysStr keydescs =
|
||||
-- sep = str " | "
|
||||
sep = str " "
|
||||
|
||||
-- temporary shenanigans:
|
||||
|
||||
-- | Convert the special account name "*" (from balance report with depth limit 0) to something clearer.
|
||||
replaceHiddenAccountsNameWith :: AccountName -> AccountName -> AccountName
|
||||
replaceHiddenAccountsNameWith anew a | a == hiddenAccountsName = anew
|
||||
| a == "*" = anew
|
||||
| otherwise = a
|
||||
|
||||
hiddenAccountsName = "..." -- for now
|
||||
|
||||
-- generic
|
||||
|
||||
topBottomBorderWithLabel :: Widget -> Widget -> Widget
|
||||
|
Loading…
Reference in New Issue
Block a user