summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-11-28 11:21:19 +0100
committerYorhel <git@yorhel.nl>2019-11-28 11:21:23 +0100
commit8825bb9df2487057bb65b69df67c93e7d793a37a (patch)
tree0a070d68abd5daf67f1526d5a7be3fa610d1d9c8 /elm/Lib
parent4067f0a73a55e898def7320976781a2b8bf6710b (diff)
Use plain links for JS-ified linkradio inputs + fix focus of non-JS linkradios
Kind of backwards to use input elements to display a link when they're backed by Javascript anyway. This also avoids the need to create a unique id for each linkradio element.
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Html.elm6
1 files changed, 6 insertions, 0 deletions
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm
index 86c0f8f7..d75dced4 100644
--- a/elm/Lib/Html.elm
+++ b/elm/Lib/Html.elm
@@ -150,6 +150,12 @@ inputWikidata nam val onch =
[ pattern "^Q?[1-9][0-9]{0,8}$" ]
+-- Similar to inputCheck and inputRadio with a label, except this is just a link.
+linkRadio : Bool -> (Bool -> m) -> List (Html m) -> Html m
+linkRadio val onch content =
+ a [ href "#", onClickD (onch (not val)), class "linkradio", classList [("checked", val)] ] content
+
+
-- Generate a form field (table row) with a label. The `label` string can be:
--
-- "none" -> To generate a full-width field (colspan=2)