diff options
author | Yorhel <git@yorhel.nl> | 2019-11-28 11:21:19 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-11-28 11:21:23 +0100 |
commit | 8825bb9df2487057bb65b69df67c93e7d793a37a (patch) | |
tree | 0a070d68abd5daf67f1526d5a7be3fa610d1d9c8 /elm/UList | |
parent | 4067f0a73a55e898def7320976781a2b8bf6710b (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/UList')
-rw-r--r-- | elm/UList/LabelEdit.elm | 21 | ||||
-rw-r--r-- | elm/UList/ManageLabels.elm | 5 | ||||
-rw-r--r-- | elm/UList/Opt.elm | 31 |
3 files changed, 24 insertions, 33 deletions
diff --git a/elm/UList/LabelEdit.elm b/elm/UList/LabelEdit.elm index 1f2c229d..28f2cc68 100644 --- a/elm/UList/LabelEdit.elm +++ b/elm/UList/LabelEdit.elm @@ -76,19 +76,16 @@ view model = str = String.join ", " <| List.filterMap (\l -> if Set.member l.id model.sel then Just l.label else Nothing) model.labels item l = - let lid = "label_edit_" ++ String.fromInt model.vid ++ "_" ++ String.fromInt l.id - in - li [ class "linkradio" ] - [ inputCheck lid (Set.member l.id model.tsel) (Toggle l.id) - , label [ for lid ] - [ text l.label - , text " " - , span [ class "spinner", classList [("invisible", Dict.get l.id model.state /= Just Api.Loading)] ] [] - , case Dict.get l.id model.state of - Just (Api.Error _) -> b [ class "standout" ] [ text "error" ] -- Need something better - _ -> text "" - ] + li [ ] + [ linkRadio (Set.member l.id model.tsel) (Toggle l.id) + [ text l.label + , text " " + , span [ class "spinner", classList [("invisible", Dict.get l.id model.state /= Just Api.Loading)] ] [] + , case Dict.get l.id model.state of + Just (Api.Error _) -> b [ class "standout" ] [ text "error" ] -- Need something better + _ -> text "" ] + ] in DD.view model.dd (if List.any (\s -> s == Api.Loading) <| Dict.values model.state then Api.Loading else Api.Normal) diff --git a/elm/UList/ManageLabels.elm b/elm/UList/ManageLabels.elm index e2824ea2..7f951389 100644 --- a/elm/UList/ManageLabels.elm +++ b/elm/UList/ManageLabels.elm @@ -69,14 +69,13 @@ view : Model -> Html Msg view model = let item n l = - let strid = "form_pr" ++ String.fromInt n - in tr [ class "compact" ] + tr [ class "compact" ] [ td [] [ text <| if l.count == 0 then "" else String.fromInt l.count ] , td [ class "stealth" ] [ if l.id > 0 && l.id < 10 then text l.label else inputText ("label_txt_"++String.fromInt n) l.label (Label n) GML.valLabelsLabel ] - , td [ class "linkradio" ] [ inputCheck strid l.private (Private n), label [ for strid ] [ text "private" ] ] + , td [ ] [ linkRadio l.private (Private n) [ text "private" ] ] , td [ class "stealth" ] [ if l.id == 7 then b [ class "grayedout" ] [ text "applied when you vote" ] else if l.id > 0 && l.id < 10 then b [ class "grayedout" ] [ text "built-in" ] diff --git a/elm/UList/Opt.elm b/elm/UList/Opt.elm index c1f488a0..f5ed7303 100644 --- a/elm/UList/Opt.elm +++ b/elm/UList/Opt.elm @@ -203,25 +203,20 @@ view model = Just nfo -> relnfo r nfo relnfo r nfo = - let name = "ulist_relstatus" ++ String.fromInt model.flags.vid ++ "_" ++ String.fromInt nfo.id ++ "_" - in - tr [] - [ td [ class "tco1" ] - [ DD.view r.dd r.state (text <| Maybe.withDefault "removing" <| lookup r.status T.rlistStatus) - <| \_ -> - [ ul [] <| List.map (\(n, status) -> - li [ class "linkradio" ] - [ inputCheck (name ++ String.fromInt n) (n == r.status) (RelSet r.id n) - , label [ for <| name ++ String.fromInt n ] [ text status ] - ] - ) T.rlistStatus - ++ [ li [] [ a [ href "#", onClickD (RelSet r.id -1 True) ] [ text "remove" ] ] ] - ] - ] - , td [ class "tco2" ] [ RDate.display model.today nfo.released ] - , td [ class "tco3" ] <| List.map langIcon nfo.lang ++ [ releaseTypeIcon nfo.rtype ] - , td [ class "tco4" ] [ a [ href ("/r"++String.fromInt nfo.id), title nfo.original ] [ text nfo.title ] ] + tr [] + [ td [ class "tco1" ] + [ DD.view r.dd r.state (text <| Maybe.withDefault "removing" <| lookup r.status T.rlistStatus) + <| \_ -> + [ ul [] <| List.map (\(n, status) -> + li [ ] [ linkRadio (n == r.status) (RelSet r.id n) [ text status ] ] + ) T.rlistStatus + ++ [ li [] [ a [ href "#", onClickD (RelSet r.id -1 True) ] [ text "remove" ] ] ] + ] ] + , td [ class "tco2" ] [ RDate.display model.today nfo.released ] + , td [ class "tco3" ] <| List.map langIcon nfo.lang ++ [ releaseTypeIcon nfo.rtype ] + , td [ class "tco4" ] [ a [ href ("/r"++String.fromInt nfo.id), title nfo.original ] [ text nfo.title ] ] + ] confirm = div [] |