From 3f3a526e8a115f8eaa2e2aab39353256fbe2bcea Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 22 May 2014 20:36:49 -0700 Subject: [PATCH] web: move sidebar links out of balanceReportAsHtml --- hledger-web/Handler/Common.hs | 52 +++++++++++++++++------------------ hledger-web/static/hledger.js | 6 ++-- hledger-web/static/style.css | 22 +++++++-------- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/hledger-web/Handler/Common.hs b/hledger-web/Handler/Common.hs index c6ae14ded..5ab19ac46 100644 --- a/hledger-web/Handler/Common.hs +++ b/hledger-web/Handler/Common.hs @@ -48,7 +48,31 @@ $maybe m' <- msg -- | The sidebar used on most views. sidebar :: ViewData -> HtmlUrl AppRoute -sidebar vd@VD{..} = balanceReportAsHtml opts vd $ balanceReport (reportopts_ $ cliopts_ opts){empty_=True} am j +sidebar vd@VD{..} = + [hamlet| + [+] + + +

+ Register + +

+ Journal + +   + entries +   + + edit + +

+ Add a transaction.. + + + ^{accounts} +|] + where + accounts = balanceReportAsHtml opts vd $ balanceReport (reportopts_ $ cliopts_ opts){empty_=True} am j -- -- | Navigation link, preserving parameters and possibly highlighted. -- navlink :: ViewData -> String -> AppRoute -> String -> HtmlUrl AppRoute @@ -285,35 +309,11 @@ nulltemplate = [hamlet||] ---------------------------------------------------------------------- -- hledger report renderers --- | Render an "BalanceReport" as html. +-- | Render a "BalanceReport" as html. balanceReportAsHtml :: WebOpts -> ViewData -> BalanceReport -> HtmlUrl AppRoute balanceReportAsHtml _ vd@VD{..} (items',total) = [hamlet| - - [+] - - - -
-
Register - - - -
-
Journal - -   - entries -   - - edit - - - -
- Add a transaction.. -
diff --git a/hledger-web/static/hledger.js b/hledger-web/static/hledger.js index 2ac78b1de..6c46366b8 100644 --- a/hledger-web/static/hledger.js +++ b/hledger-web/static/hledger.js @@ -9,12 +9,12 @@ $(document).ready(function() { if ($.url.param('accounts')=='0') $('#accounts').hide(); /* set up sidebar account mouse-over handlers */ - $('.balancereport td a').mouseenter(function(){ $(this).parent().addClass('mouseover'); }); - $('.balancereport td').mouseleave(function(){ $(this).removeClass('mouseover'); }); + $('#sidebar p a').mouseenter(function(){ $(this).parent().addClass('mouseover'); }); + $('#sidebar p').mouseleave(function(){ $(this).removeClass('mouseover'); }); /* set up various show/hide toggles */ $('#search-help-link').click(function() { $('#search-help').slideToggle('fast'); event.preventDefault(); }); - $('#accounts-toggle-link').click(function() { $('#accounts').slideToggle('fast'); event.preventDefault(); }); + $('#sidebar-toggle-link').click(function() { $('#sidebar-content').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(); }); diff --git a/hledger-web/static/style.css b/hledger-web/static/style.css index 6bd4788d0..c591ed6b0 100644 --- a/hledger-web/static/style.css +++ b/hledger-web/static/style.css @@ -24,18 +24,16 @@ body { backgroun .negative { color:#800; } .help { } -.balancereport .inacct { /*background-color:#ddd;*/ font-weight:bold; } -.notinacct, .notinacct :link, .notinacct :visited { color:#888; } -.notinacct .negative { color:#b77; } -.balancereport .numpostings { padding-left:1em; color:#aaa; } -.balancereport td.add.mouseover { background-color:rgba(208,208,208,0.5); } -.balancereport td.journal.mouseover { background-color:rgba(208,208,208,0.5); } -.balancereport td.journal.mouseover .hoverlinks { visibility:visible; } -.balancereport td.account.mouseover { background-color:rgba(208,208,208,0.5); } -.balancereport td.account.mouseover .hoverlinks { visibility:visible; } -.balancereport .hoverlinks { visibility:hidden; } -.balancereport .hoverlinks { margin-left:0em; font-weight:normal; /*font-size:smaller;*/ display:inline-block; text-align:right; } -.balancereport .hoverlinks a { margin-left:0.5em; } +#sidebar .hoverlinks { visibility:hidden; } +#sidebar .mouseover { background-color:rgba(208,208,208,0.5); } +#sidebar .mouseover .hoverlinks { visibility:visible; } + +#sidebar .balancereport .hoverlinks { margin-left:0em; font-weight:normal; /*font-size:smaller;*/ display:inline-block; text-align:right; } +#sidebar .balancereport .hoverlinks a { margin-left:0.5em; } +#sidebar .notinacct, .notinacct :link, .notinacct :visited { color:#888; } +#sidebar .notinacct .negative { color:#b77; } +#sidebar .balancereport .inacct { /*background-color:#ddd;*/ font-weight:bold; } +#sidebar .balancereport .numpostings { padding-left:1em; color:#aaa; } /*------------------------------------------------------------------------------------------*/ /* 2. font families & sizes */