recordselect 3.3.7 → 3.3.8

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.
@@ -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.find('a').click();
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.down('a').onclick();
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
-
@@ -2,7 +2,7 @@ module RecordSelect
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- PATCH = 7
5
+ PATCH = 8
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: 5
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
- - 7
10
- version: 3.3.7
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-25 00:00:00 Z
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