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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0100b104f501f0cb53f9a7e3f00dcdf1b26ce8d30b3e5164b27bce921d664439
4
- data.tar.gz: 5dabad84d0fd1e4503fae52f5b849ad1b01dc8fd725218cd6edc818ae1ecd7db
3
+ metadata.gz: 9c273c9f1bd3c8c8135204b82be1780591b2ef96383826f0f366d9d972588eee
4
+ data.tar.gz: 624b5fe2bb099bce6621ed48f7dff1193aef74dfaea422c6f409d4f419007990
5
5
  SHA512:
6
- metadata.gz: c0ebca023d277014a9c8ee81504bda18e58b138e9c76025a94a84c76702c599d92eaed973d94167ba372acc67a9158d92dda55823a65dc011a4613956c14be10
7
- data.tar.gz: b1c67959d8a54063ce08e4755b49021f298b976c87ab1c347a2aa9bb75fefd639fd0c87ea637000542c565f1cfd3e840431e8962cf43d3999bc4eb4387777dd0
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) {
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  module Actions
3
5
  # :method => :get
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  module Conditions
3
5
  protected
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  # a write-once configuration object
3
5
  class Config
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  class Engine < Rails::Engine
3
5
  initializer 'recordselect.action_controller' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveRecord # :nodoc:
2
4
  class Base # :nodoc:
3
5
  unless method_defined? :to_label
@@ -6,4 +8,4 @@ module ActiveRecord # :nodoc:
6
8
  end
7
9
  end
8
10
  end
9
- end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Provides a simple pass-through localizer for RecordSelect. If you want
2
4
  # to localize RS, you need to override this method and route it to your
3
5
  # own system.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionDispatch
2
4
  module Routing
3
5
  class Mapper
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  module FormBuilder
3
5
  def record_select(association, options = {})
@@ -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] ||= String.new
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] ||= String.new
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] ||= String.new
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?
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  module Version
3
5
  MAJOR = 4
4
6
  MINOR = 0
5
- PATCH = 14
7
+ PATCH = 16
6
8
 
7
9
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
10
  end
data/lib/record_select.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RecordSelect
2
4
  def self.included(base)
3
5
  base.send :extend, ClassMethods
data/lib/recordselect.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'record_select'
2
4
  require 'record_select/extensions/localization'
3
5
  require 'record_select/extensions/active_record'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'test/unit'
3
5
  require 'active_support'
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.14
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: 2026-07-15 00:00:00.000000000 Z
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.5.11
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: