recordselect 3.4.0 → 3.4.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
+ metadata.gz: 097b55b2bcf91b9610442b574be4a9359fbd3828
4
+ data.tar.gz: b98335628b3b439807428a33bdc8d03793738255
5
+ SHA512:
6
+ metadata.gz: e5b2934d61d0cc0a6dbdce8269d4217f169b3dea3af9227effe4e2bad429d340df960f37109b9fc1a93f39eaf3762abf3620937140d002fb5810c528ce3b16ed
7
+ data.tar.gz: 3f274babc93311a0a941054be6092910d6d0278e12fbcb5e361149aedc2ca818f29e7a6950a5db8f6784d5a9916aaab7ce7e604b997436c0c90905e2aa420e9a
@@ -88,7 +88,8 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
88
88
  else {
89
89
  if (el.data('timer')) { clearTimeout(el.data('timer')); }
90
90
  el.data('timer', setTimeout(function(){
91
- el.data('callback').apply(el);
91
+ var callback = el.data('callback');
92
+ if (callback) callback.apply(el);
92
93
  }, el.data('delay') * 1000));
93
94
  el.data('oldval', el.val());
94
95
  }
@@ -183,7 +184,7 @@ RecordSelect.Abstract = Class.extend({
183
184
  open: function() {
184
185
  if (this.is_open()) return;
185
186
  var _this = this;
186
- jQuery.rails.fire(_this.obj, 'rs:before');
187
+ jQuery.rails.fire(_this.obj, 'recordselect:before');
187
188
  _this.container.html('');
188
189
  _this.container.show();
189
190
  var params = _this.obj.data('params');
@@ -200,6 +201,7 @@ RecordSelect.Abstract = Class.extend({
200
201
  else {
201
202
  _this.container.find('.text-input').val(_this.obj.val());
202
203
  RecordSelect.observe(_this.container.find('form').attr('id'));
204
+ _this.container.hide(); // needed to get right document height to position first time
203
205
  _this.show();
204
206
  jQuery(document.body).mousedown(jQuery.proxy(_this, "onbodyclick"));
205
207
  }
@@ -211,19 +213,25 @@ RecordSelect.Abstract = Class.extend({
211
213
  * positions and reveals the recordselect
212
214
  */
213
215
  show: function() {
214
- var offset = this.obj.offset()
215
- if (this.fixed) offset.top -= jQuery(window).scrollTop(); // get fixed position
216
- var top = this.obj.outerHeight() + offset.top;
216
+ var offset = this.obj.offset(), scroll = jQuery(window).scrollTop(), window_height = jQuery(window).height();
217
+ if (this.fixed) offset.top -= scroll; // get fixed position
218
+ var top = this.obj.outerHeight() + offset.top, document_height = jQuery(document).height();
217
219
 
218
220
  this.container.show();
221
+ var height = this.container.outerHeight();
219
222
  this.container.css('left', offset.left);
220
223
  this.container.css('top', '');
221
224
  this.container.css('bottom', '');
222
- if (this.fixed && top + this.container.outerHeight() > jQuery(window).height()) {
223
- this.container.css('bottom', jQuery(window).height() - offset.top);
225
+ if (this.fixed && top + height > window_height) {
226
+ this.container.css('bottom', window_height - offset.top);
224
227
  } else {
225
- this.container.css('top', top);
226
- if (!this.container.visible()) this.container.css('top', top - this.obj.outerHeight() - this.container.outerHeight());
228
+ var below_space = window_height-(top-scroll), above_space = offset.top - scroll, position;
229
+ if (below_space < height) {
230
+ if (above_space >= height) position = 'bottom';
231
+ else position = above_space < below_space ? 'top' : 'bottom';
232
+ } else position = 'top';
233
+ if (position == 'top') this.container.css('top', top);
234
+ else this.container.css('bottom', document_height - offset.top);
227
235
  }
228
236
 
229
237
  if (this._use_iframe_mask()) {
@@ -2,7 +2,7 @@ module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,79 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: recordselect
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 3
8
- - 4
9
- - 0
10
- version: 3.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.4.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Sergio Cambra
14
8
  - Volker Hochstein
15
9
  - Lance Ivy
16
10
  autorequire:
17
11
  bindir: bin
18
12
  cert_chain: []
19
-
20
- date: 2014-10-31 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- type: :development
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- version_requirements: *id001
13
+ date: 2014-12-26 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
34
16
  name: shoulda
35
- prerelease: false
36
- - !ruby/object:Gem::Dependency
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
37
22
  type: :development
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: bundler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
41
33
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 23
44
- segments:
45
- - 1
46
- - 0
47
- - 0
34
+ - !ruby/object:Gem::Version
48
35
  version: 1.0.0
49
- version_requirements: *id002
50
- name: bundler
36
+ type: :development
51
37
  prerelease: false
52
- - !ruby/object:Gem::Dependency
53
- type: :runtime
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 5
60
- segments:
61
- - 3
62
- - 1
63
- - 3
64
- version: 3.1.3
65
- version_requirements: *id003
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.0
43
+ - !ruby/object:Gem::Dependency
66
44
  name: rails
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: 3.1.3
50
+ type: :runtime
67
51
  prerelease: false
68
- 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
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 3.1.3
57
+ description: RecordSelect is a Rails widget to help you pick one record out of many.
58
+ I designed it as a more usable and performant alternative to generating a massive
59
+ dropdown list
69
60
  email: activescaffold@googlegroups.com
70
61
  executables: []
71
-
72
62
  extensions: []
73
-
74
- extra_rdoc_files:
63
+ extra_rdoc_files:
64
+ - README
65
+ files:
66
+ - MIT-LICENSE
75
67
  - README
76
- files:
77
68
  - app/assets/images/record_select/accept.png
78
69
  - app/assets/images/record_select/cross.gif
79
70
  - app/assets/images/record_select/next.gif
@@ -100,44 +91,31 @@ files:
100
91
  - lib/record_select/helpers/record_select_helper.rb
101
92
  - lib/record_select/version.rb
102
93
  - lib/recordselect.rb
103
- - vendor/assets/javascripts/jquery.visible.min.js
104
- - MIT-LICENSE
105
- - README
106
94
  - test/recordselect_test.rb
95
+ - vendor/assets/javascripts/jquery.visible.min.js
107
96
  homepage: http://github.com/scambra/recordselect
108
- licenses:
97
+ licenses:
109
98
  - MIT
99
+ metadata: {}
110
100
  post_install_message:
111
101
  rdoc_options: []
112
-
113
- require_paths:
102
+ require_paths:
114
103
  - lib
115
- required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- hash: 49
121
- segments:
122
- - 1
123
- - 9
124
- - 1
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
125
108
  version: 1.9.1
126
- required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- hash: 3
132
- segments:
133
- - 0
134
- version: "0"
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
135
114
  requirements: []
136
-
137
115
  rubyforge_project:
138
- rubygems_version: 1.8.29
116
+ rubygems_version: 2.4.5
139
117
  signing_key:
140
- specification_version: 3
118
+ specification_version: 4
141
119
  summary: RecordSelect widget as a replacement for massive drop down lists
142
- test_files:
120
+ test_files:
143
121
  - test/recordselect_test.rb