recordselect 3.8.6 → 3.8.7

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
  SHA1:
3
- metadata.gz: e3ac1254baf6c4a25347fbe76a7a4380769038a0
4
- data.tar.gz: c45df6652c0984e1e32209bb75874f433e9d80a0
3
+ metadata.gz: ff4978fb44cb07addd937f88deef34ba053e688b
4
+ data.tar.gz: cb0ba01564718643830e4512aa64fa7b25b4abd9
5
5
  SHA512:
6
- metadata.gz: 194ace026298bd24c2b0340ad0f9a887427ef1f33958c1ce652f83a08b5bb8b8494aa23b6979a2dc9959484f6b4fb5036c4d3f6e544aed587fe82db91ea93a31
7
- data.tar.gz: 02f1e8f4c554a844d5fd44099d1ab8afc778c3531814a74bfa0802d3f3de9c4808186f66c2da86a74350b153c28b421835337c3bf313bd9985bdf9fbc496c737
6
+ metadata.gz: 20e9e55335923f68dcc525e56d2162702c4c2bbd2ff618fe1161e80f999ea63ccfda835f973e2d6309194c1d164ced896b18b66b2b25629309cc142d40459483
7
+ data.tar.gz: 009e8a789271d1cc341a2425103c3e30a90f07a73ce897ec35933c1ea85135bc1b604ac63e57714c832cba71250e3a8af0a3720b1dafef2b497d934bd295c2a7
@@ -151,13 +151,16 @@ RecordSelect.observe = function(form) {
151
151
  form = jQuery(form);
152
152
  var min_length = 0, rs = form.closest('.record-select-container').data('recordselect');
153
153
  if (rs) min_length = rs.min_length;
154
- form.find('input.text-input').delayedObserver(function() {
154
+ var callback = function() {
155
155
  if (form.closest('body').length) form.trigger("submit");
156
- }, 0.35, {
156
+ };
157
+ form.find('input.text-input').delayedObserver(callback, 0.35, {
157
158
  condition: function() {
158
159
  var item = jQuery(this);
159
160
  return item.data('oldval') == item.val() || item.val().length < min_length;
160
161
  }
162
+ }).on('paste', function() {
163
+ if (form.closest('body').length) form.trigger("submit");
161
164
  });
162
165
  }
163
166
 
@@ -250,7 +253,7 @@ RecordSelect.Abstract = Class.extend({
250
253
  this.container.css('left', offset.left);
251
254
  this.container.css('top', '');
252
255
  this.container.css('bottom', '');
253
- if ((this.fixed || this.body_static) && top + height > window_height) {
256
+ if (this.above || (this.fixed || this.body_static) && top + height > window_height) {
254
257
  this.container.css('bottom', window_height - offset.top);
255
258
  } else {
256
259
  var below_space = window_height-(top-scroll), above_space = offset.top - scroll, position;
@@ -326,6 +329,12 @@ RecordSelect.Abstract = Class.extend({
326
329
  return false;
327
330
  }
328
331
  });
332
+ jQuery(this.obj).each(function() {
333
+ if (jQuery(this).data('rs-above')) {
334
+ rs.above = true;
335
+ return false;
336
+ }
337
+ });
329
338
  jQuery(document.body).append(e);
330
339
  jQuery(document.body).mousedown(jQuery.proxy(this, "onbodyclick"));
331
340
  if (!rs.fixed && e.offsetParent().css('position') == 'static') rs.body_static = true;
@@ -349,6 +358,13 @@ RecordSelect.Abstract = Class.extend({
349
358
  this.container.find('.text-input').val(this.obj.val()).trigger(event);
350
359
  },
351
360
 
361
+ onpaste: function(event) {
362
+ if (!this.is_open()) return;
363
+ setTimeout(function () {
364
+ this.container.find('.text-input').val(this.obj.val()).trigger(event);
365
+ }.bind(this), 0);
366
+ },
367
+
352
368
  /**
353
369
  * all the behavior to respond to a text field as a search box
354
370
  */
@@ -359,6 +375,9 @@ RecordSelect.Abstract = Class.extend({
359
375
  // the autosearch event - needs to happen slightly late (keyup is later than keypress)
360
376
  text_field.keyup(jQuery.proxy(this, 'onkeyup'));
361
377
 
378
+ // the autosearch event - needs to happen slightly late (keyup is later than keypress)
379
+ text_field.on('paste', jQuery.proxy(this, 'onpaste'));
380
+
362
381
  // keyboard navigation, if available
363
382
  if (this.onkeydown) {
364
383
  text_field.keydown(jQuery.proxy(this, "onkeydown"));
@@ -2,7 +2,7 @@ module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 8
5
- PATCH = 6
5
+ PATCH = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  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: 3.8.6
4
+ version: 3.8.7
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: 2017-08-18 00:00:00.000000000 Z
13
+ date: 2017-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler