recordselect 3.9.1 → 3.10.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
- SHA1:
3
- metadata.gz: 8699e5faa12c50de291e07e735d70ef1ea9a6a73
4
- data.tar.gz: b97b4bf9f5380d6808269855df7a51f5733399d3
2
+ SHA256:
3
+ metadata.gz: 2198e9793bbde1712e26290b9140f85819a9bb0e8b0d5df60683db13ec3be619
4
+ data.tar.gz: 2357dbe3a7db125477761a8e27d63eb8f10a86b452229329d3329e5ec32df532
5
5
  SHA512:
6
- metadata.gz: f06cd88ea3637b05d545c0c08efdc908ec5324cf88bc487e8d07964f4f0836f1459f4fff33fce8a0a0835c4e521bf1ecb65a449ccd46f2e789221f021bdc9301
7
- data.tar.gz: f38148405a5c8ffdcb3ef6ab63237a6a54e04e6293b6edca22c2267a481168809a32dee4b93fd28b9767b925a03df89ef26d3b26d58da273259c5b87527abf3e
6
+ metadata.gz: 78e2b2f98c9e3fb8578e4c62fa1b37369d98f3779b5028245f601c474601d1db8996bd4762cf2e767f1b85f7d28af3af797f46f7a42daa6bca472e4a82ed9e94
7
+ data.tar.gz: 20d89bd581307a971042fa7c303145b844fdf390fd128b75c58f351150a3f703163725c2bb9b95222fadb4eb1e31ac4ff27b61c16300a3dfacd67a54057287ad
@@ -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,5 +7,5 @@ record_select_id = record_select_id(controller)
7
7
  <%= render_record_select :partial => 'list', :locals => {:controller => controller, :page => @page, :record_select_id => record_select_id} %>
8
8
  </div>
9
9
  <%= javascript_tag do %>
10
- <%= render :partial => 'highlight', :formats => [:js] %>
11
- <% end %>
10
+ <%= render_record_select(:partial => 'highlight', :formats => [:js]) %>
11
+ <% end %>
@@ -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,2 +1,2 @@
1
1
  RecordSelect.render_page('<%= record_select_id %>', '<%= escape_javascript(render_record_select(:partial => 'list', :locals => {:page => @page})) %>');
2
- <%= render :partial => 'highlight', :formats => [:js] %>
2
+ <%= render_record_select(:partial => 'highlight', :formats => [:js]) %>
@@ -1,5 +1,6 @@
1
1
  en:
2
2
  record_select:
3
+ searching: "Buscando"
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"
@@ -53,12 +53,16 @@ module RecordSelect
53
53
  end
54
54
 
55
55
  def render_record_select(options = {}) #:nodoc:
56
- [:template,:partial].each do |template_name|
56
+ [:template, :partial].each do |template_name|
57
57
  if options[template_name] then
58
58
  options[template_name] = File.join(record_select_views_path, options[template_name])
59
59
  end
60
60
  end
61
- if block_given? then yield options else render options end
61
+ if block_given? then
62
+ yield options
63
+ else
64
+ render options
65
+ end
62
66
  end
63
67
 
64
68
  private
@@ -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 = 1
4
+ MINOR = 10
5
+ PATCH = 2
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.1
4
+ version: 3.10.2
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-15 00:00:00.000000000 Z
13
+ date: 2021-08-09 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.0.8
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: