From d14941ab4d9e05edfbe66561c5b841752923f286 Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Camey Date: Mon, 25 May 2015 20:41:26 -0600 Subject: [PATCH 1/2] hledger-web: Fixes keyboard shortcut for adding a transaction. 'addformShow' and 'addformReset' were broken. --- hledger-web/static/hledger.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hledger-web/static/hledger.js b/hledger-web/static/hledger.js index 2cca10a5b..b6eba7d90 100644 --- a/hledger-web/static/hledger.js +++ b/hledger-web/static/hledger.js @@ -6,7 +6,7 @@ $(document).ready(function() { // show add form if ?add=1 - if ($.url.param('add')) { addformShow(showmsg=true); } + if ($.url.param('add')) { addformShow(true); } // sidebar account hover handlers $('#sidebar td a').mouseenter(function(){ $(this).parent().addClass('mouseover'); }); @@ -127,7 +127,7 @@ function registerChartClick(ev, pos, item) { // ADD FORM function addformShow(showmsg) { - showmsg = typeof showmsg !== 'undefined' ? a : false; + showmsg = typeof showmsg !== 'undefined' ? showmsg : false; addformReset(showmsg); $('#addmodal') .on('shown.bs.modal', function (e) { @@ -138,7 +138,7 @@ function addformShow(showmsg) { // Make sure the add form is empty and clean for display. function addformReset(showmsg) { - showmsg = typeof showmsg !== 'undefined' ? a : false; + showmsg = typeof showmsg !== 'undefined' ? showmsg : false; if ($('form#addform').length > 0) { if (!showmsg) $('div#message').html(''); $('form#addform')[0].reset(); From c79396e662242361ad0c4adc021b46d5fa423eeb Mon Sep 17 00:00:00 2001 From: Carlos Lopez-Camey Date: Mon, 25 May 2015 21:25:50 -0600 Subject: [PATCH 2/2] hledger-web: Clear the form when clicking 'Add a transaction' (just like the shortcut) --- hledger-web/Handler/JournalR.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hledger-web/Handler/JournalR.hs b/hledger-web/Handler/JournalR.hs index 182e1e6fb..8d28db6d3 100644 --- a/hledger-web/Handler/JournalR.hs +++ b/hledger-web/Handler/JournalR.hs @@ -34,7 +34,7 @@ getJournalR = do hledgerLayout vd "journal" [hamlet| #{title} - Add a transaction + Add a transaction ^{maincontent} |]