jaspervdj / digestive-functors

A general way to consume input using applicative functors
149 stars 71 forks source link

Keep error Path when wrapping error list #37

Open freizl opened 12 years ago

freizl commented 12 years ago

dfChildErrorList only list all error message without each error Path. I think it is better to keep the Path, for instance, put the Path as a attribute of li element.

By doing this is just to be more flexible regrading customize error highlights. For instance, utilize JavaScript to highlight error over each element.

-- A quick fix at my local
dfChildErrorListRef view = return $ errorList (viewErrors view)
errorList :: [(Path, Text)] -> [X.Node]
errorList []    = []
errorList errs  = [X.Element "ul" [] $ map makeError errs]
                  where makeError (p:_, e) = X.Element "li" [("data-error", p)] [X.TextNode e]

Since HTML 5 allow add customize attribute started with data-, I name data-error here.

Thanks.

jaspervdj commented 12 years ago

Okay, I'm not sure if many people need this but I can (and will) put it in anyway since it should never get in the way.

freizl commented 12 years ago

Great. Thank you.