recordselect 3.2.9 → 3.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,7 +160,9 @@ RecordSelect.notify = function(item) {
160
160
 
161
161
  RecordSelect.observe = function(id) {
162
162
  var form = jQuery("#" + id);
163
- form.find('input.text-input').delayedObserver(0.35, function() { form.trigger("submit"); });
163
+ form.find('input.text-input').delayedObserver(0.35, function() {
164
+ if (form.closest('body').length) form.trigger("submit");
165
+ });
164
166
  }
165
167
 
166
168
  RecordSelect.render_page = function(record_select_id, page) {
@@ -353,13 +355,15 @@ jQuery.extend(RecordSelect.Abstract.prototype, {
353
355
  elem = this.container.find('li.pagination.previous');
354
356
  if (elem) elem.find('a').click();
355
357
  break;
356
- case 27: // Event.KEY_ESC
358
+ case 27, 9: // Event.KEY_ESC, Event.KEY_TAB
357
359
  this.close();
358
360
  break;
359
361
  default:
360
362
  return true;
361
363
  }
362
- ev.preventDefault(); // so "enter" doesn't submit the form, among other things(?)
364
+ if (ev.keyCode != 9) { // don't prevent tabbing
365
+ ev.preventDefault(); // so "enter" doesn't submit the form, among other things(?)
366
+ }
363
367
  },
364
368
 
365
369
  /**
@@ -424,13 +428,6 @@ RecordSelect.Single = RecordSelect.Abstract.extend({
424
428
  if (this.obj.prop('focused')) this.open(); // if it was focused before we could attach observers
425
429
  },
426
430
 
427
- close: function() {
428
- // if they close the dialog with the text field empty, then delete the id value
429
- if (this.obj.val() == '') this.set('', '');
430
-
431
- RecordSelect.Abstract.prototype.close.call(this);
432
- },
433
-
434
431
  onselect: function(id, value) {
435
432
  this.set(id, value);
436
433
  if (this.options.onchange) this.options.onchange.call(this, id, value);
@@ -236,13 +236,15 @@ Object.extend(RecordSelect.Abstract.prototype, {
236
236
  elem = this.container.down('li.pagination.previous');
237
237
  if (elem) elem.down('a').onclick();
238
238
  break;
239
- case Event.KEY_ESC:
239
+ case Event.KEY_ESC, Event.KEY_TAB:
240
240
  this.close();
241
241
  break;
242
242
  default:
243
243
  return;
244
244
  }
245
- Event.stop(ev); // so "enter" doesn't submit the form, among other things(?)
245
+ if (ev.keyCode != Event.KEY_TAB) { // don't prevent tabbing
246
+ Event.stop(ev); // so "enter" doesn't submit the form, among other things(?)
247
+ }
246
248
  },
247
249
 
248
250
  /**
@@ -309,13 +311,6 @@ RecordSelect.Single.prototype = Object.extend(new RecordSelect.Abstract(), {
309
311
  if (this.obj.focused) this.open(); // if it was focused before we could attach observers
310
312
  },
311
313
 
312
- close: function() {
313
- // if they close the dialog with the text field empty, then delete the id value
314
- if (this.obj.value == '') this.set('', '');
315
-
316
- RecordSelect.Abstract.prototype.close.call(this);
317
- },
318
-
319
314
  onselect: function(id, value) {
320
315
  this.set(id, value);
321
316
  if (this.options.onchange) this.options.onchange.call(this, id, value);
@@ -2,7 +2,7 @@ module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 9
5
+ PATCH = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recordselect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 9
10
- version: 3.2.9
9
+ - 10
10
+ version: 3.2.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Cambra
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2013-06-24 00:00:00 Z
20
+ date: 2013-07-04 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  type: :development