recordselect 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ data.tar.gz: 8264830c7301ac7c45e073c5555a59c177d2002b
4
+ metadata.gz: 8bfdb97ac6a0c4e71c18c17332e45b590eb0c4f0
5
+ SHA512:
6
+ data.tar.gz: f92b9bd472f6275d77814e0bb0fcdeb93d31a3670a2804b32d0bc76c2eb1239a657006471974505adda5b73809fa0dc787194535084c41fd13bcc00070a82512
7
+ metadata.gz: bfbec34f8cb5880ce063278819db13fb709e12a1682bdf295b5f42f0315019f1667dbb874f2bcb3488aaa0bae504a65859e8c1ba28dace34b686f43daedf1439
@@ -72,54 +72,31 @@ if (typeof(Class) === 'undefined') {
72
72
  Slight modifications by Elliot Winkler
73
73
  */
74
74
 
75
- if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
76
- (function() {
77
- var delayedObserverStack = [];
78
- var observed;
79
-
80
- function delayedObserverCallback(stackPos) {
81
- observed = delayedObserverStack[stackPos];
82
- if (observed.timer) clearTimeout(observed.timer);
83
-
84
- observed.timer = setTimeout(function(){
85
- observed.timer = null;
86
- observed.callback(observed.obj.val(), observed.obj);
87
- }, observed.delay * 1000);
88
-
89
- observed.oldVal = observed.obj.val();
90
- }
91
-
92
- // going by
93
- // <http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx>
94
- // I think these codes only work when using keyup or keydown
95
- function isNonPrintableKey(event) {
96
- var code = event.keyCode;
97
- return (
98
- event.metaKey ||
99
- (code >= 9 || code <= 16) || (code >= 27 && code <= 40) || (code >= 91 && code <= 93) || (code >= 112 && code <= 145)
100
- );
101
- }
102
-
103
- jQuery.fn.extend({
104
- delayedObserver:function(delay, callback){
105
- $this = jQuery(this);
106
-
107
- delayedObserverStack.push({
108
- obj: $this, timer: null, delay: delay,
109
- oldVal: $this.val(), callback: callback
110
- });
111
-
112
- stackPos = delayedObserverStack.length-1;
113
-
114
- $this.keyup(function(event) {
115
- if (isNonPrintableKey(event)) return;
116
- observed = delayedObserverStack[stackPos];
117
- if (observed.obj.val() == observed.obj.oldVal) return;
118
- else delayedObserverCallback(stackPos);
75
+ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
76
+ (function($){
77
+ $.extend($.fn, {
78
+ delayedObserver: function(callback, delay, options){
79
+ return this.each(function(){
80
+ var el = $(this);
81
+ var op = options || {};
82
+ el.data('oldval', el.val())
83
+ .data('delay', delay || 0.5)
84
+ .data('condition', op.condition || function() { return ($(this).data('oldval') == $(this).val()); })
85
+ .data('callback', callback)
86
+ [(op.event||'keyup')](function(){
87
+ if (el.data('condition').apply(el)) { return; }
88
+ else {
89
+ if (el.data('timer')) { clearTimeout(el.data('timer')); }
90
+ el.data('timer', setTimeout(function(){
91
+ el.data('callback').apply(el);
92
+ }, el.data('delay') * 1000));
93
+ el.data('oldval', el.val());
94
+ }
95
+ });
119
96
  });
120
97
  }
121
98
  });
122
- })();
99
+ })(jQuery);
123
100
  }
124
101
 
125
102
  jQuery(document).ready(function() {
@@ -160,9 +137,9 @@ RecordSelect.notify = function(item) {
160
137
 
161
138
  RecordSelect.observe = function(id) {
162
139
  var form = jQuery("#" + id);
163
- form.find('input.text-input').delayedObserver(0.35, function() {
140
+ form.find('input.text-input').delayedObserver(function() {
164
141
  if (form.closest('body').length) form.trigger("submit");
165
- });
142
+ }, 0.35);
166
143
  }
167
144
 
168
145
  RecordSelect.render_page = function(record_select_id, page) {
@@ -2,7 +2,7 @@ module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recordselect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease:
6
- segments:
7
- - 3
8
- - 3
9
- - 0
10
- version: 3.3.0
4
+ version: 3.3.1
11
5
  platform: ruby
12
6
  authors:
13
7
  - Sergio Cambra
@@ -17,54 +11,39 @@ autorequire:
17
11
  bindir: bin
18
12
  cert_chain: []
19
13
 
20
- date: 2013-09-06 00:00:00 Z
14
+ date: 2013-09-11 00:00:00 Z
21
15
  dependencies:
22
16
  - !ruby/object:Gem::Dependency
23
- prerelease: false
24
- type: :development
25
17
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
18
  requirements:
28
- - - ">="
19
+ - &id004
20
+ - ">="
29
21
  - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
22
  version: "0"
34
- requirement: *id001
23
+ type: :development
35
24
  name: shoulda
36
- - !ruby/object:Gem::Dependency
25
+ requirement: *id001
37
26
  prerelease: false
38
- type: :development
27
+ - !ruby/object:Gem::Dependency
39
28
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
29
  requirements:
42
30
  - - ~>
43
31
  - !ruby/object:Gem::Version
44
- hash: 23
45
- segments:
46
- - 1
47
- - 0
48
- - 0
49
32
  version: 1.0.0
50
- requirement: *id002
33
+ type: :development
51
34
  name: bundler
52
- - !ruby/object:Gem::Dependency
35
+ requirement: *id002
53
36
  prerelease: false
54
- type: :runtime
37
+ - !ruby/object:Gem::Dependency
55
38
  version_requirements: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
39
  requirements:
58
40
  - - ">="
59
41
  - !ruby/object:Gem::Version
60
- hash: 5
61
- segments:
62
- - 3
63
- - 1
64
- - 3
65
42
  version: 3.1.3
66
- requirement: *id003
43
+ type: :runtime
67
44
  name: rails
45
+ requirement: *id003
46
+ prerelease: false
68
47
  description: RecordSelect is a Rails widget to help you pick one record out of many. I designed it as a more usable and performant alternative to generating a massive dropdown list
69
48
  email: activescaffold@googlegroups.com
70
49
  executables: []
@@ -106,35 +85,25 @@ files:
106
85
  homepage: http://github.com/scambra/recordselect
107
86
  licenses:
108
87
  - MIT
88
+ metadata: {}
89
+
109
90
  post_install_message:
110
91
  rdoc_options: []
111
92
 
112
93
  require_paths:
113
94
  - lib
114
95
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
96
  requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
97
+ - *id004
123
98
  required_rubygems_version: !ruby/object:Gem::Requirement
124
- none: false
125
99
  requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 3
129
- segments:
130
- - 0
131
- version: "0"
100
+ - *id004
132
101
  requirements: []
133
102
 
134
103
  rubyforge_project:
135
- rubygems_version: 1.8.23
104
+ rubygems_version: 2.0.7
136
105
  signing_key:
137
- specification_version: 3
106
+ specification_version: 4
138
107
  summary: RecordSelect widget as a replacement for massive drop down lists
139
108
  test_files:
140
109
  - test/recordselect_test.rb