effective_bootstrap 1.19.2 → 1.19.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 300f02e7b6b2330abf3c481bc1f25fba946452a2645e8b8563de189260edcdfa
|
4
|
+
data.tar.gz: 54bf157e0565aeb433d5c8ba7bf192823f4bc6fcedeed665ff6533fa5addc935
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4a22fed5a95d87fc8a83c49e612d065d1ce72b11149afe117cc08ddfce2e050904c5644a43ad513245c93bcfecbe4f5e8089db8c2f171c4e13de0583b35e8bb
|
7
|
+
data.tar.gz: cb7f2aa5c848d3dadbd6413d6a4232db808a272d2faf77671bd169b324387d00143826ac82a7bc744e1a8160abd5edc7e7370d6e8bb27593220607bbf036841b
|
@@ -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)
|
@@ -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.3
|
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-08-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|