field2: add 'pwt-pointer' class to peek_icon
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 2 Oct 2023 10:03:17 +0000 (12:03 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Mon, 2 Oct 2023 10:03:17 +0000 (12:03 +0200)
so it appears clickable, also translate the tooltips

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/widget/form/field2.rs

index 90105f37da2d591dceede740c8b10a3239b9eef6..b23613794179ca3f8fa9dc9b53ae1a96dbee8e0f 100644 (file)
@@ -344,14 +344,17 @@ impl ManagedField for StandardField {
                         Msg::HidePassword
                     }
                 });
-                // TODO: Localize the tooltip_text with gettext.
-                let (icon_class, tooltip_text) = if is_hidden {
-                    ("fa fa-eye", "Show Text")
+                let class = classes!(
+                    "fa",
+                    if is_hidden { "fa-eye" } else { "fa-eye-slash" },
+                    "pwt-pointer"
+                );
+                let tooltip_text = if is_hidden {
+                    tr!("Show Password")
                 } else {
-                    ("fa fa-eye-slash", "Hide Text")
+                    tr!("Hide Password")
                 };
-                let peek_icon = html! { <i class={icon_class} onclick={onclick}/> };
-                Some(Tooltip::new(peek_icon).tip(tooltip_text))
+                Some(Tooltip::new(html! { <i {class} {onclick}/> }).tip(tooltip_text))
             } else {
                 None
             };