ui: at depth 0 call account "All" (and fix register)

This commit is contained in:
Simon Michael 2016-06-12 10:55:43 -07:00
parent aa871c8074
commit d4343f8de1
4 changed files with 14 additions and 4 deletions

View File

@ -86,7 +86,7 @@ asInit d reset ui@UIState{
displayitem ((fullacct, shortacct, indent), bal) = displayitem ((fullacct, shortacct, indent), bal) =
AccountsScreenItem{asItemIndentLevel = indent AccountsScreenItem{asItemIndentLevel = indent
,asItemAccountName = fullacct ,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 ,asItemRenderedAmounts = map showAmountWithoutPrice amts -- like showMixedAmountOneLineWithoutPrice
} }
where where

View File

@ -44,7 +44,7 @@ registerScreen = RegisterScreen{
,rsAccount = "" ,rsAccount = ""
} }
rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=a} rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=replaceHiddenAccountsNameWith "*" a}
rsSetAccount _ scr = scr rsSetAccount _ scr = scr
rsInit :: Day -> Bool -> UIState -> UIState rsInit :: Day -> Bool -> UIState -> UIState
@ -107,7 +107,7 @@ rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
-- Minibuffer e -> [minibuffer e, maincontent] -- Minibuffer e -> [minibuffer e, maincontent]
_ -> [maincontent] _ -> [maincontent]
where where
toplabel = withAttr ("border" <> "bold") (str $ T.unpack rsAccount) toplabel = withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount)
<+> togglefilters <+> togglefilters
<+> str " transactions" <+> str " transactions"
<+> borderQueryStr (query_ ropts) <+> borderQueryStr (query_ ropts)

View File

@ -66,7 +66,7 @@ tsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
<+> str (" of "++show (length nts)) <+> str (" of "++show (length nts))
<+> togglefilters <+> togglefilters
<+> borderQueryStr (query_ ropts) <+> borderQueryStr (query_ ropts)
<+> str (" in "++T.unpack acct++")") <+> str (" in "++T.unpack (replaceHiddenAccountsNameWith "All" acct)++")")
togglefilters = togglefilters =
case concat [ case concat [
if cleared_ ropts then ["cleared"] else [] if cleared_ ropts then ["cleared"] else []

View File

@ -104,6 +104,16 @@ borderKeysStr keydescs =
-- sep = str " | " -- sep = str " | "
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 -- generic
topBottomBorderWithLabel :: Widget -> Widget -> Widget topBottomBorderWithLabel :: Widget -> Widget -> Widget