tagField now can load tag lists

This commit is contained in:
nek0 2014-08-30 23:36:23 +02:00
parent 60505af237
commit 99398c1ecf

View file

@ -16,6 +16,7 @@ import Model
import Control.Applicative
import Control.Monad.Trans.Class
import Data.Maybe
import Data.Either
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Char8 as BC
@ -78,7 +79,7 @@ tagField = Field
case rawVals of
[x] -> return $ Right $ Just $ T.splitOn " " x
_ -> return $ Left $ error "unexpected tag list"
, fieldView = \idAttr nameAttr _ eResult isReq ->
[whamlet|<input id=#{idAttr} type="text" name=#{nameAttr}>|]
, fieldView = \idAttr nameAttr val eResult isReq ->
[whamlet|<input id=#{idAttr} type="text" name=#{nameAttr} value=#{either id (T.intercalate " ") eResult}>|]
, fieldEnctype = UrlEncoded
}