chobble-forms 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chobble_forms/version.rb +1 -1
- data/views/chobble_forms/_fieldset.html.erb +8 -15
- 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: 860bb933c374f43e12d26f4eace323b8ff6fb993f41327bc3b41880e3e5a3057
|
4
|
+
data.tar.gz: 609618b7bba193338d6c332e37dceeba2f25c10b409d0f592cdb9a1aaea6ccd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19710a350d2b87cc2db7a601504da7481813a398989e5658bb5d0fe93c54f5133dffd7db41318e7c4b15a464ac5629fa7a45cd5286afa0a29deabb0368591578
|
7
|
+
data.tar.gz: 60e6f13389c6c96c56a5e085a472382cb75a734d2523a0b4f1eca547e41171469b071ccedfbd8f43879fe60e7302702bc657ac2a8283c2724e83fb03cb172e62
|
@@ -5,20 +5,10 @@
|
|
5
5
|
raise ArgumentError, "i18n_base is required for form fieldsets" if i18n_base.nil?
|
6
6
|
@_current_i18n_base = i18n_base
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# Remove .fields suffix if present to get to sections level
|
13
|
-
sections_base = i18n_base.sub(/\.fields$/, '')
|
14
|
-
legend_text = t("#{sections_base}.sections.#{local_assigns[:legend_key]}")
|
15
|
-
# Fail loudly if translation is missing
|
16
|
-
if legend_text.start_with?("translation missing:")
|
17
|
-
raise "Missing i18n key: #{sections_base}.sections.#{local_assigns[:legend_key]}"
|
18
|
-
end
|
19
|
-
else
|
20
|
-
legend_text = local_assigns[:legend_key]&.to_s&.humanize || "Section"
|
21
|
-
end
|
8
|
+
sections_base = i18n_base.sub(/\.fields$/, '')
|
9
|
+
legend_i18n_key = "#{sections_base}.sections.#{local_assigns[:legend_key]}"
|
10
|
+
legend_text = t(legend_i18n_key)
|
11
|
+
footer_text = t("#{legend_i18n_key}_footer", default: nil)
|
22
12
|
%>
|
23
13
|
|
24
14
|
<fieldset>
|
@@ -26,4 +16,7 @@
|
|
26
16
|
<legend><%= legend_text %></legend>
|
27
17
|
<% end %>
|
28
18
|
<%= yield %>
|
29
|
-
|
19
|
+
<% if footer_text.present? %>
|
20
|
+
<small><%= footer_text %></small>
|
21
|
+
<% end %>
|
22
|
+
</fieldset>
|