Simplify in checkboxesField{,List}: no intermediate selOpts list
This commit is contained in:
parent
a3bef1bc2b
commit
0dcc9e2b29
@ -403,12 +403,11 @@ checkboxesField ioptlist = (multiSelectField ioptlist)
|
|||||||
opts <- fmap olOptions $ handlerToWidget ioptlist
|
opts <- fmap olOptions $ handlerToWidget ioptlist
|
||||||
let optselected (Left _) _ = False
|
let optselected (Left _) _ = False
|
||||||
optselected (Right vals) opt = (optionInternalValue opt) `elem` vals
|
optselected (Right vals) opt = (optionInternalValue opt) `elem` vals
|
||||||
let selOpts = map (id &&& (optselected val)) opts
|
|
||||||
[whamlet|
|
[whamlet|
|
||||||
<span ##{theId}>
|
<span ##{theId}>
|
||||||
$forall (opt, optsel) <- selOpts
|
$forall opt <- opts
|
||||||
<label>
|
<label>
|
||||||
<input type=checkbox name=#{name} value=#{optionExternalValue opt} *{attrs} :optsel:checked>
|
<input type=checkbox name=#{name} value=#{optionExternalValue opt} *{attrs} :optselected val opt:checked>
|
||||||
#{optionDisplay opt}
|
#{optionDisplay opt}
|
||||||
|]
|
|]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user