katalyst-govuk-formbuilder 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/katalyst/govuk/formbuilder/extensions.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d500045cb23ba6da9d6df55b1584249c2b95fadb8e44b0e8ea1fe63f58bbb5a1
|
4
|
+
data.tar.gz: 58dce6296ea70daee510c44a9c8bb403a3aed623cefff5496af5ff08cbe5b25c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37feec9e8a284f7ef6da32ea78543d6c525538485586a13cf7037f8ce8db0f7853111b1becbf8d26f9aeaacf7a164c243803d6adcbac9a4c6773eb5f717ee057
|
7
|
+
data.tar.gz: 956f29c704ddb6f99fe490142560945dc6f5738ec5af99601a7e83d1d1c963345c9720623007c0ca9c6c39215bb653af63e05b38f21d262b1535ddc2bfcf62de
|
@@ -152,6 +152,22 @@ module GOVUKDesignSystemFormBuilder
|
|
152
152
|
@builder.object.class.human_attribute_name(@attribute_name)
|
153
153
|
end
|
154
154
|
end
|
155
|
+
|
156
|
+
class Legend
|
157
|
+
def retrieve_text(supplied_text)
|
158
|
+
supplied_text.presence ||
|
159
|
+
localised_text(:legend).presence ||
|
160
|
+
human_attribute_name.presence ||
|
161
|
+
@attribute_name.to_s.humanize.capitalize.presence
|
162
|
+
end
|
163
|
+
|
164
|
+
def human_attribute_name
|
165
|
+
return unless @object_name.present? && @attribute_name.present?
|
166
|
+
return unless @builder.object&.class.respond_to?(:human_attribute_name)
|
167
|
+
|
168
|
+
@builder.object.class.human_attribute_name(@attribute_name)
|
169
|
+
end
|
170
|
+
end
|
155
171
|
end
|
156
172
|
|
157
173
|
module Containers
|