recordselect 3.3.7 → 3.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/record_select/accept.png +0 -0
- data/app/assets/javascripts/jquery/record_select.js +6 -2
- data/app/assets/javascripts/prototype/record_select.js +4 -2
- data/app/assets/stylesheets/record_select.css.erb +8 -0
- data/app/views/record_select/_search.html.erb +0 -7
- data/lib/record_select/version.rb +1 -1
- metadata +5 -4
Binary file
|
@@ -121,7 +121,7 @@ RecordSelect.select_item = function(item) {
|
|
121
121
|
if (onselect) {
|
122
122
|
try {
|
123
123
|
var label = jQuery.trim(item.find('label').first().text());
|
124
|
-
if (!label) label = item.text();
|
124
|
+
if (!label) label = item.text().trim();
|
125
125
|
onselect(item.attr('id').substr(2), label, e);
|
126
126
|
} catch(e) {
|
127
127
|
alert(e);
|
@@ -195,6 +195,8 @@ RecordSelect.Abstract = Class.extend({
|
|
195
195
|
_this.container.html(data);
|
196
196
|
if (!_this.container.is(':visible')) _this.close();
|
197
197
|
else {
|
198
|
+
_this.container.find('.text-input').val(_this.obj.val());
|
199
|
+
RecordSelect.observe(_this.container.find('form').attr('id'));
|
198
200
|
_this.show();
|
199
201
|
jQuery(document.body).mousedown(jQuery.proxy(_this, "onbodyclick"));
|
200
202
|
}
|
@@ -336,7 +338,7 @@ jQuery.extend(RecordSelect.Abstract.prototype, {
|
|
336
338
|
this.highlight(elem);
|
337
339
|
break;
|
338
340
|
case 13: // Event.KEY_RETURN
|
339
|
-
if (this.current) this.current.
|
341
|
+
if (this.current) this.current.click();
|
340
342
|
break;
|
341
343
|
case 39: // Event.KEY_RIGHT
|
342
344
|
elem = this.container.find('li.pagination.next');
|
@@ -403,6 +405,7 @@ RecordSelect.Single = RecordSelect.Abstract.extend({
|
|
403
405
|
this.container.addClass('record-select-autocomplete');
|
404
406
|
this.container.submit(function() {
|
405
407
|
rs.hidden_input.val('');
|
408
|
+
rs.obj.removeClass('selected');
|
406
409
|
});
|
407
410
|
|
408
411
|
// create the hidden input
|
@@ -434,6 +437,7 @@ RecordSelect.Single = RecordSelect.Abstract.extend({
|
|
434
437
|
// unescaped html missing for label
|
435
438
|
this.obj.val(label);
|
436
439
|
this.hidden_input.val(id);
|
440
|
+
this.obj.addClass('selected');
|
437
441
|
}
|
438
442
|
});
|
439
443
|
|
@@ -98,6 +98,7 @@ Object.extend(RecordSelect.Abstract.prototype, {
|
|
98
98
|
// needs to be mousedown so the event doesn't get canceled by other code (see issue #26)
|
99
99
|
if (!this.container.visible()) this.close();
|
100
100
|
else {
|
101
|
+
RecordSelect.observe(this.container.down('form').readAttribute('id'));
|
101
102
|
this.show();
|
102
103
|
Element.observe(document.body, 'mousedown', this.onbodyclick.bindAsEventListener(this));
|
103
104
|
}
|
@@ -227,9 +228,8 @@ Object.extend(RecordSelect.Abstract.prototype, {
|
|
227
228
|
if (!elem) elem = this.container.getElementsBySelector('ol li.record').first();
|
228
229
|
this.highlight(elem);
|
229
230
|
break;
|
230
|
-
case Event.KEY_SPACE:
|
231
231
|
case Event.KEY_RETURN:
|
232
|
-
if (this.current) this.current.
|
232
|
+
if (this.current) this.current.onclick();
|
233
233
|
break;
|
234
234
|
case Event.KEY_RIGHT:
|
235
235
|
elem = this.container.down('li.pagination.next');
|
@@ -298,6 +298,7 @@ RecordSelect.Single.prototype = Object.extend(new RecordSelect.Abstract(), {
|
|
298
298
|
this.container.addClassName('record-select-autocomplete');
|
299
299
|
this.container.observe('submit', function() {
|
300
300
|
this.hidden_input.value = '';
|
301
|
+
this.obj.removeClassName('selected');
|
301
302
|
}.bind(this));
|
302
303
|
|
303
304
|
// create the hidden input
|
@@ -328,6 +329,7 @@ RecordSelect.Single.prototype = Object.extend(new RecordSelect.Abstract(), {
|
|
328
329
|
set: function(id, label) {
|
329
330
|
this.obj.value = label.unescapeHTML();
|
330
331
|
this.hidden_input.value = id;
|
332
|
+
this.obj.addClassName('selected');
|
331
333
|
}
|
332
334
|
});
|
333
335
|
|
@@ -140,3 +140,11 @@ iframe.record-select-mask {
|
|
140
140
|
float: left;
|
141
141
|
margin-right: 5px;
|
142
142
|
}
|
143
|
+
|
144
|
+
.recordselect.selected {
|
145
|
+
background-color: #EFFFEF;
|
146
|
+
background-position: right 2px center;
|
147
|
+
background-image: url('/assets/record_select/accept.png');
|
148
|
+
background-repeat: no-repeat;
|
149
|
+
padding-right: 20px;
|
150
|
+
}
|
@@ -3,10 +3,3 @@
|
|
3
3
|
<%= text_field_tag 'search', params[:search], :autocomplete => 'off', :class => 'text-input' %>
|
4
4
|
<%= submit_tag 'search', :class => "search_submit" %>
|
5
5
|
</form>
|
6
|
-
|
7
|
-
<script type="text/javascript">
|
8
|
-
//<![CDATA[
|
9
|
-
RecordSelect.observe(<%= record_select_search_id.to_json.html_safe %>);
|
10
|
-
//]]>
|
11
|
-
</script>
|
12
|
-
|
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: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
9
|
+
- 8
|
10
|
+
version: 3.3.8
|
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: 2014-09-
|
20
|
+
date: 2014-09-30 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
type: :development
|
@@ -74,6 +74,7 @@ extensions: []
|
|
74
74
|
extra_rdoc_files:
|
75
75
|
- README
|
76
76
|
files:
|
77
|
+
- app/assets/images/record_select/accept.png
|
77
78
|
- app/assets/images/record_select/cross.gif
|
78
79
|
- app/assets/images/record_select/next.gif
|
79
80
|
- app/assets/images/record_select/previous.gif
|