recordselect 3.1.8 → 3.1.9
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.
@@ -239,8 +239,8 @@ RecordSelect.Abstract = Class.extend({
|
|
239
239
|
var offset = this.obj.offset(), top = this.obj.height() + offset.top;
|
240
240
|
this.container.show();
|
241
241
|
this.container.css('left', offset.left);
|
242
|
-
if (top + this.container.height() > $(
|
243
|
-
this.container.css('
|
242
|
+
if (top + this.container.height() > $(window).height())
|
243
|
+
this.container.css('bottom', $(window).height() - offset.top);
|
244
244
|
else this.container.css('top', top);
|
245
245
|
|
246
246
|
if (this._use_iframe_mask()) {
|
@@ -239,8 +239,8 @@ RecordSelect.Abstract = Class.extend({
|
|
239
239
|
var offset = this.obj.offset(), top = this.obj.height() + offset.top;
|
240
240
|
this.container.show();
|
241
241
|
this.container.css('left', offset.left);
|
242
|
-
if (top + this.container.height() > $(
|
243
|
-
this.container.css('
|
242
|
+
if (top + this.container.height() > $(window).height())
|
243
|
+
this.container.css('bottom', offset.top);
|
244
244
|
else this.container.css('top', top);
|
245
245
|
|
246
246
|
if (this._use_iframe_mask()) {
|
@@ -438,7 +438,6 @@ RecordSelect.Single = RecordSelect.Abstract.extend({
|
|
438
438
|
onselect: function(id, value) {
|
439
439
|
this.set(id, value);
|
440
440
|
if (this.options.onchange) this.options.onchange.call(this, id, value);
|
441
|
-
var _this = this;
|
442
441
|
this.obj.trigger("recordselect:change", [id, value]);
|
443
442
|
this.close();
|
444
443
|
},
|
@@ -105,9 +105,13 @@ Object.extend(RecordSelect.Abstract.prototype, {
|
|
105
105
|
* positions and reveals the recordselect
|
106
106
|
*/
|
107
107
|
show: function() {
|
108
|
-
var offset = Position.cumulativeOffset(this.obj)
|
108
|
+
var offset = Position.cumulativeOffset(this.obj),
|
109
|
+
top = Element.getHeight(this.obj) + offset[1],
|
110
|
+
window_height = document.viewport.getHeight();
|
109
111
|
this.container.style.left = offset[0] + 'px';
|
110
|
-
|
112
|
+
if (top + Element.getHeight(this.container) > window_height)
|
113
|
+
this.container.style.bottom = (window_height - offset[1]) + 'px';
|
114
|
+
else this.container.style.top = top + 'px';
|
111
115
|
|
112
116
|
if (this._use_iframe_mask()) {
|
113
117
|
this.container.insertAdjacentHTML('afterEnd', '<iframe src="javascript:false;" class="record-select-mask" />');
|
@@ -61,6 +61,9 @@ Object.extend(RecordSelect.Abstract.prototype, {
|
|
61
61
|
this.url = url;
|
62
62
|
this.options = options;
|
63
63
|
this.container;
|
64
|
+
if (this.options.onchange && typeof this.options.onchange != 'function') {
|
65
|
+
this.options.onchange = eval(this.options.onchange);
|
66
|
+
}
|
64
67
|
|
65
68
|
if (RecordSelect.document_loaded) this.onload();
|
66
69
|
else Event.observe(window, 'load', this.onload.bind(this));
|
@@ -102,9 +105,13 @@ Object.extend(RecordSelect.Abstract.prototype, {
|
|
102
105
|
* positions and reveals the recordselect
|
103
106
|
*/
|
104
107
|
show: function() {
|
105
|
-
var offset = Position.cumulativeOffset(this.obj)
|
108
|
+
var offset = Position.cumulativeOffset(this.obj),
|
109
|
+
top = Element.getHeight(this.obj) + offset[1],
|
110
|
+
window_height = document.viewport.getDimensions().height;
|
106
111
|
this.container.style.left = offset[0] + 'px';
|
107
|
-
|
112
|
+
if (top + Element.getHeight(this.container) > window_height)
|
113
|
+
this.container.style.bottom = (window_height - offset[1]) + 'px';
|
114
|
+
else this.container.style.top = top + 'px';
|
108
115
|
|
109
116
|
if (this._use_iframe_mask()) {
|
110
117
|
this.container.insertAdjacentHTML('afterEnd', '<iframe src="javascript:false;" class="record-select-mask" />');
|
@@ -304,6 +311,7 @@ RecordSelect.Single.prototype = Object.extend(new RecordSelect.Abstract(), {
|
|
304
311
|
onselect: function(id, value) {
|
305
312
|
this.set(id, value);
|
306
313
|
if (this.options.onchange) this.options.onchange.call(this, id, value);
|
314
|
+
this.obj.fire('recordselect:change', {"id": id, "label": value});
|
307
315
|
this.close();
|
308
316
|
},
|
309
317
|
|
@@ -343,17 +351,17 @@ RecordSelect.Autocomplete.prototype = Object.extend(new RecordSelect.Abstract(),
|
|
343
351
|
},
|
344
352
|
|
345
353
|
onselect: function(id, value) {
|
346
|
-
this.set(
|
354
|
+
this.set(value);
|
347
355
|
if (this.options.onchange) this.options.onchange.call(this, id, value);
|
356
|
+
this.obj.fire('recordselect:change', {"id": id, "label": value});
|
348
357
|
this.close();
|
349
358
|
},
|
350
359
|
|
351
360
|
/**
|
352
361
|
* sets the id/label
|
353
362
|
*/
|
354
|
-
set: function(
|
363
|
+
set: function(label) {
|
355
364
|
this.obj.value = label.unescapeHTML();
|
356
|
-
this.hidden_input.value = id;
|
357
365
|
}
|
358
366
|
});
|
359
367
|
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 3.1.
|
9
|
+
- 9
|
10
|
+
version: 3.1.9
|
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: 2012-02-
|
20
|
+
date: 2012-02-21 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|