Display posting tags in hledger-web

This commit is contained in:
Saku Laesvuori 2026-01-16 11:48:59 +02:00
parent e5ac735110
commit 10c71cb447
3 changed files with 18 additions and 7 deletions

View File

@ -33,6 +33,7 @@ getJournalR = do
entriesReport rspec j entriesReport rspec j
transactionFrag = transactionFragment j transactionFrag = transactionFragment j
isVisibleTag = not . isHiddenTagName . fst isVisibleTag = not . isHiddenTagName . fst
isPostingTag account tag = not $ tag `elem` journalInheritedAccountTags j account
defaultLayout $ do defaultLayout $ do
setTitle "päiväkirja - hledger-web" setTitle "päiväkirja - hledger-web"

View File

@ -214,7 +214,7 @@ ul {
padding-left: 2em; padding-left: 2em;
} }
.transaction .posting { .transaction .posting-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }

View File

@ -26,13 +26,23 @@ $if elem AddPermission perms
#{tagValue} #{tagValue}
<ul .postings> <ul .postings>
$forall Posting { paccount = acc, pamount = amt } <- tpostings torig $forall Posting { paccount = acc, pamount = amt, ptags = tags } <- tpostings torig
<li .posting> <li .posting>
<div .account> <div .posting-row>
<a href="@?{acctlink acc}##{tindex torig}" title="#{acc}"> <div .account>
#{elideAccountName 40 acc} <a href="@?{acctlink acc}##{tindex torig}" title="#{acc}">
<div .amount style="text-align:right;"> #{elideAccountName 40 acc}
^{mixedAmountAsHtml amt} <div .amount style="text-align:right;">
^{mixedAmountAsHtml amt}
$if null $ filter (isPostingTag acc) $ filter isVisibleTag tags
$else
<ul .tags>
$forall (tagName, tagValue) <- filter (isPostingTag acc) $ filter isVisibleTag tags
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
<div .tag-name>
#{tagName}
<div .tag-value>
#{tagValue}
$if elem AddPermission perms $if elem AddPermission perms
^{addModal AddR j today} ^{addModal AddR j today}