From 41c175ecc83bbcb98f0ed2dcbcea645f75b0d5a6 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 28 Jul 2010 16:22:32 +0000 Subject: [PATCH] web: more consistent fonts, stylesheet cleanups --- Hledger/Cli/Commands/Web.hs | 197 ++++++++++++++++++------------------ data/web/style.css | 125 +++++++++++------------ 2 files changed, 159 insertions(+), 163 deletions(-) diff --git a/Hledger/Cli/Commands/Web.hs b/Hledger/Cli/Commands/Web.hs index cc1b23a74..028700c19 100644 --- a/Hledger/Cli/Commands/Web.hs +++ b/Hledger/Cli/Commands/Web.hs @@ -158,6 +158,102 @@ journalReportAsHtml _ td items = [$hamlet| evenodd = if even n then "even" else "odd" txn = trimnl $ showTransaction t where trimnl = reverse . dropWhile (=='\n') . reverse +addform :: Hamlet HledgerWebAppRoute +addform = [$hamlet| + %form#addform!method=POST!style=display:none; + %table.form + %tr + %td!colspan=4 + %table + %tr#descriptionrow + %td + Date: + %td + %input.textinput!size=15!name=date!value=$date$ + %td!style=padding-left:1em; + Description: + %td + %input.textinput!size=35!name=description!value=$desc$ + %tr.helprow + %td + %td + .help $datehelp$ ^datehelplink^ $ + %td + %td + .help $deschelp$ + ^transactionfields1^ + ^transactionfields2^ + %tr#addbuttonrow + %td!colspan=4 + %input!type=hidden!name=add!value=1 + %input!type=submit!name=submit!value="add transaction" +|] + where + datehelplink = helplink "dates" "..." + datehelp = "eg: 7/20, 2010/1/1, " + deschelp = "eg: supermarket (optional)" + date = "today" + desc = "" + transactionfields1 = transactionfields 1 + transactionfields2 = transactionfields 2 + +transactionfields :: Int -> Hamlet HledgerWebAppRoute +transactionfields n = [$hamlet| + %tr#postingrow + %td!align=right + $label$: + %td + %input.textinput!size=35!name=$acctvar$!value=$acct$ + ^amtfield^ + %tr.helprow + %td + %td + .help $accthelp$ + %td + %td + .help $amthelp$ +|] + where + label | n == 1 = "To account" + | otherwise = "From account" + accthelp | n == 1 = "eg: expenses:food" + | otherwise = "eg: assets:bank:checking" + amtfield | n == 1 = [$hamlet| + %td!style=padding-left:1em; + Amount: + %td + %input.textinput!size=15!name=$amtvar$!value=$amt$ + |] + | otherwise = nulltemplate + amthelp | n == 1 = "eg: 5, $6, €7.01" + | otherwise = "" + acct = "" + amt = "" + numbered = (++ show n) + acctvar = numbered "accountname" + amtvar = numbered "amount" + +editform :: TemplateData -> String -> Hamlet HledgerWebAppRoute +editform _ content = [$hamlet| + %form#editform!method=POST!style=display:none; + %table.form#editform + %tr + %td!colspan=2 + %textarea!name=text!rows=30!cols=80 + $content$ + %tr#addbuttonrow + %td + %span.help ^formathelp^ + %td!align=right + %span.help Are you sure ? This will overwrite the journal. $ + %input!type=hidden!name=edit!value=1 + %input!type=submit!name=submit!value="save journal" + \ or $ + %a!href!onclick="return editformToggle()" cancel +|] + where + formathelp = helplink "file-format" "file format help" + journalScripts = [$hamlet|