dp wiz avatar dp wiz committed 93562aa

remove accidental dependency on happstack-server

Comments (0)

Files changed (2)

Layout/Bootstrap/Forms.hs

 import Control.Monad (forM, forM_)
 import qualified Data.Map as HM
 
-import Happstack.Server (lookTexts', ServerPartT)
-
 import Layout.Bootstrap.Widgets (
   fieldset, form,
   simpleInput, Input(..),
 -- | Fill in form values and errors using 'formData'.
 --
 -- @
+-- import Happstack.Server (lookTexts', ServerPartT)
+--
 -- -- Use inside 'ServerPart':
 -- form <- lookValues checkForm
+--
+-- lookValues :: Form -> ServerPartT IO Form
+-- lookValues form = do
+--     reqd <- formData $ required form
+--     optl <- formData $ optional form
+--     extr <- formData $ extra form
+--
+--    return form { formValues = HM.unions $ map HM.fromList [reqd, optl, extr]
+--                , formErrors = HM.fromList $ checkRequired reqd }
+--
+-- -- Load assoc list of values from current request.
+-- formData :: [Input] -> ServerPartT IO [(T.Text, [T.Text])]
+-- formData fs = forM fs
+--     (\field -> do
+--         let name = T.toLower $ title field
+--         value <- lookTexts' $ T.unpack name
+--         return (name, value))
+--   
+-- isRequired title = (title, ["This field is required."])
+-- checkRequired = concatMap (\(title, values) -> case values of
+--                                                    [] -> [isRequired title]
+--                                                    [""] -> [isRequired title]
+--                                                    _ -> [])
 -- @
-lookValues :: Form -> ServerPartT IO Form
-lookValues form = do
-    reqd <- formData $ required form
-    optl <- formData $ optional form
-    extr <- formData $ extra form
 
-    return form { formValues = HM.unions $ map HM.fromList [reqd, optl, extr]
-                , formErrors = HM.fromList $ checkRequired reqd }
-
--- | Load assoc list of values from current request.
-formData :: [Input] -> ServerPartT IO [(T.Text, [T.Text])]
-formData fs = forM fs
-    (\field -> do
-        let name = T.toLower $ title field
-        value <- lookTexts' $ T.unpack name
-        return (name, value))
-
-isRequired title = (title, ["This field is required."])
-checkRequired = concatMap (\(title, values) -> case values of
-                                                   [] -> [isRequired title]
-                                                   [""] -> [isRequired title]
-                                                   _ -> [])

layout-bootstrap.cabal

   Location: https://bitbucket.org/dpwiz/layout-bootstrap
 
 Library
-  Build-Depends: base >= 4 && < 5, text, blaze-html, containers, happstack-server
+  Build-Depends: base >= 4 && < 5, text, blaze-html, containers
   Exposed-modules:
     Layout.Bootstrap.Starter, Layout.Bootstrap.Widgets, Layout.Bootstrap.Forms
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.