From 8fc53d879fdc1bbd78ded3172769aa381853bf78 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Fri, 16 Mar 2018 20:54:35 +0100 Subject: [PATCH] split inputs-logic and form-logic in frontend --- src/Foundation.hs | 1 + src/Handler/Utils/Form.hs | 2 +- templates/standalone/inputs.hamlet | 1 + templates/standalone/inputs.julius | 188 ++++++++++++++++++ templates/standalone/inputs.lucius | 304 +++++++++++++++++++++++++++++ templates/widgets/form.julius | 172 +--------------- templates/widgets/form.lucius | 304 ----------------------------- 7 files changed, 496 insertions(+), 476 deletions(-) create mode 100644 templates/standalone/inputs.hamlet create mode 100644 templates/standalone/inputs.julius create mode 100644 templates/standalone/inputs.lucius diff --git a/src/Foundation.hs b/src/Foundation.hs index ed02dcd74..b6741cf0d 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -344,6 +344,7 @@ defaultMenuLayout menu widget = do $(widgetFile "default-layout") $(widgetFile "standalone/showHide") $(widgetFile "standalone/sortable") + $(widgetFile "standalone/inputs") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") -- How to run database actions. diff --git a/src/Handler/Utils/Form.hs b/src/Handler/Utils/Form.hs index 93b32bb45..e3f25d52e 100644 --- a/src/Handler/Utils/Form.hs +++ b/src/Handler/Utils/Form.hs @@ -124,7 +124,7 @@ buttonField btn = Field {fieldParse, fieldView, fieldEnctype} fieldView fid name attrs _val _ = [whamlet| - + |] fieldParse [] _ = return $ Right Nothing diff --git a/templates/standalone/inputs.hamlet b/templates/standalone/inputs.hamlet new file mode 100644 index 000000000..d5383e417 --- /dev/null +++ b/templates/standalone/inputs.hamlet @@ -0,0 +1 @@ + diff --git a/templates/standalone/inputs.julius b/templates/standalone/inputs.julius new file mode 100644 index 000000000..8e392e6a0 --- /dev/null +++ b/templates/standalone/inputs.julius @@ -0,0 +1,188 @@ +(function() { + 'use strict'; + + window.utils = window.utils || {}; + + // makes