Skip to content
Snippets Groups Projects
Commit 107dc370 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#274 - scroll to highlighted transaction

parent 9c6bae14
No related branches found
No related tags found
No related merge requests found
Pipeline #1548 failed
...@@ -181,8 +181,29 @@ $( document ).ready(function() { ...@@ -181,8 +181,29 @@ $( document ).ready(function() {
direction: 'bottom', direction: 'bottom',
hoverEnabled: false hoverEnabled: false
}); });
// scroll to highlighted transaction
var highlightedSmall = document.getElementById("highlighted-small");
var highlightedLarge = document.getElementById("highlighted-large");
if(highlightedSmall !== undefined && !isHidden(highlightedSmall))
{
$('html, body').animate({
scrollTop: $(highlightedSmall).offset().top
}, 500);
}
else if(highlightedLarge !== undefined && !isHidden(highlightedLarge))
{
$('html, body').animate({
scrollTop: $(highlightedLarge).offset().top
}, 500);
}
}); });
function isHidden(el) {
var style = window.getComputedStyle(el);
return (style.display === 'none' || style.display === 'none !important')
}
var transactionRepeatingModifierID = "#transaction-repeating-modifier"; var transactionRepeatingModifierID = "#transaction-repeating-modifier";
var transactionRepeatingEndAfterXTimesInputID = "#transaction-repeating-end-after-x-times-input"; var transactionRepeatingEndAfterXTimesInputID = "#transaction-repeating-end-after-x-times-input";
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<#list transactions as transaction> <#list transactions as transaction>
<#assign shouldHighlight = highlightID?? && transaction.getID()?? && transaction.getID()==highlightID/> <#assign shouldHighlight = highlightID?? && transaction.getID()?? && transaction.getID()==highlightID/>
<div class="hide-on-large-only transaction-row-top <#if shouldHighlight>budgetmaster-blue-light</#if>"> <div class="hide-on-large-only transaction-row-top <#if shouldHighlight>budgetmaster-blue-light" id="highlighted-small"<#else>"</#if>>
<div class="row valign-wrapper transaction-row-bottom"> <div class="row valign-wrapper transaction-row-bottom">
<div class="col s3 center-align bold transaction-text"> <div class="col s3 center-align bold transaction-text">
${dateService.getDateStringWithoutYear(transaction.date)} ${dateService.getDateStringWithoutYear(transaction.date)}
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<@transactionsMacros.transactionAmount transaction account "s4"/> <@transactionsMacros.transactionAmount transaction account "s4"/>
</div> </div>
</div> </div>
<div class="hide-on-med-and-down transaction-row-top transaction-row-bottom <#if shouldHighlight>budgetmaster-blue-light</#if>"> <div class="hide-on-med-and-down transaction-row-top transaction-row-bottom <#if shouldHighlight>budgetmaster-blue-light" id="highlighted-large"<#else>"</#if>>
<div class="row valign-wrapper no-margin-bottom"> <div class="row valign-wrapper no-margin-bottom">
<div class="col l1 xl1 bold transaction-text transaction-line-height"> <div class="col l1 xl1 bold transaction-text transaction-line-height">
${dateService.getDateStringWithoutYear(transaction.date)} ${dateService.getDateStringWithoutYear(transaction.date)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment