sdr_view_components 0.18.0 → 0.18.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5de046f013212327fcf03eefd5dcbdaa0918dc20a8a33687036d6802ec5f98fe
|
|
4
|
+
data.tar.gz: afe2f59fef8352750a73ee9327e5e39d253571dc7792aa887208b5b072465611
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6452476e378e3df685166323eac91b36a6df362e9b2db163b2fd4dbc4365b7211cab17ede65438b82ad9a9a8133a027372aee706cf2acc24af544a301f803c32
|
|
7
|
+
data.tar.gz: ad821a7e03619fb08e414ddcef5143e59399c11b4c3b6e2899334684cbbeba48a0b35ba62ea9b571c74e129435c57e20d37cba43ebe5cda2d543f3c0b3075c88
|
|
@@ -30,12 +30,27 @@ module SdrViewComponents
|
|
|
30
30
|
|
|
31
31
|
def select(method, choices = nil, options = {}, html_options = {}, &)
|
|
32
32
|
html_options[:form] ||= id
|
|
33
|
-
super
|
|
33
|
+
return super unless html_options[:multiple] && options.fetch(:include_hidden, true)
|
|
34
|
+
|
|
35
|
+
# Rails' hidden blank input (so that selecting nothing is submitted) doesn't get the form attribute.
|
|
36
|
+
select_hidden_field(method, html_options) +
|
|
37
|
+
super(method, choices, options.merge(include_hidden: false), html_options, &)
|
|
34
38
|
end
|
|
35
39
|
|
|
36
40
|
def id
|
|
37
41
|
super || options[:parent_builder]&.id
|
|
38
42
|
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def select_hidden_field(method, html_options)
|
|
47
|
+
hidden_options = { value: '', multiple: true, form: html_options[:form], name: html_options[:name],
|
|
48
|
+
disabled: html_options[:disabled] }.compact
|
|
49
|
+
# Without an id, so that it doesn't duplicate the select's.
|
|
50
|
+
hidden_options[:id] = nil
|
|
51
|
+
hidden_options[:autocomplete] = 'off' unless ActionView::Base.remove_hidden_field_autocomplete
|
|
52
|
+
hidden_field(method, hidden_options)
|
|
53
|
+
end
|
|
39
54
|
end
|
|
40
55
|
end
|
|
41
56
|
end
|