web: add form uses currently focussed account as default from account

This commit is contained in:
Simon Michael 2011-06-14 21:26:56 +00:00
parent 35b3c0d37e
commit 938adb8a4e
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<select id=#{acctvar} name=#{acctvar} <select id=#{acctvar} name=#{acctvar}
<option <option
$forall a <- acctnames $forall a <- acctnames
<option value=#{a}>#{a} <option value=#{a} :shouldselect a:selected>#{a}
^{amtfield} ^{amtfield}
<tr.helprow <tr.helprow
<td <td

View File

@ -372,7 +372,7 @@ searchform VD{here=here,q=q} = $(Settings.hamletFile "searchform")
-- | Add transaction form. -- | Add transaction form.
addform :: ViewData -> Hamlet AppRoute addform :: ViewData -> Hamlet AppRoute
addform vd = $(Settings.hamletFile "addform") addform vd@VD{qopts=qopts} = $(Settings.hamletFile "addform")
where where
datehelp = "eg: 2010/7/20" :: String datehelp = "eg: 2010/7/20" :: String
deschelp = "eg: supermarket (optional)" :: String deschelp = "eg: supermarket (optional)" :: String
@ -381,6 +381,7 @@ addform vd = $(Settings.hamletFile "addform")
manyfiles = (length $ files $ j vd) > 1 manyfiles = (length $ files $ j vd) > 1
postingfields VD{j=j} n = $(Settings.hamletFile "addformpostingfields") postingfields VD{j=j} n = $(Settings.hamletFile "addformpostingfields")
where where
shouldselect a = n == 2 && Just a == inAccount qopts
numbered = (++ show n) numbered = (++ show n)
acctvar = numbered "account" acctvar = numbered "account"
amtvar = numbered "amount" amtvar = numbered "amount"