reform-hamlet-0.0/0000755000000000000000000000000012174562470012311 5ustar0000000000000000reform-hamlet-0.0/reform-hamlet.cabal0000644000000000000000000000213212174562470016035 0ustar0000000000000000Name: reform-hamlet Version: 0.0 Synopsis: Add support for using Hamlet with Reform Description: Reform is a library for building and validating forms using applicative functors. This package add support for using reform with Hamlet. Homepage: http://www.happstack.com/ License: BSD3 License-file: LICENSE Author: Jeremy Shaw Maintainer: jeremy@n-heptane.com Copyright: 2012 Jeremy Shaw, Jasper Van der Jeugt, SeeReason Partners LLC Category: Web Build-type: Simple Cabal-version: >=1.6 source-repository head type: darcs subdir: reform-hamlet location: http://hub.darcs.net/stepcut/reform Library Exposed-modules: Text.Reform.Hamlet.Common Text.Reform.Hamlet.String Text.Reform.Hamlet.Text Build-depends: base > 4 && <5, blaze-markup > 0.5 && < 0.6, hamlet > 1.0 && < 1.2, reform == 0.2.*, text == 0.11.* reform-hamlet-0.0/LICENSE0000644000000000000000000000275712174562470013331 0ustar0000000000000000Copyright (c)2012, Jeremy Shaw All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Jeremy Shaw nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. reform-hamlet-0.0/Setup.hs0000644000000000000000000000005612174562470013746 0ustar0000000000000000import Distribution.Simple main = defaultMain reform-hamlet-0.0/Text/0000755000000000000000000000000012174562470013235 5ustar0000000000000000reform-hamlet-0.0/Text/Reform/0000755000000000000000000000000012174562470014467 5ustar0000000000000000reform-hamlet-0.0/Text/Reform/Hamlet/0000755000000000000000000000000012174562470015701 5ustar0000000000000000reform-hamlet-0.0/Text/Reform/Hamlet/Common.hs0000644000000000000000000002374212174562470017475 0ustar0000000000000000{-# LANGUAGE QuasiQuotes, ScopedTypeVariables, TypeFamilies #-} module Text.Reform.Hamlet.Common where import Data.Text.Lazy (Text, pack) import qualified Data.Text as T import Text.Blaze (ToMarkup(..)) import Text.Reform.Backend import Text.Reform.Core import Text.Reform.Generalized as G import Text.Reform.Result (FormId, Result(Ok), unitRange) import Text.Hamlet (hamlet, HtmlUrl) instance ToMarkup FormId where toMarkup fid = toMarkup (show fid) inputText :: (FormError error, Monad m, ToMarkup text) => (input -> Either error text) -> text -> Form m input error (HtmlUrl url) () text inputText getInput initialValue = G.input getInput inputField initialValue where inputField i a = [hamlet||] inputPassword :: (Monad m, FormError error, ToMarkup text) => (input -> Either error text) -> text -> Form m input error (HtmlUrl url) () text inputPassword getInput initialValue = G.input getInput inputField initialValue where inputField i a = [hamlet||] inputSubmit :: (Monad m, FormError error, ToMarkup text) => (input -> Either error text) -> text -> Form m input error (HtmlUrl url) () (Maybe text) inputSubmit getInput initialValue = G.inputMaybe getInput inputField initialValue where inputField i a = [hamlet||] inputReset :: (Monad m, FormError error, ToMarkup text) => text -> Form m input error (HtmlUrl url) () () inputReset lbl = G.inputNoData inputField lbl where inputField i a = [hamlet||] inputHidden :: (Monad m, FormError error, ToMarkup text) => (input -> Either error text) -> text -> Form m input error (HtmlUrl url) () text inputHidden getInput initialValue = G.input getInput inputField initialValue where inputField i a = [hamlet||] inputButton :: (Monad m, FormError error, ToMarkup text) => text -> Form m input error (HtmlUrl url) () () inputButton label = G.inputNoData inputField label where inputField i a = [hamlet||] textarea :: (Monad m, FormError error, ToMarkup text) => (input -> Either error text) -> Int -- ^ cols -> Int -- ^ rows -> text -- ^ initial text -> Form m input error (HtmlUrl url) () text textarea getInput cols rows initialValue = G.input getInput textareaView initialValue where textareaView i txt = [hamlet|