From d28440e3c830c4f77e1a4359f3fc42fc958a2e7c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 15 Aug 2014 10:54:33 -0700 Subject: Fade in transactions report --- public/js/report.coffee | 61 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'public/js') diff --git a/public/js/report.coffee b/public/js/report.coffee index 7bcfb8c3..90b7c0aa 100644 --- a/public/js/report.coffee +++ b/public/js/report.coffee @@ -48,37 +48,38 @@ filterDates = -> display(transactions) display = (transactions) -> - $('.alert').remove() $('.report tbody tr').remove() - $('.report').show() if transactions.length is 0 - $('.report').before("

No transactions were found for the specified time period

") $('.report').hide() - - $.each(transactions, -> - exchange = parseFloat(this.exchange) - received = parseFloat(this.received) - amount = received * exchange - - $('.report tbody').append(""" - - #{moment(this.date, 'YYYY-MM-DD h:mm:ss').format('MMM D h:mma')} - #{exchange.toFixed(2)} - #{received.toFixed(5)} - #{amount.toFixed(2)} - - """) - ) - - btc = 0 - $('table.report tbody td:nth-child(3)').each(-> - btc += parseFloat($(this).html()) - ) - $('#btc').html(btc.toFixed(5)) - - cad = 0 - $('table.report tbody td:nth-child(4)').each(-> - cad += parseFloat($(this).html()) - ) - $('#cad').html(cad.toFixed(2)) + $('.alert').fadeIn() + else + $('.alert').hide() + $.each(transactions, -> + exchange = parseFloat(this.exchange) + received = parseFloat(this.received) + amount = received * exchange + + $('.report tbody').append(""" + + #{moment(this.date, 'YYYY-MM-DD h:mm:ss').format('MMM D h:mma')} + #{exchange.toFixed(2)} + #{received.toFixed(5)} + #{amount.toFixed(2)} + + """) + ) + + btc = 0 + $('table.report tbody td:nth-child(3)').each(-> + btc += parseFloat($(this).html()) + ) + $('#btc').html(btc.toFixed(5)) + + cad = 0 + $('table.report tbody td:nth-child(4)').each(-> + cad += parseFloat($(this).html()) + ) + $('#cad').html(cad.toFixed(2)) + + $('.report').fadeIn() -- cgit v1.2.3