From 3ee25953f4a14018c73c2bf2acc13291106593ca Mon Sep 17 00:00:00 2001 From: Saku Laesvuori Date: Thu, 22 Jan 2026 21:40:33 +0200 Subject: [PATCH] Filter by code by clicking on it --- hledger-web/Hledger/Web/Handler/JournalR.hs | 4 +++- hledger-web/static/hledger.css | 4 ++-- hledger-web/templates/journal.hamlet | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hledger-web/Hledger/Web/Handler/JournalR.hs b/hledger-web/Hledger/Web/Handler/JournalR.hs index 024cc367e..7bfaa3b5e 100644 --- a/hledger-web/Hledger/Web/Handler/JournalR.hs +++ b/hledger-web/Hledger/Web/Handler/JournalR.hs @@ -45,7 +45,9 @@ getJournalR = do escape c | c `elem` (".[$^()|*+?{\\" :: [Char]) = ['\\', c] | otherwise = [c] - addTagQuery name value = (JournalR, [("q", qparam <> " \"tag:" <> escapeRegex name <> (if T.null value then "" else "=" <> escapeRegex value) <> "\"")]) -- XXX:is there no way to escape quotes + -- XXX:is there no way to escape quotes in queries + addTagQuery name value = (JournalR, [("q", qparam <> " \"tag:" <> escapeRegex name <> (if T.null value then "" else "=" <> escapeRegex value) <> "\"")]) + addCodeQuery code = (JournalR, [("q", qparam <> " \"code:" <> escapeRegex code <> "\"")]) defaultLayout $ do setTitle "päiväkirja - hledger-web" diff --git a/hledger-web/static/hledger.css b/hledger-web/static/hledger.css index b9f2b564f..c8c5c77d7 100644 --- a/hledger-web/static/hledger.css +++ b/hledger-web/static/hledger.css @@ -191,11 +191,11 @@ ul { max-width: 10em; } -.tag-name a { +.tag-name a, .transaction-code a { color: inherit; } -.tag-name a:hover { +.tag-name a:hover, .transaction-code a { text-decoration: underline dotted; } diff --git a/hledger-web/templates/journal.hamlet b/hledger-web/templates/journal.hamlet index c8f022a2e..40970341a 100644 --- a/hledger-web/templates/journal.hamlet +++ b/hledger-web/templates/journal.hamlet @@ -25,7 +25,8 @@ $if elem AddPermission perms
$if not $ T.null $ tcode torig
- (#{tcode torig}) + + (#{tcode torig}) $if not $ T.null $ T.strip payee #{payee}