From 9014ee29b761a6991879b5740e1ba1cdc23dd997 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Mon, 30 Oct 2023 13:50:16 +1300 Subject: [PATCH] Add file-input support, upload missing files. --- form.html | 1 + src/Text/HTML/Form/Query.hs | 2 +- src/Text/HTML/Form/WebApp.hs | 39 ++++++++++++++++++++++++++--- src/Text/HTML/Form/WebApp/Ginger.hs | 11 +++++--- tpl/base.html | 1 + tpl/files.html | 15 +++++++++++ tpl/image-button.html | 15 +++++++++++ tpl/reset.html | 8 ++++++ tpl/submit.html | 10 ++++++++ 9 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 tpl/files.html create mode 100644 tpl/image-button.html create mode 100644 tpl/reset.html create mode 100644 tpl/submit.html diff --git a/form.html b/form.html index d992a0b..077cd9c 100644 --- a/form.html +++ b/form.html @@ -11,6 +11,7 @@ + diff --git a/src/Text/HTML/Form/Query.hs b/src/Text/HTML/Form/Query.hs index 2dbf4ae..2a235f2 100644 --- a/src/Text/HTML/Form/Query.hs +++ b/src/Text/HTML/Form/Query.hs @@ -18,7 +18,7 @@ renderQuery' :: Form -> [(String, String)] renderQuery' form = concatMap renderInput' $ inputs form renderInput' :: Input -> [(String, String)] renderInput' Input { inputType = inputType' } - | inputType' `elem` ["submit", "reset", "button"] = [] + | inputType' `elem` ["submit", "reset", "button", "file"] = [] renderInput' Input { checked = False, inputType = inputType' } | inputType' `elem` ["radio", "checkbox"] = [] renderInput' Input { inputType = "