glib-web 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 475f70869ed2e476e536ca4d45eba093616c9f37
|
4
|
+
data.tar.gz: b2db4e4b640976122e49dab51e179160ba992e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5054f0eaef4ef2f9fe67b57529b5e671e7acdb2165549c175f7db9e0ab24765b5dec6d00d783bbedc6b110d6e39dc648d9f7f3ade9e109648cb66b625e6fa3a3
|
7
|
+
data.tar.gz: c008a419d862bb0e718a4a83ccd6867ab6f6bd3e1cb8177e0104aa2ad8ed6d298a058cb1a366b37fe263e58a8ee4ece72c3a048a225513c48af4d7bc4195f42e
|
@@ -18,6 +18,14 @@ class Glib::JsonUi::ViewBuilder
|
|
18
18
|
@hint_args = hint_args
|
19
19
|
end
|
20
20
|
|
21
|
+
def placeholder(placeholder)
|
22
|
+
@placeholder = placeholder
|
23
|
+
end
|
24
|
+
|
25
|
+
def placeholder_args(placeholder_args)
|
26
|
+
@placeholder_args = placeholder_args
|
27
|
+
end
|
28
|
+
|
21
29
|
def name(name)
|
22
30
|
@name = name if name != Glib::Value::DEFAULT
|
23
31
|
end
|
@@ -41,11 +49,17 @@ class Glib::JsonUi::ViewBuilder
|
|
41
49
|
@value ||= form.field_value(@prop)
|
42
50
|
@label ||= form.field_label(@prop, @label_args || {})
|
43
51
|
@hint ||= form.hint_label(@prop, @hint_args || {})
|
52
|
+
@placeholder ||= form.placeholder_label(@prop, @placeholder_args || {})
|
44
53
|
end
|
45
54
|
json.name @name
|
46
55
|
json.value @value if @value
|
47
56
|
json.label @label if @label
|
48
57
|
json.hint @hint if @hint
|
58
|
+
|
59
|
+
# In general, use hint over placeholder for the following reasons:
|
60
|
+
# - Placeholder gets hidden when there is input which may be confusing
|
61
|
+
# - Placeholder competes with label for space
|
62
|
+
json.placeholder @placeholder if @placeholder
|
49
63
|
end
|
50
64
|
|
51
65
|
end
|
@@ -29,9 +29,13 @@ class Glib::JsonUi::ViewBuilder
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def hint_label(prop, args)
|
32
|
-
I18n.t("
|
32
|
+
I18n.t("dt_models.#{@model_name}.#{prop}.hint", args.merge(default: nil))
|
33
33
|
end
|
34
34
|
|
35
|
+
def placeholder_label(prop, args)
|
36
|
+
I18n.t("dt_models.#{@model_name}.#{prop}.placeholder", args.merge(default: nil))
|
37
|
+
end
|
38
|
+
|
35
39
|
def url(url)
|
36
40
|
@url = url
|
37
41
|
end
|