recordselect 4.0.0 → 4.0.2
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: 0e5ff734695b0b0234dd6ee6307440e1de3a3a72f87798026b18b0e0739e26b1
|
4
|
+
data.tar.gz: a12a0c135cc28dcc72121be2361233b347c0915c8590f31aab566d97b28467fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2149f1cfa9f94456836fd71d3c5a3f6d4e636c01d8fb3b0c9ea2138b785f902513ec9824c9e9f489099dde7cd544356aa55c93d710a8ba510a8490fe7135a6d2
|
7
|
+
data.tar.gz: ea348566bafb9430145039802fcdd8c7bb7053f025e0bde06520a79a1974b6d7dbb7b72c0af3005696149e8ff56a2be6cd7bee236b8ffd96e884d015b2c7eb9f
|
@@ -142,7 +142,7 @@
|
|
142
142
|
rs.current_xhr = null;
|
143
143
|
}
|
144
144
|
});
|
145
|
-
jQuery(document).on('click', 'input.recordselect ~ .clear-input-button', function() {
|
145
|
+
jQuery(document).on('click', 'input.recordselect ~ .clear-input-button', function(event) {
|
146
146
|
var $clear_button = jQuery(event.target), $input = $clear_button.prevAll('input');
|
147
147
|
if (!$input.length) return;
|
148
148
|
$input.val('').removeClass('selected');
|
@@ -163,8 +163,9 @@
|
|
163
163
|
RecordSelect.document_loaded = false;
|
164
164
|
|
165
165
|
RecordSelect.from_attributes = function(item) {
|
166
|
+
if (item.prop('disabled')) return;
|
166
167
|
var rs_class = RecordSelect[item.data('rs-type')];
|
167
|
-
new rs_class(item.data('rs-id'), item.data('rs-url'), item.data('rs-options'));
|
168
|
+
new rs_class(item.data('rs-id') || item, item.data('rs-url'), item.data('rs-options'));
|
168
169
|
}
|
169
170
|
|
170
171
|
RecordSelect.select_item = function(item) {
|
@@ -227,7 +228,8 @@
|
|
227
228
|
if (RecordSelect.document_loaded) {
|
228
229
|
this.onload();
|
229
230
|
} else {
|
230
|
-
var _this = this;
|
231
|
+
var _this = this;
|
232
|
+
jQuery(document).ready(function() { _this.onload(); });
|
231
233
|
}
|
232
234
|
},
|
233
235
|
|
@@ -336,7 +338,7 @@
|
|
336
338
|
* returns true/false for whether the recordselect is open
|
337
339
|
*/
|
338
340
|
is_open: function() {
|
339
|
-
return
|
341
|
+
return this.container.children().length != 0;
|
340
342
|
},
|
341
343
|
|
342
344
|
/**
|
@@ -21,15 +21,16 @@ module RecordSelectHelper
|
|
21
21
|
options[:onselect] = "(function(id, label) {#{options[:onselect]}})" if options[:onselect]
|
22
22
|
options[:html] ||= {}
|
23
23
|
options[:html][:id] ||= "rs_#{rand(9999)}"
|
24
|
+
js = options.include?(:js) ? options[:js] : request.xhr?
|
24
25
|
|
25
26
|
controller = assert_controller_responds(options[:params][:controller])
|
26
27
|
record_select_options = {id: record_select_id(controller.controller_path), onselect: options[:onselect] || ''}
|
27
28
|
record_select_options.merge! options[:rs] if options[:rs]
|
28
29
|
|
29
30
|
rs_data = {type: 'Dialog', id: options[:html][:id], url: url_for(options[:params]), options: record_select_options}
|
30
|
-
options[:html][:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless
|
31
|
+
options[:html][:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless js
|
31
32
|
html = link_to(name, '#', options[:html])
|
32
|
-
html << record_select_js(**rs_data) if
|
33
|
+
html << record_select_js(**rs_data) if js
|
33
34
|
|
34
35
|
html
|
35
36
|
end
|
@@ -53,6 +54,7 @@ module RecordSelectHelper
|
|
53
54
|
options[:class] ||= ''
|
54
55
|
options[:class] << ' recordselect'
|
55
56
|
options[:clear_button] = true unless options.include? :clear_button
|
57
|
+
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
56
58
|
|
57
59
|
controller = assert_controller_responds(options.delete(:controller))
|
58
60
|
params = options.delete(:params)
|
@@ -70,10 +72,10 @@ module RecordSelectHelper
|
|
70
72
|
options.merge!(autocomplete: 'off', onfocus: "this.focused=true", onblur: "this.focused=false")
|
71
73
|
url = url_for({action: :browse, controller: controller.controller_path}.merge(params))
|
72
74
|
rs_data = {type: 'Single', id: options[:id], url: url, options: record_select_options}
|
73
|
-
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless
|
75
|
+
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless js
|
74
76
|
html = text_field_tag(name, nil, options)
|
75
77
|
html << button_tag('x', type: :button, class: clear_button_class, aria_label: 'Clear input', title: 'Clear input') if clear_button
|
76
|
-
html << record_select_js(**rs_data) if
|
78
|
+
html << record_select_js(**rs_data) if js
|
77
79
|
|
78
80
|
html
|
79
81
|
end
|
@@ -95,6 +97,7 @@ module RecordSelectHelper
|
|
95
97
|
options[:id] ||= name.gsub(/[\[\]]/, '_')
|
96
98
|
options[:class] ||= ''
|
97
99
|
options[:class] << ' recordselect'
|
100
|
+
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
98
101
|
|
99
102
|
controller = assert_controller_responds(options.delete(:controller))
|
100
103
|
params = options.delete(:params)
|
@@ -107,9 +110,9 @@ module RecordSelectHelper
|
|
107
110
|
options.merge!(autocomplete: 'off', onfocus: "this.focused=true", onblur: "this.focused=false")
|
108
111
|
url = url_for({action: :browse, controller: controller.controller_path}.merge(params))
|
109
112
|
rs_data = {type: 'Autocomplete', id: options[:id], url: url, options: record_select_options}
|
110
|
-
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless
|
113
|
+
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless js
|
111
114
|
html = text_field_tag(name, nil, options)
|
112
|
-
html << record_select_js(**rs_data) if
|
115
|
+
html << record_select_js(**rs_data) if js
|
113
116
|
|
114
117
|
html
|
115
118
|
end
|
@@ -132,6 +135,7 @@ module RecordSelectHelper
|
|
132
135
|
options[:class] ||= ''
|
133
136
|
options[:class] << ' recordselect'
|
134
137
|
options.delete(:name)
|
138
|
+
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
135
139
|
|
136
140
|
controller = assert_controller_responds(options.delete(:controller))
|
137
141
|
params = options.delete(:params)
|
@@ -142,11 +146,11 @@ module RecordSelectHelper
|
|
142
146
|
options.merge!(autocomplete: 'off', onfocus: "this.focused=true", onblur: "this.focused=false")
|
143
147
|
url = url_for({action: :browse, controller: controller.controller_path}.merge(params))
|
144
148
|
rs_data = {type: 'Multiple', id: options[:id], url: url, options: record_select_options}
|
145
|
-
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless
|
149
|
+
options[:data] = rs_data.transform_keys { |k| "rs_#{k}" } unless js
|
146
150
|
html = text_field_tag("#{name}[]", nil, options)
|
147
151
|
html << hidden_field_tag("#{name}[]", '', id: nil)
|
148
152
|
html << content_tag(:ul, '', class: 'record-select-list')
|
149
|
-
html << record_select_js(**rs_data) if
|
153
|
+
html << record_select_js(**rs_data) if js
|
150
154
|
|
151
155
|
html
|
152
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordselect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Cambra
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.5.
|
100
|
+
rubygems_version: 3.5.11
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: RecordSelect widget as a replacement for massive drop down lists
|