web: expand postings on journal register by default, p parameter of 1 or 0 overrides
A toggle all link in the column heading is commented out as it's too slow.
This commit is contained in:
parent
1d0f14e55e
commit
f28fbb4870
@ -15,6 +15,7 @@ $(document).ready(function() {
|
|||||||
/* set up various show/hide toggles */
|
/* set up various show/hide toggles */
|
||||||
$('#search-help-link').click(function() { $('#search-help').slideToggle('fast'); event.preventDefault(); });
|
$('#search-help-link').click(function() { $('#search-help').slideToggle('fast'); event.preventDefault(); });
|
||||||
$('#accounts-toggle-link').click(function() { $('#accounts').slideToggle('fast'); event.preventDefault(); });
|
$('#accounts-toggle-link').click(function() { $('#accounts').slideToggle('fast'); event.preventDefault(); });
|
||||||
|
$('#all-postings-toggle-link').click(function() { $('.posting').toggle(); event.preventDefault(); });
|
||||||
$('.postings-toggle-link').click(function() { $(this).parent().parent().nextUntil(':not(.posting)').toggle(); event.preventDefault(); });
|
$('.postings-toggle-link').click(function() { $(this).parent().parent().nextUntil(':not(.posting)').toggle(); event.preventDefault(); });
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -108,11 +108,12 @@ table.journalreport { border-spacing: 0; }
|
|||||||
.balancereport td { padding:0; }
|
.balancereport td { padding:0; }
|
||||||
.totalrule td { border-top:thin solid black; }
|
.totalrule td { border-top:thin solid black; }
|
||||||
|
|
||||||
|
.hidden { display:none; }
|
||||||
table.registerreport { border-spacing:0; }
|
table.registerreport { border-spacing:0; }
|
||||||
table.registerreport tr { vertical-align:top; }
|
table.registerreport tr { vertical-align:top; }
|
||||||
table.registerreport td { padding-bottom:0.2em; }
|
table.registerreport td { padding-bottom:0.2em; }
|
||||||
table.registerreport .date { white-space:nowrap; }
|
table.registerreport .date { white-space:nowrap; }
|
||||||
table.registerreport tr.posting { display:none; font-size:smaller; }
|
table.registerreport tr.posting { font-size:smaller; }
|
||||||
table.registerreport tr.posting .account { padding-left:1.5em; }
|
table.registerreport tr.posting .account { padding-left:1.5em; }
|
||||||
table.registerreport tr.posting .amount { padding-right:0.5em; }
|
table.registerreport tr.posting .amount { padding-right:0.5em; }
|
||||||
tr.firstposting td { }
|
tr.firstposting td { }
|
||||||
|
|||||||
@ -2,7 +2,10 @@
|
|||||||
<tr.headings
|
<tr.headings
|
||||||
<th.date align=left>Date
|
<th.date align=left>Date
|
||||||
<th.description align=left>Description
|
<th.description align=left>Description
|
||||||
<th.account align=left>Account
|
<th.account align=left>
|
||||||
|
Account
|
||||||
|
<!-- \ #
|
||||||
|
<a#all-postings-toggle-link.togglelink href="#" title="Toggle all split postings">[+/-] -->
|
||||||
<th.amount align=right>Amount
|
<th.amount align=right>Amount
|
||||||
<th.balance align=right>#{balancelabel}
|
<th.balance align=right>#{balancelabel}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<td.balance align=right>#{mixedAmountAsHtml bal}
|
<td.balance align=right>#{mixedAmountAsHtml bal}
|
||||||
$if split
|
$if split
|
||||||
$forall p <- tpostings t'
|
$forall p <- tpostings t'
|
||||||
<tr.item.#{evenodd}.posting
|
<tr.item.#{evenodd}.posting.#{displayclass}
|
||||||
<td.date
|
<td.date
|
||||||
<td.description
|
<td.description
|
||||||
<td.account> <a href="@?{accountUrl here $ paccount p}" title="#{stringIfLongerThan 40 $ paccount p}">#{elideRight 40 $ paccount p}
|
<td.account> <a href="@?{accountUrl here $ paccount p}" title="#{stringIfLongerThan 40 $ paccount p}">#{elideRight 40 $ paccount p}
|
||||||
|
|||||||
@ -166,7 +166,7 @@ accountRegisterReportAsHtml :: [Opt] -> ViewData -> AccountRegisterReport -> Ham
|
|||||||
accountRegisterReportAsHtml _ vd (balancelabel,items) = $(Settings.hamletFile "accountregisterreport")
|
accountRegisterReportAsHtml _ vd (balancelabel,items) = $(Settings.hamletFile "accountregisterreport")
|
||||||
where
|
where
|
||||||
itemAsHtml :: ViewData -> (Int, Bool, Bool, Bool, AccountRegisterReportItem) -> Hamlet AppRoute
|
itemAsHtml :: ViewData -> (Int, Bool, Bool, Bool, AccountRegisterReportItem) -> Hamlet AppRoute
|
||||||
itemAsHtml VD{here=here} (n, newd, newm, newy, (t, t', split, acct, amt, bal)) = $(Settings.hamletFile "accountregisterreportitem")
|
itemAsHtml VD{here=here,p=p} (n, newd, newm, newy, (t, t', split, acct, amt, bal)) = $(Settings.hamletFile "accountregisterreportitem")
|
||||||
where
|
where
|
||||||
evenodd = if even n then "even" else "odd" :: String
|
evenodd = if even n then "even" else "odd" :: String
|
||||||
datetransition | newm = "newmonth"
|
datetransition | newm = "newmonth"
|
||||||
@ -175,6 +175,7 @@ accountRegisterReportAsHtml _ vd (balancelabel,items) = $(Settings.hamletFile "a
|
|||||||
(firstposting, date, desc) = (False, show $ tdate t, tdescription t)
|
(firstposting, date, desc) = (False, show $ tdate t, tdescription t)
|
||||||
acctquery = (here, [("q", pack $ accountQuery acct)])
|
acctquery = (here, [("q", pack $ accountQuery acct)])
|
||||||
showamt = not split || not (isZeroMixedAmount amt)
|
showamt = not split || not (isZeroMixedAmount amt)
|
||||||
|
displayclass = if p then "" else "hidden" :: String
|
||||||
|
|
||||||
stringIfLongerThan :: Int -> String -> String
|
stringIfLongerThan :: Int -> String -> String
|
||||||
stringIfLongerThan n s = if length s > n then s else ""
|
stringIfLongerThan n s = if length s > n then s else ""
|
||||||
@ -416,7 +417,8 @@ nulltemplate = [$hamlet||]
|
|||||||
-- | A bundle of data useful for handlers and their templates.
|
-- | A bundle of data useful for handlers and their templates.
|
||||||
data ViewData = VD {
|
data ViewData = VD {
|
||||||
opts :: [Opt] -- ^ command-line options at startup
|
opts :: [Opt] -- ^ command-line options at startup
|
||||||
,q :: String -- ^ current q parameter (the query expression for filtering transactions)
|
,q :: String -- ^ current q parameter, the query expression
|
||||||
|
,p :: Bool -- ^ current p parameter, 1 or 0 shows/hides all postings, default is based on query
|
||||||
,m :: Matcher -- ^ a matcher parsed from the query expr
|
,m :: Matcher -- ^ a matcher parsed from the query expr
|
||||||
,qopts :: [QueryOpt] -- ^ query options parsed from the query expr
|
,qopts :: [QueryOpt] -- ^ query options parsed from the query expr
|
||||||
,j :: Journal -- ^ the up-to-date parsed unfiltered journal
|
,j :: Journal -- ^ the up-to-date parsed unfiltered journal
|
||||||
@ -429,6 +431,7 @@ mkvd :: ViewData
|
|||||||
mkvd = VD {
|
mkvd = VD {
|
||||||
opts = []
|
opts = []
|
||||||
,q = ""
|
,q = ""
|
||||||
|
,p = False
|
||||||
,m = MatchAny
|
,m = MatchAny
|
||||||
,qopts = []
|
,qopts = []
|
||||||
,j = nulljournal
|
,j = nulljournal
|
||||||
@ -448,7 +451,11 @@ getViewData = do
|
|||||||
today <- liftIO getCurrentDay
|
today <- liftIO getCurrentDay
|
||||||
q <- getParameter "q"
|
q <- getParameter "q"
|
||||||
let (m,qopts) = parseQuery today q
|
let (m,qopts) = parseQuery today q
|
||||||
return mkvd{opts=opts, q=q, m=m, qopts=qopts, j=j, today=today, here=here', msg=msg}
|
p <- getParameter "p"
|
||||||
|
let p' | p == "1" = True
|
||||||
|
| p == "0" = False
|
||||||
|
| otherwise = isNothing $ inAccountMatcher qopts
|
||||||
|
return mkvd{opts=opts, q=q, p=p', m=m, qopts=qopts, j=j, today=today, here=here', msg=msg}
|
||||||
where
|
where
|
||||||
-- | Update our copy of the journal if the file changed. If there is an
|
-- | Update our copy of the journal if the file changed. If there is an
|
||||||
-- error while reloading, keep the old one and return the error, and set a
|
-- error while reloading, keep the old one and return the error, and set a
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user