web: tighter matching when clicking an account name

This commit is contained in:
Simon Michael 2010-07-28 00:43:47 +00:00
parent 0773dde872
commit 66b1ee9f11

View File

@ -394,7 +394,7 @@ editform _ content = [$hamlet|
%td %td
%span.help ^formathelp^ %span.help ^formathelp^
%td!align=right %td!align=right
%span.help Are you sure ? Your journal will be overwritten. $ %span.help Are you sure ? This will overwrite the journal. $
%input!type=hidden!name=edit!value=1 %input!type=hidden!name=edit!value=1
%input!type=submit!name=submit!value="save journal" %input!type=submit!name=submit!value="save journal"
\ or $ \ or $
@ -456,9 +456,12 @@ balanceReportAsHtml _ td (items,total) = [$hamlet|
|] where |] where
current = if not (null a) && containsRegex a acct then "current" else "" current = if not (null a) && containsRegex a acct then "current" else ""
indent = preEscapedString $ concat $ replicate (2 * adepth) " " indent = preEscapedString $ concat $ replicate (2 * adepth) " "
aurl = printf "../ledger?a=^%s%s" acct p' :: String aurl = printf "../ledger?a=%s%s" (accountMatchingRegex acct) p' :: String
p' = if null p then "" else printf "&p=%s" p p' = if null p then "" else printf "&p=%s" p
accountMatchingRegex :: String -> String
accountMatchingRegex = printf "^%s(:|$)"
---------------------------------------------------------------------- ----------------------------------------------------------------------
-- | A postings view, like hledger register. -- | A postings view, like hledger register.
@ -492,7 +495,7 @@ registerReportAsHtml _ td items = [$hamlet|
(firstposting, date, desc) = case ds of Just (da, de) -> ("firstposting", show da, de) (firstposting, date, desc) = case ds of Just (da, de) -> ("firstposting", show da, de)
Nothing -> ("", "", "") Nothing -> ("", "", "")
acct = paccount posting acct = paccount posting
aurl = printf "../ledger?a=^%s%s" acct p' :: String aurl = printf "../ledger?a=%s%s" (accountMatchingRegex acct) p' :: String
p' = if null p then "" else printf "&p=%s" p p' = if null p then "" else printf "&p=%s" p
--mixedAmountAsHtml = intercalate ", " . lines . show --mixedAmountAsHtml = intercalate ", " . lines . show