web: make /journal work as a separate view; use "transactions" on both

This commit is contained in:
Simon Michael 2011-06-05 20:12:09 +00:00
parent 1d898ed239
commit 20bc969ef0
5 changed files with 32 additions and 28 deletions

View File

@ -30,8 +30,7 @@ function searchformToggle() {
var elink = document.getElementById('editformlink');
var flink = document.getElementById('searchformlink');
var ilink = document.getElementById('importformlink');
var jlink = document.getElementById('journallink');
var rlink = document.getElementById('postingslink');
var tlink = document.getElementById('transactionslink');
if (f.style.display == 'none') {
flink.style['font-weight'] = 'bold';
@ -53,15 +52,13 @@ function addformToggle(ev) {
var elink = document.getElementById('editformlink');
var flink = document.getElementById('searchformlink');
var ilink = document.getElementById('importformlink');
var jlink = document.getElementById('journallink');
var rlink = document.getElementById('postingslink');
var tlink = document.getElementById('transactionslink');
if (a.style.display == 'none') {
if (alink) alink.style['font-weight'] = 'bold';
if (elink) elink.style['font-weight'] = 'normal';
if (ilink) ilink.style['font-weight'] = 'normal';
if (jlink) jlink.style['font-weight'] = 'normal';
if (rlink) rlink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'normal';
if (a) a.style.display = 'block';
if (e) e.style.display = 'none';
if (i) i.style.display = 'none';
@ -70,6 +67,7 @@ function addformToggle(ev) {
if (alink) alink.style['font-weight'] = 'normal';
if (elink) elink.style['font-weight'] = 'normal';
if (ilink) ilink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'bold';
if (a) a.style.display = 'none';
if (e) e.style.display = 'none';
if (i) i.style.display = 'none';
@ -89,15 +87,13 @@ function editformToggle(ev) {
var elink = document.getElementById('editformlink');
var flink = document.getElementById('searchformlink');
var ilink = document.getElementById('importformlink');
var jlink = document.getElementById('journallink');
var rlink = document.getElementById('postingslink');
var tlink = document.getElementById('transactionslink');
if (e.style.display == 'none') {
if (alink) alink.style['font-weight'] = 'normal';
if (elink) elink.style['font-weight'] = 'bold';
if (ilink) ilink.style['font-weight'] = 'normal';
if (jlink) jlink.style['font-weight'] = 'normal';
if (rlink) rlink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'normal';
if (a) a.style.display = 'none';
if (i) i.style.display = 'none';
if (c) c.style.display = 'none';
@ -107,6 +103,7 @@ function editformToggle(ev) {
if (alink) alink.style['font-weight'] = 'normal';
if (elink) elink.style['font-weight'] = 'normal';
if (ilink) ilink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'bold';
if (a) a.style.display = 'none';
if (e) e.style.display = 'none';
if (i) i.style.display = 'none';
@ -149,15 +146,13 @@ function importformToggle(ev) {
var elink = document.getElementById('editformlink');
var flink = document.getElementById('searchformlink');
var ilink = document.getElementById('importformlink');
var jlink = document.getElementById('journallink');
var rlink = document.getElementById('postingslink');
var tlink = document.getElementById('transactionslink');
if (i.style.display == 'none') {
if (alink) alink.style['font-weight'] = 'normal';
if (elink) elink.style['font-weight'] = 'normal';
if (ilink) ilink.style['font-weight'] = 'bold';
if (jlink) jlink.style['font-weight'] = 'normal';
if (rlink) rlink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'normal';
if (a) a.style.display = 'none';
if (e) e.style.display = 'none';
if (i) i.style.display = 'block';
@ -166,6 +161,7 @@ function importformToggle(ev) {
if (alink) alink.style['font-weight'] = 'normal';
if (elink) elink.style['font-weight'] = 'normal';
if (ilink) ilink.style['font-weight'] = 'normal';
if (tlink) tlink.style['font-weight'] = 'bold';
if (a) a.style.display = 'none';
if (e) e.style.display = 'none';
if (i) i.style.display = 'none';

View File

@ -3,7 +3,9 @@
<div#sidebar
^{sidecontent}
<div#main.journal
^{navlinks vd}
<div#navlinks
^{navlink vd "transactions" JournalR} | #
^{editlinks}
<div#maincontent
^{searchform vd}
^{maincontent}

View File

@ -1,4 +1,6 @@
<div#navlinks
^{accountsregisterlink}
^{journallink}
\ | #
^{registerlink}
\ | #
^{editlinks}

View File

@ -3,7 +3,9 @@
<div#sidebar
^{sidecontent}
<div#main.register
^{navlinks vd}
<div#navlinks
^{navlink vd "transactions" RegisterR} | #
^{editlinks}
<div#maincontent
^{searchform vd}
^{maincontent}

View File

@ -342,17 +342,19 @@ topbar VD{j=j,msg=msg,today=today} = $(Settings.hamletFile "topbar")
where
title = takeFileName $ journalFilePath j
-- | Links to navigate between the main views.
navlinks :: ViewData -> Hamlet AppRoute
navlinks vd = $(Settings.hamletFile "navlinks")
where
accountsjournallink = navlink vd "transactions" JournalR
accountsregisterlink = navlink vd "postings" RegisterR
navlink :: ViewData -> String -> AppRoute -> Hamlet AppRoute
navlink VD{here=here,q=q} s dest = $(Settings.hamletFile "navlink")
where u = (dest, if null q then [] else [("q", pack q)])
style | dest == here = "navlinkcurrent"
| otherwise = "navlink" :: Text
-- -- | Links to navigate between the main views.
-- navlinks :: ViewData -> Hamlet AppRoute
-- navlinks vd = $(Settings.hamletFile "navlinks")
-- where
-- journallink = navlink vd "transactions" JournalR
-- registerlink = navlink vd "postings" RegisterR
-- | Navigation link, preserving parameters and possibly highlighted.
navlink :: ViewData -> String -> AppRoute -> Hamlet AppRoute
navlink VD{here=here,q=q} s dest = $(Settings.hamletFile "navlink")
where u = (dest, if null q then [] else [("q", pack q)])
style | dest == here = "navlinkcurrent"
| otherwise = "navlink" :: Text
-- | Links to the various journal editing forms.
editlinks :: Hamlet AppRoute