effective_bootstrap 1.19.2 → 1.19.4
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: d38e3aeed6ac436788cde46ed41d2526d0965fb8c07c91671bfa2d348d66d72e
|
4
|
+
data.tar.gz: 3dc6dab7793b5979a2da94f373b861e381bec4f43af7ae9d0bd9c207446b289b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a884258ed006d5282fd2e37509232e203fbaffc5357a3aa94deeb8eef360edff0b9a2b0223756c540019e5b08d4db0e0c23b906f2a8048d6b00fd559ae01bba1
|
7
|
+
data.tar.gz: eaf25457e6a73a2c664286c074cacf32e99010ebb591c1573a45d11cf9853c36b1e035587a6f26b9d985ac05d6634deb078b273ee88eb826c72522c5574a541a
|
@@ -16,6 +16,12 @@ $(document).on('click', '[data-effective-select-or-text]', function(event) {
|
|
16
16
|
$visible_input = $visible.find('input,textarea,select').first()
|
17
17
|
$hidden_input = $hidden.find('input,textarea,select').first()
|
18
18
|
|
19
|
+
if ($visible.find('select').length > 0) {
|
20
|
+
$obj.removeClass('select-enabled').addClass('text-enabled')
|
21
|
+
} else {
|
22
|
+
$obj.removeClass('text-enabled').addClass('select-enabled')
|
23
|
+
}
|
24
|
+
|
19
25
|
required = $visible_input.prop('required') || $hidden_input.prop('required')
|
20
26
|
|
21
27
|
$hidden_input.prop('required', required)
|
@@ -65,6 +65,12 @@ module Effective
|
|
65
65
|
def assign_options_collection!
|
66
66
|
super
|
67
67
|
|
68
|
+
if ajax? && !include_null
|
69
|
+
if options_collection.kind_of?(Array) && options_collection.first.respond_to?(:to_select2)
|
70
|
+
@options_collection = options_collection.map { |obj| [obj.to_select2, obj.to_param] }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
68
74
|
return unless include_null
|
69
75
|
|
70
76
|
# Check for singles - transform the array
|
@@ -15,11 +15,19 @@ module Effective
|
|
15
15
|
@name_text = options.delete(:name_text) || raise('Please include a text method name')
|
16
16
|
@select_collection = options.delete(:collection) || raise('Please include a collection')
|
17
17
|
|
18
|
-
@
|
19
|
-
.merge(options[:select] || options.presence || {})
|
18
|
+
@shared_options = (options[:input_html] || {})
|
20
19
|
|
21
|
-
@
|
22
|
-
|
20
|
+
@select_options = {
|
21
|
+
placeholder: '',
|
22
|
+
hint: "Can't find your #{(options[:name] || name).to_s.chomp('_id')}? <a class='effective-select-or-text-switch' title='Switch to enter freeform' data-effective-select-or-text='true' href='#'>Click here</a> to add one",
|
23
|
+
required: false,
|
24
|
+
}.merge(options[:select] || options.presence || {}).merge(@shared_options)
|
25
|
+
|
26
|
+
@text_options = {
|
27
|
+
placeholder: '',
|
28
|
+
hint: "Looking for an existing #{(options[:name] || name).to_s.chomp('_id')}? <a class='effective-select-or-text-switch' title='Switch to search for existing' data-effective-select-or-text='true' href='#'>Click here</a> to search",
|
29
|
+
required: false
|
30
|
+
}.merge(options[:text] || options[:text_field] || options.presence || {}).merge(@shared_options)
|
23
31
|
|
24
32
|
@email_field = options.fetch(:email, name_text.to_s.include?('email'))
|
25
33
|
|
@@ -27,15 +35,16 @@ module Effective
|
|
27
35
|
end
|
28
36
|
|
29
37
|
def to_html(&block)
|
30
|
-
|
38
|
+
wrapper_class = ['effective-select-or-text', (select? ? 'select-enabled' : 'text-enabled'), options.dig(:wrapper, :class)].compact.join(' ')
|
39
|
+
|
40
|
+
content_tag(:div, (options[:wrapper] || {}).merge(class: wrapper_class)) do
|
31
41
|
if select?
|
32
42
|
@builder.send(email_field? ? :email_field : :text_field, name_text, text_options) +
|
33
43
|
@builder.select(name, select_collection, select_options)
|
34
44
|
else
|
35
45
|
@builder.select(name, select_collection, select_options) +
|
36
46
|
@builder.send(email_field? ? :email_field : :text_field, name_text, text_options)
|
37
|
-
end
|
38
|
-
link_to(icon('rotate-ccw'), '#', class: 'effective-select-or-text-switch', title: 'Switch between choice and freeform', 'data-effective-select-or-text': true)
|
47
|
+
end
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.19.
|
4
|
+
version: 1.19.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|