recordselect 3.9.2 → 3.10.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
- SHA1:
3
- metadata.gz: 39316811206d9b93b95f08928b3f2fa84f1f8aea
4
- data.tar.gz: 3ba41c4b7d82e76e945e0cdc6b191fa0e026bc02
2
+ SHA256:
3
+ metadata.gz: 58e05023b54997c064a2d7a8bb02ef6151acfaaffd9a08f4d10ffdb8cd0dccf1
4
+ data.tar.gz: 506a4c828e5cdbdb55a804956f45b6cfed42c0b39cb1acac19d03f0de1c1080f
5
5
  SHA512:
6
- metadata.gz: 5cdd77053e962683595c9a6fc469952295431884eda80b4e9893d1b546bc9f79e7b33cff65f33fcfeab360efcbf49a7b466136cd6fb0ae4a7100d3e90de7f919
7
- data.tar.gz: bf10fb693fa2a85e2bdf0aef2904a48d1837143f039103765a77884a12d096f8584a56bbc55da8bf7d5feced97725ec34a6daf86dca2a45e66211245ff5eed97
6
+ metadata.gz: 3e4a27654b8073a8bbd056114516b602e5b5360522fc8840491e1dbd74fb1c4296810b736757b1f1c57247565a48146e249a3532e95041fdfe4defa5fff5cdf3
7
+ data.tar.gz: ef50ef893fbdce231b0ca8d0299c42e0a15c37d8f4fdc257c467a223fb12cdeb69c006807489117b41c48dc5a7d7ebfb47a189f41b72d922c5ccb48ac7a40ba8
@@ -80,7 +80,7 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
80
80
  var el = $(this);
81
81
  var op = options || {};
82
82
  el.data('oldval', el.val())
83
- .data('delay', delay || 0.5)
83
+ .data('delay', delay === 0 ? delay : (delay || 0.5))
84
84
  .data('condition', op.condition || function() { return ($(this).data('oldval') == $(this).val()); })
85
85
  .data('callback', callback)
86
86
  [(op.event||'keyup')](function(){
@@ -117,8 +117,11 @@ jQuery(document).ready(function() {
117
117
  return false;
118
118
  });
119
119
  jQuery(document).on('ajax:beforeSend', '.record-select-container', function(event, xhr) {
120
- var rs = jQuery(this).data('recordselect'), cur = rs.current_xhr;
120
+ var rs = jQuery(this).data('recordselect'), cur = rs.current_xhr, found = jQuery(this).find('.found');
121
+ jQuery(this).find('.record, .pagination').remove();
122
+ found.html(found.data('searching'));
121
123
  rs.current_xhr = xhr;
124
+ console.log(rs.current_xhr);
122
125
  if (cur) cur.abort();
123
126
  });
124
127
  jQuery(document).on('ajax:complete', '.record-select-container', function(event, xhr, status) {
@@ -154,7 +157,9 @@ RecordSelect.observe = function(form) {
154
157
  var callback = function() {
155
158
  if (form.closest('body').length) form.trigger("submit");
156
159
  };
157
- form.find('input.text-input').delayedObserver(callback, 0.35, {
160
+ var delay = parseFloat(rs.obj.data('rsDelay'));
161
+ if (isNaN(delay)) delay = 0.35;
162
+ form.find('input.text-input').delayedObserver(callback, delay, {
158
163
  condition: function() {
159
164
  var item = jQuery(this);
160
165
  return item.data('oldval') == item.val() || item.val().length < min_length;
@@ -534,7 +539,7 @@ RecordSelect.Autocomplete = RecordSelect.Abstract.extend({
534
539
  if (this.options.label) this.set(this.options.label);
535
540
 
536
541
  this._respond_to_text_field(this.obj);
537
- if (this.obj.focused) this.open(); // if it was focused before we could attach observers
542
+ if (this.obj.prop('focused')) this.open(); // if it was focused before we could attach observers
538
543
  },
539
544
 
540
545
  close: function() {
@@ -587,7 +592,7 @@ RecordSelect.Multiple = RecordSelect.Abstract.extend({
587
592
  }
588
593
 
589
594
  this._respond_to_text_field(this.obj);
590
- if (this.obj.focused) this.open(); // if it was focused before we could attach observers
595
+ if (this.obj.prop('focused')) this.open(); // if it was focused before we could attach observers
591
596
  },
592
597
 
593
598
  onselect: function(id, value, text, item) {
@@ -7,8 +7,8 @@ prev_url = url_for(pagination_url_params.merge(:page => page.prev.number)) if pa
7
7
  next_url = url_for(pagination_url_params.merge(:page => page.next.number)) if page.next?
8
8
  -%>
9
9
  <%= content_tag :ol, :class => ('scrollable' unless record_select_config.pagination?) do %>
10
- <li class="found"><%= rs_(:records_found, :count => page.pager.count,
11
- :model => record_select_config.model.model_name.human(:count => page.pager.count).downcase) %></li>
10
+ <%= content_tag :li, rs_(:records_found, :count => page.pager.count,
11
+ :model => record_select_config.model.model_name.human(:count => page.pager.count).downcase), class: 'found', data: {searching: rs_(:searching)} %>
12
12
  <% if page.prev? -%>
13
13
  <li class="pagination previous">
14
14
  <%= link_to image_tag('record_select/previous.gif', :alt => rs_(:previous)) + " " + rs_(:previous_items,
@@ -1,5 +1,6 @@
1
1
  en:
2
2
  record_select:
3
+ searching: "Searching"
3
4
  next: "Next"
4
5
  next_items: "Next %{count}"
5
6
  previous: "Previous"
@@ -1,5 +1,6 @@
1
1
  es:
2
2
  record_select:
3
+ searching: "Buscando"
3
4
  next: "Siguiente"
4
5
  next_items:
5
6
  one: "Siguente"
@@ -4,10 +4,10 @@
4
4
  class Object
5
5
  def rs_(key, options = {})
6
6
  unless key.blank?
7
- text = I18n.translate "#{key}", {:scope => [:record_select], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
7
+ text = I18n.translate "#{key}", **{:scope => [:record_select], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
8
8
  # text = nil if text.include?('translation missing:')
9
9
  end
10
- text ||= key
10
+ text ||= key
11
11
  text
12
12
  end
13
13
  end
@@ -1,8 +1,8 @@
1
1
  module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 9
5
- PATCH = 2
4
+ MINOR = 10
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recordselect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.2
4
+ version: 3.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  - Volker Hochstein
9
9
  - Lance Ivy
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-02-20 00:00:00.000000000 Z
13
+ date: 2022-02-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -84,7 +84,7 @@ homepage: http://github.com/scambra/recordselect
84
84
  licenses:
85
85
  - MIT
86
86
  metadata: {}
87
- post_install_message:
87
+ post_install_message:
88
88
  rdoc_options: []
89
89
  require_paths:
90
90
  - lib
@@ -99,9 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.6.10
104
- signing_key:
102
+ rubygems_version: 3.3.7
103
+ signing_key:
105
104
  specification_version: 4
106
105
  summary: RecordSelect widget as a replacement for massive drop down lists
107
106
  test_files: