From ff6b979816275f9c3d67fc9b4e5586e037d3131c Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 1 Aug 2010 00:20:48 +0000 Subject: [PATCH] web: groundwork for an import form --- Hledger/Cli/Commands/Web.hs | 144 ++++++++++++++++++++++++++++++------ 1 file changed, 122 insertions(+), 22 deletions(-) diff --git a/Hledger/Cli/Commands/Web.hs b/Hledger/Cli/Commands/Web.hs index e633bf96f..3e3e3e8a6 100644 --- a/Hledger/Cli/Commands/Web.hs +++ b/Hledger/Cli/Commands/Web.hs @@ -186,6 +186,7 @@ getAccountsJournalPage = do ^navlinks.td^ ^addform^ ^editform'^ + ^importform^ %div#transactions.journal ^filterform.td^ ^jr^ @@ -216,6 +217,7 @@ getAccountsRegisterPage = do ^navlinks.td^ ^addform^ ^editform'^ + ^importform^ %div#transactions.register ^filterform.td^ ^rr^ @@ -371,7 +373,7 @@ addform = [$hamlet| ^transactionfields2^ %tr#addbuttonrow %td!colspan=4 - %input!type=hidden!name=add!value=1 + %input!type=hidden!name=action!value=add %input!type=submit!name=submit!value="add transaction" |] where @@ -432,7 +434,7 @@ editform _ content = [$hamlet| %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=hidden!name=action!value=edit %input!type=submit!name=submit!value="save journal" \ or $ %a!href!onclick="return editformToggle()" cancel @@ -440,12 +442,35 @@ editform _ content = [$hamlet| where formathelp = helplink "file-format" "file format help" +importform :: Hamlet HledgerWebAppRoute +importform = [$hamlet| + %form#importform!method=POST!style=display:none; + %table.form + %tr + %td + %input!type=file!name=file + %input!type=hidden!name=action!value=import + %input!type=submit!name=submit!value="import from file" + \ or $ + %a!href!onclick="return importformToggle()" cancel +|] + scripts = [$hamlet|