web: use transaction indexes instead of the date for html tag ids #308

This commit is contained in:
Thomas R. Koll 2015-12-18 08:35:37 +01:00
parent ac3db83e02
commit 5fbdae005b
3 changed files with 10 additions and 9 deletions

View File

@ -60,7 +60,7 @@ journalTransactionsReportAsHtml _ vd (_,items) = [hamlet|
-- .#{datetransition}
itemAsHtml :: ViewData -> (Int, Bool, Bool, Bool, TransactionsReportItem) -> HtmlUrl AppRoute
itemAsHtml VD{..} (n, _, _, _, (t, _, split, _, amt, _)) = [hamlet|
<tr ##{date} .item.#{evenodd}.#{firstposting} style="vertical-align:top;" title="#{show t}">
<tr ##{tindex t} .item.#{evenodd}.#{firstposting} style="vertical-align:top;" title="#{show t}">
<td.date>#{date}
<td.description colspan=2>#{elideRight 60 desc}
<td.amount style="text-align:right;">
@ -72,7 +72,7 @@ $forall p' <- tpostings t
<td.description>
<td.account>
&nbsp;
<a href="@?{acctlink (paccount p')}##{date}" title="#{paccount p'}">#{elideAccountName 40 $ paccount p'}
<a href="@?{acctlink (paccount p')}##{tindex t}" title="#{paccount p'}">#{elideAccountName 40 $ paccount p'}
<td.amount style="text-align:right;">#{mixedAmountAsHtml $ pamount p'}
<tr.#{evenodd}>
<td>&nbsp;

View File

@ -73,8 +73,9 @@ registerItemsHtml _ vd (balancelabel,items) = [hamlet|
itemAsHtml :: ViewData -> (Int, Bool, Bool, Bool, TransactionsReportItem) -> HtmlUrl AppRoute
itemAsHtml VD{..} (n, newd, newm, _, (torig, tacct, split, acct, amt, bal)) = [hamlet|
<tr ##{date} .item.#{evenodd}.#{firstposting}.#{datetransition} title="#{show torig}" style="vertical-align:top;">
<td.date><a href="@{JournalR}##{date}">#{date}
<tr ##{tindex torig} .item.#{evenodd}.#{firstposting}.#{datetransition} title="#{show torig}" style="vertical-align:top;">
<td.date>
<a href="@{JournalR}##{tindex torig}">#{date}
<td.description title="#{show torig}">#{elideRight 30 desc}
<td.account>#{elideRight 40 acct}
<td.amount style="text-align:right; white-space:nowrap;">
@ -119,7 +120,7 @@ registerChartHtml percommoditytxnreports =
$forall i <- reverse items
[
#{dayToJsTimestamp $ triDate i},
#{simpleMixedAmountQuantity $ triCommodityBalance c i},
#{simpleMixedAmountQuantity $ triCommodityBalance c i}
],
/* [] */
],
@ -145,6 +146,7 @@ registerChartHtml percommoditytxnreports =
'#{showMixedAmountWithZeroCommodity $ triCommodityAmount c i}',
'#{showMixedAmountWithZeroCommodity $ triCommodityBalance c i}',
'#{concat $ intersperse "\\n" $ lines $ show $ triOrigTransaction i}',
#{tindex $ triOrigTransaction i}
],
/* [] */
],

View File

@ -113,13 +113,12 @@ function registerChart($container, series) {
function registerChartClick(ev, pos, item) {
if (item) {
var date = $.plot.dateGenerator(item.datapoint[0], {});
var dateid = $.plot.formatDate(date, '%Y-%m-%d');
$target = $('#'+dateid);
if ($target.length)
$target = $('#'+item.series.data[item.dataIndex][5]);
if ($target.length) {
$('html, body').animate({
scrollTop: $target.offset().top
}, 1000);
}
}
}