summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--css/v2.css11
-rw-r--r--elm/Lib/Html.elm11
-rw-r--r--elm/UList/LabelEdit.elm13
-rw-r--r--elm/UList/Widget.elm7
4 files changed, 32 insertions, 10 deletions
diff --git a/css/v2.css b/css/v2.css
index b2d8c586..c65d953e 100644
--- a/css/v2.css
+++ b/css/v2.css
@@ -671,7 +671,8 @@ div#vntags { margin: 0 30px 0 30px; border-top: 1px solid $bo
.vngrid > div > a > span:first-child { display: block; font-weight: bold }
.vngrid table { margin: 10px 0 }
.vngrid table td { padding: 0 5px 0 0 }
-.vngrid .ulist-widget-icon { float: right; margin: 280px 0 -300px -20px!important; padding: 3px; width: 20px; height: 20px } /* Horrible hacks everywhere */
+.vngrid .ulist-widget-icon { float: right; margin: 280px 0 -300px -20px!important; padding: 3px } /* Horrible hacks everywhere */
+.vngrid .ulist-widget-icon img { width: 20px; height: 20px }
@@ -680,7 +681,7 @@ div#vntags { margin: 0 30px 0 30px; border-top: 1px solid $bo
.prodvns { list-style-type: none }
.prodvns li > span:first-child { display: inline-block; width: 80px; text-align: right; padding-right: 15px }
.prodvns li > span:last-child { color: $grayedout; padding-left: 15px }
-.prodvns .ulist-widget-icon { padding-right: 5px; width: 14px; height: 14px }
+.prodvns .ulist-widget-icon { padding-right: 5px }
/***** Producer list ******/
@@ -965,6 +966,12 @@ div.lengthlist {
.tco3 { width: 60px; text-align: right; padding-bottom: 0 }
}
+/* Just kill me already */
+[id^=ulist_labeledit] li > a {
+ padding-right: 30px!important;
+ .liststatus_icon, .spinner { float: right; margin-right: -26px; margin-top: 2px }
+}
+
/***** User notifications *****/
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm
index 3f13dbee..08648d55 100644
--- a/elm/Lib/Html.elm
+++ b/elm/Lib/Html.elm
@@ -210,3 +210,14 @@ platformIcon l = img [ class "platicon", src <| Ffi.urlStatic ++ "/f/plat/" ++ l
releaseTypeIcon : String -> Html m
releaseTypeIcon t = abbr [ class ("icons rt"++t), title (Maybe.withDefault "" <| lookup t T.releaseTypes) ] [ text " " ]
+
+-- Special values: -1 = "add to list", not 1-6 = unknown
+-- (Because why use the type system to encode special values?)
+ulistIcon : Int -> String -> Html m
+ulistIcon n lbl =
+ let fn = if n == -1 then "add"
+ else if n >= 1 && n <= 6 then "l" ++ String.fromInt n
+ else "unknown"
+ in img [ src (Ffi.urlStatic ++ "/f/list-" ++ fn ++ ".svg")
+ , class ("liststatus_icon "++fn), title lbl
+ ] []
diff --git a/elm/UList/LabelEdit.elm b/elm/UList/LabelEdit.elm
index f6a60d3b..d1bdc865 100644
--- a/elm/UList/LabelEdit.elm
+++ b/elm/UList/LabelEdit.elm
@@ -84,21 +84,26 @@ update msg model =
view : Model -> String -> Html Msg
view model txt =
let
- str = String.join ", " <| List.filterMap (\l -> if l.id /= 7 && Set.member l.id model.sel then Just l.label else Nothing) model.labels
+ lbl = List.intersperse (text ", ") <| List.filterMap (\l ->
+ if l.id /= 7 && Set.member l.id model.sel
+ then Just <| span []
+ [ if l.id <= 6 && txt /= "-" then ulistIcon l.id l.label else text ""
+ , text (" " ++ l.label) ]
+ else Nothing) model.labels
item l =
li [ ]
[ linkRadio (Set.member l.id model.tsel) (Toggle l.id True)
[ 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.Loading -> span [ class "spinner" ] []
Just (Api.Error _) -> b [ class "standout" ] [ text "error" ] -- Need something better
- _ -> text ""
+ _ -> if l.id <= 6 then ulistIcon l.id l.label else text ""
]
]
in
DD.view model.dd
(if List.any (\s -> s == Api.Loading) <| Dict.values model.state then Api.Loading else Api.Normal)
- (text <| if str == "" then txt else str)
+ (if List.isEmpty lbl then text txt else span [] lbl)
(\_ -> [ ul [] <| List.map item <| List.filter (\l -> l.id /= 7) model.labels ])
diff --git a/elm/UList/Widget.elm b/elm/UList/Widget.elm
index ec4375a5..0b25fd24 100644
--- a/elm/UList/Widget.elm
+++ b/elm/UList/Widget.elm
@@ -248,15 +248,14 @@ view : Model -> Html Msg
view model =
let
icon () =
- let fn = if not model.onlist then "add"
+ let fn = if not model.onlist then -1
else List.range 1 6
|> List.filter (\n -> Set.member n model.labels.tsel)
|> List.maximum
- |> Maybe.map (\n -> "l" ++ String.fromInt n)
- |> Maybe.withDefault "unknown"
+ |> Maybe.withDefault 0
lbl = if not model.onlist then "Add to list"
else String.join ", " <| List.filterMap (\l -> if Set.member l.id model.labels.tsel && l.id /= 7 then Just l.label else Nothing) model.labels.labels
- in img [ src (Ffi.urlStatic ++ "/f/list-" ++ fn ++ ".svg"), class ("ulist-widget-icon liststatus_icon "++fn), title lbl, onClickN (Open True) ] []
+ in span [ onClickN (Open True), class "ulist-widget-icon" ] [ ulistIcon fn lbl ]
rel r =
case Dict.get r.rid model.relNfo of