recordselect 4.0.14 → 4.0.16
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/app/assets/javascripts/record_select.js +55 -55
- data/lib/record_select/actions.rb +2 -0
- data/lib/record_select/conditions.rb +2 -0
- data/lib/record_select/config.rb +2 -0
- data/lib/record_select/engine.rb +2 -0
- data/lib/record_select/extensions/active_record.rb +3 -1
- data/lib/record_select/extensions/localization.rb +2 -0
- data/lib/record_select/extensions/routing_mapper.rb +2 -0
- data/lib/record_select/form_builder.rb +2 -0
- data/lib/record_select/helpers/record_select_helper.rb +5 -3
- data/lib/record_select/version.rb +3 -1
- data/lib/record_select.rb +2 -0
- data/lib/recordselect.rb +2 -0
- data/test/recordselect_test.rb +2 -0
- metadata +3 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c273c9f1bd3c8c8135204b82be1780591b2ef96383826f0f366d9d972588eee
|
|
4
|
+
data.tar.gz: 624b5fe2bb099bce6621ed48f7dff1193aef74dfaea422c6f409d4f419007990
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9727bbd6b64bef6b6763d6b76aa7b02c8e11f3efbd920153b8dd91f89cf6359805c6c945d5364c9440c3ca963a6c3c807f57c55584f43c4b74be952165e740fe
|
|
7
|
+
data.tar.gz: b987d403f755fffc2bb574110a5cd179093aa9970d61db924fcbc89577d254ae984ce6898dfe54c3307858522c6e3d552673a05632ff48ab51baa69bf895dc52
|
|
@@ -113,61 +113,6 @@
|
|
|
113
113
|
window.RecordSelect = new Object();
|
|
114
114
|
RecordSelect.document_loaded = false;
|
|
115
115
|
|
|
116
|
-
jQuery(document).ready(function() {
|
|
117
|
-
RecordSelect.document_loaded = true;
|
|
118
|
-
jQuery('[data-rs-type]').each(function() { RecordSelect.from_attributes(jQuery(this)); });
|
|
119
|
-
jQuery(document).on('click', 'div.record-select li.record', function(event) {
|
|
120
|
-
var link = jQuery(this);
|
|
121
|
-
if (link.length) {
|
|
122
|
-
RecordSelect.select_item(link);
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
return true;
|
|
126
|
-
});
|
|
127
|
-
jQuery(document).on('click', '.record-select-option .remove', function(event) {
|
|
128
|
-
var line = jQuery(this).parent(), value = line.find(':input:hidden').val();
|
|
129
|
-
line.parent().data('recordselect').obj.trigger('recordselect:remove', [value]);
|
|
130
|
-
line.remove();
|
|
131
|
-
return false;
|
|
132
|
-
});
|
|
133
|
-
jQuery(document).on('ajax:beforeSend', '.record-select-container', function(event, xhr) {
|
|
134
|
-
var rs = jQuery(this).data('recordselect'), cur = rs.current_xhr, found = jQuery(this).find('.found');
|
|
135
|
-
jQuery(this).find('.record, .pagination').remove();
|
|
136
|
-
found.html(found.data('searching'));
|
|
137
|
-
rs.current_xhr = xhr;
|
|
138
|
-
console.log(rs.current_xhr);
|
|
139
|
-
if (cur) cur.abort();
|
|
140
|
-
});
|
|
141
|
-
jQuery(document).on('ajax:complete', '.record-select-container', function(event, xhr, status) {
|
|
142
|
-
var rs = jQuery(this).data('recordselect');
|
|
143
|
-
if (status != 'abort' || rs.current_xhr == xhr) {
|
|
144
|
-
if (rs.is_open()) rs.show();
|
|
145
|
-
rs.current_xhr = null;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
jQuery(document).on('click', 'input.recordselect ~ .clear-input-button', function(event) {
|
|
149
|
-
var $clear_button = jQuery(event.target), $input = $clear_button.prevAll('input');
|
|
150
|
-
if (!$input.length) return;
|
|
151
|
-
$input.val('').removeClass('selected');
|
|
152
|
-
$clear_button.removeClass('enabled');
|
|
153
|
-
});
|
|
154
|
-
jQuery(document).on('input recordselect:change', 'input.recordselect', function(event) {
|
|
155
|
-
var $clear_button = jQuery(event.target).nextAll('.clear-input-button').first();
|
|
156
|
-
if (!$clear_button.length) return;
|
|
157
|
-
if (jQuery(event.target).val()) $clear_button.addClass('enabled');
|
|
158
|
-
else $clear_button.removeClass('enabled');
|
|
159
|
-
});
|
|
160
|
-
jQuery(document).on('ajax:beforeSend', 'a.rs-mode', function() {
|
|
161
|
-
jQuery(this).closest('.record-select').find('form input[name="rs_mode"]').val(jQuery(this).data('value'));
|
|
162
|
-
});
|
|
163
|
-
jQuery(document).on('focus', 'input.recordselect', function() {
|
|
164
|
-
jQuery(this).prop('focused', true);
|
|
165
|
-
});
|
|
166
|
-
jQuery(document).on('blur', 'input.recordselect', function() {
|
|
167
|
-
jQuery(this).prop('focused', false);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
116
|
RecordSelect.from_attributes = function(item) {
|
|
172
117
|
if (item.prop('disabled')) return;
|
|
173
118
|
var rs_class = RecordSelect[item.attr('data-rs-type')];
|
|
@@ -635,6 +580,61 @@
|
|
|
635
580
|
this.list_container.prepend(entry)
|
|
636
581
|
}
|
|
637
582
|
});
|
|
583
|
+
|
|
584
|
+
jQuery(document).ready(function() {
|
|
585
|
+
RecordSelect.document_loaded = true;
|
|
586
|
+
jQuery('[data-rs-type]').each(function() { RecordSelect.from_attributes(jQuery(this)); });
|
|
587
|
+
jQuery(document).on('click', 'div.record-select li.record', function(event) {
|
|
588
|
+
var link = jQuery(this);
|
|
589
|
+
if (link.length) {
|
|
590
|
+
RecordSelect.select_item(link);
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
return true;
|
|
594
|
+
});
|
|
595
|
+
jQuery(document).on('click', '.record-select-option .remove', function(event) {
|
|
596
|
+
var line = jQuery(this).parent(), value = line.find(':input:hidden').val();
|
|
597
|
+
line.parent().data('recordselect').obj.trigger('recordselect:remove', [value]);
|
|
598
|
+
line.remove();
|
|
599
|
+
return false;
|
|
600
|
+
});
|
|
601
|
+
jQuery(document).on('ajax:beforeSend', '.record-select-container', function(event, xhr) {
|
|
602
|
+
var rs = jQuery(this).data('recordselect'), cur = rs.current_xhr, found = jQuery(this).find('.found');
|
|
603
|
+
jQuery(this).find('.record, .pagination').remove();
|
|
604
|
+
found.html(found.data('searching'));
|
|
605
|
+
rs.current_xhr = xhr;
|
|
606
|
+
console.log(rs.current_xhr);
|
|
607
|
+
if (cur) cur.abort();
|
|
608
|
+
});
|
|
609
|
+
jQuery(document).on('ajax:complete', '.record-select-container', function(event, xhr, status) {
|
|
610
|
+
var rs = jQuery(this).data('recordselect');
|
|
611
|
+
if (status != 'abort' || rs.current_xhr == xhr) {
|
|
612
|
+
if (rs.is_open()) rs.show();
|
|
613
|
+
rs.current_xhr = null;
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
jQuery(document).on('click', 'input.recordselect ~ .clear-input-button', function(event) {
|
|
617
|
+
var $clear_button = jQuery(event.target), $input = $clear_button.prevAll('input');
|
|
618
|
+
if (!$input.length) return;
|
|
619
|
+
$input.val('').removeClass('selected');
|
|
620
|
+
$clear_button.removeClass('enabled');
|
|
621
|
+
});
|
|
622
|
+
jQuery(document).on('input recordselect:change', 'input.recordselect', function(event) {
|
|
623
|
+
var $clear_button = jQuery(event.target).nextAll('.clear-input-button').first();
|
|
624
|
+
if (!$clear_button.length) return;
|
|
625
|
+
if (jQuery(event.target).val()) $clear_button.addClass('enabled');
|
|
626
|
+
else $clear_button.removeClass('enabled');
|
|
627
|
+
});
|
|
628
|
+
jQuery(document).on('ajax:beforeSend', 'a.rs-mode', function() {
|
|
629
|
+
jQuery(this).closest('.record-select').find('form input[name="rs_mode"]').val(jQuery(this).data('value'));
|
|
630
|
+
});
|
|
631
|
+
jQuery(document).on('focus', 'input.recordselect', function() {
|
|
632
|
+
jQuery(this).prop('focused', true);
|
|
633
|
+
});
|
|
634
|
+
jQuery(document).on('blur', 'input.recordselect', function() {
|
|
635
|
+
jQuery(this).prop('focused', false);
|
|
636
|
+
});
|
|
637
|
+
});
|
|
638
638
|
};
|
|
639
639
|
|
|
640
640
|
if (window.jQuery) {
|
data/lib/record_select/config.rb
CHANGED
data/lib/record_select/engine.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module RecordSelectHelper
|
|
2
4
|
# If you use :params option, define this helper in your controller helpers
|
|
3
5
|
# to return array with those params, so _list partial permits them
|
|
@@ -51,7 +53,7 @@ module RecordSelectHelper
|
|
|
51
53
|
options[:controller] ||= current.class.to_s.pluralize.underscore
|
|
52
54
|
options[:params] ||= {}
|
|
53
55
|
options[:id] ||= name.gsub(/[\[\]]/, '_')
|
|
54
|
-
options[:class]
|
|
56
|
+
options[:class] = options[:class] ? options[:class].dup : String.new
|
|
55
57
|
options[:class] << ' recordselect'
|
|
56
58
|
options[:clear_button] = true unless options.include? :clear_button
|
|
57
59
|
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
|
@@ -95,7 +97,7 @@ module RecordSelectHelper
|
|
|
95
97
|
options[:controller] ||= current.class.to_s.pluralize.underscore
|
|
96
98
|
options[:params] ||= {}
|
|
97
99
|
options[:id] ||= name.gsub(/[\[\]]/, '_')
|
|
98
|
-
options[:class]
|
|
100
|
+
options[:class] = options[:class] ? options[:class].dup : String.new
|
|
99
101
|
options[:class] << ' recordselect'
|
|
100
102
|
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
|
101
103
|
|
|
@@ -132,7 +134,7 @@ module RecordSelectHelper
|
|
|
132
134
|
options[:controller] ||= current.first.class.to_s.pluralize.underscore
|
|
133
135
|
options[:params] ||= {}
|
|
134
136
|
options[:id] ||= name.gsub(/[\[\]]/, '_')
|
|
135
|
-
options[:class]
|
|
137
|
+
options[:class] = options[:class] ? options[:class].dup : String.new
|
|
136
138
|
options[:class] << ' recordselect'
|
|
137
139
|
options.delete(:name)
|
|
138
140
|
js = options.include?(:js) ? options.delete(:js) : request.xhr?
|
data/lib/record_select.rb
CHANGED
data/lib/recordselect.rb
CHANGED
data/test/recordselect_test.rb
CHANGED
metadata
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
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.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergio Cambra
|
|
8
8
|
- Volker Hochstein
|
|
9
9
|
- Lance Ivy
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
|
-
- !ruby/object:Gem::Dependency
|
|
16
|
-
name: bundler
|
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
|
18
|
-
requirements:
|
|
19
|
-
- - "~>"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.0.0
|
|
22
|
-
type: :development
|
|
23
|
-
prerelease: false
|
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
requirements:
|
|
26
|
-
- - "~>"
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
version: 1.0.0
|
|
29
14
|
- !ruby/object:Gem::Dependency
|
|
30
15
|
name: rails
|
|
31
16
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,7 +67,6 @@ homepage: http://github.com/scambra/recordselect
|
|
|
82
67
|
licenses:
|
|
83
68
|
- MIT
|
|
84
69
|
metadata: {}
|
|
85
|
-
post_install_message:
|
|
86
70
|
rdoc_options: []
|
|
87
71
|
require_paths:
|
|
88
72
|
- lib
|
|
@@ -97,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
81
|
- !ruby/object:Gem::Version
|
|
98
82
|
version: '0'
|
|
99
83
|
requirements: []
|
|
100
|
-
rubygems_version: 3.
|
|
101
|
-
signing_key:
|
|
84
|
+
rubygems_version: 3.6.9
|
|
102
85
|
specification_version: 4
|
|
103
86
|
summary: RecordSelect widget as a replacement for massive drop down lists
|
|
104
87
|
test_files:
|