rails3-jquery-autocomplete 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ * 0.7.5 Pull request #46
4
+ * 0.7.4 Allows Rails 3.1
5
+ * 0.7.3 MongoMapper
6
+ * 0.7.2 Steak helper
7
+ * 0.7.1 Fixed joined scopes (Issue #43)
8
+ * 0.7.0 Scopes
9
+ * 0.6.6 ILIKE for postgres
10
+ * 0.6.5 JS select event
11
+ * 0.6.4 Use YAJL instead of JSON
12
+ * 0.6.3 SimpleForm plugin
13
+ * 0.6.2 Fix Issue #8
14
+ * 0.6.1 Allow specifying fully qualified class name for model object as an option to autocomplete
15
+ * 0.6.0 JS Code cleanup
16
+ * 0.5.1 Add STI support
17
+ * 0.5.0 Formtastic support
18
+ * 0.4.0 MongoID support
19
+ * 0.3.6 Using .live() to put autocomplete on dynamic fields
20
+
@@ -221,7 +221,7 @@ option.
221
221
 
222
222
  simple_form_for @product do |form|
223
223
  form.input :name
224
- form.input :brand_name, :url => autocomplete_brand_name_path, :as => :autocomplete
224
+ form.input :brand_name, :url => autocomplete_brand_name_products_path, :as => :autocomplete
225
225
 
226
226
  # Cucumber
227
227
 
@@ -308,25 +308,6 @@ integration folder:
308
308
  rake db:migrate
309
309
  cucumber
310
310
 
311
- # Changelog
312
-
313
- * 0.7.4 Allows Rails 3.1
314
- * 0.7.3 MongoMapper
315
- * 0.7.2 Steak helper
316
- * 0.7.1 Fixed joined scopes (Issue #43)
317
- * 0.7.0 Scopes
318
- * 0.6.6 ILIKE for postgres
319
- * 0.6.5 JS select event
320
- * 0.6.4 Use YAJL instead of JSON
321
- * 0.6.3 SimpleForm plugin
322
- * 0.6.2 Fix Issue #8
323
- * 0.6.1 Allow specifying fully qualified class name for model object as an option to autocomplete
324
- * 0.6.0 JS Code cleanup
325
- * 0.5.1 Add STI support
326
- * 0.5.0 Formtastic support
327
- * 0.4.0 MongoID support
328
- * 0.3.6 Using .live() to put autocomplete on dynamic fields
329
-
330
311
  # Thanks to
331
312
 
332
313
  Everyone on [this list](https://github.com/crowdint/rails3-jquery-autocomplete/contributors)
@@ -15,92 +15,99 @@
15
15
  */
16
16
 
17
17
  $(document).ready(function(){
18
- $('input[data-autocomplete]').railsAutocomplete();
18
+ $('input[data-autocomplete]').railsAutocomplete();
19
19
  });
20
20
 
21
21
  (function(jQuery)
22
22
  {
23
- var self = null;
24
- jQuery.fn.railsAutocomplete = function() {
25
- return this.live('focus',function() {
26
- if (!this.railsAutoCompleter) {
27
- this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
28
- }
29
- });
30
- };
23
+ var self = null;
24
+ jQuery.fn.railsAutocomplete = function() {
25
+ return this.live('focus',function() {
26
+ if (!this.railsAutoCompleter) {
27
+ this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
28
+ }
29
+ });
30
+ };
31
31
 
32
- jQuery.railsAutocomplete = function (e) {
33
- _e = e;
34
- this.init(_e);
35
- };
32
+ jQuery.railsAutocomplete = function (e) {
33
+ _e = e;
34
+ this.init(_e);
35
+ };
36
36
 
37
- jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
38
- railsAutocomplete: '0.0.1'
39
- };
37
+ jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
38
+ railsAutocomplete: '0.0.1'
39
+ };
40
40
 
41
- jQuery.railsAutocomplete.fn.extend = jQuery.railsAutocomplete.extend = jQuery.extend;
42
- jQuery.railsAutocomplete.fn.extend({
43
- init: function(e) {
44
- e.delimiter = $(e).attr('data-delimiter') || null;
45
- function split( val ) {
46
- return val.split( e.delimiter );
47
- }
48
- function extractLast( term ) {
49
- return split( term ).pop().replace(/^\s+/,"");
50
- }
41
+ jQuery.railsAutocomplete.fn.extend = jQuery.railsAutocomplete.extend = jQuery.extend;
42
+ jQuery.railsAutocomplete.fn.extend({
43
+ init: function(e) {
44
+ e.delimiter = $(e).attr('data-delimiter') || null;
45
+ function split( val ) {
46
+ return val.split( e.delimiter );
47
+ }
48
+ function extractLast( term ) {
49
+ return split( term ).pop().replace(/^\s+/,"");
50
+ }
51
51
 
52
- $(e).autocomplete({
53
- source: function( request, response ) {
54
- $.getJSON( $(e).attr('data-autocomplete'), {
55
- term: extractLast( request.term )
56
- }, function() {
57
- $(arguments[0]).each(function(i, el) {
58
- var obj = {};
59
- obj[el.id] = el;
60
- $(e).data(obj);
61
- });
62
- response.apply(null, arguments);
63
- });
64
- },
65
- search: function() {
66
- // custom minLength
67
- var term = extractLast( this.value );
68
- if ( term.length < 2 ) {
69
- return false;
70
- }
71
- },
72
- focus: function() {
73
- // prevent value inserted on focus
74
- return false;
75
- },
76
- select: function( event, ui ) {
77
- var terms = split( this.value );
78
- // remove the current input
79
- terms.pop();
80
- // add the selected item
81
- terms.push( ui.item.value );
82
- // add placeholder to get the comma-and-space at the end
83
- if (e.delimiter != null) {
84
- terms.push( "" );
85
- this.value = terms.join( e.delimiter );
86
- } else {
87
- this.value = terms.join("");
88
- if ($(this).attr('id_element')) {
89
- $($(this).attr('id_element')).val(ui.item.id);
90
- }
91
- if ($(this).attr('data-update-elements')) {
92
- var data = $(this).data(ui.item.id.toString());
93
- var update_elements = $.parseJSON($(this).attr("data-update-elements"));
94
- for (var key in update_elements) {
95
- $(update_elements[key]).val(data[key]);
96
- }
97
- }
98
- }
99
- $(this).trigger('railsAutocomplete.select');
52
+ $(e).autocomplete({
53
+ source: function( request, response ) {
54
+ $.getJSON( $(e).attr('data-autocomplete'), {
55
+ term: extractLast( request.term )
56
+ }, function() {
57
+ $(arguments[0]).each(function(i, el) {
58
+ var obj = {};
59
+ obj[el.id] = el;
60
+ $(e).data(obj);
61
+ });
62
+ response.apply(null, arguments);
63
+ });
64
+ },
65
+ search: function() {
66
+ // custom minLength
67
+ var term = extractLast( this.value );
68
+ if ( term.length < 2 ) {
69
+ return false;
70
+ }
71
+ },
72
+ focus: function() {
73
+ // prevent value inserted on focus
74
+ return false;
75
+ },
76
+ select: function( event, ui ) {
77
+ var terms = split( this.value );
78
+ // remove the current input
79
+ terms.pop();
80
+ // add the selected item
81
+ terms.push( ui.item.value );
82
+ // add placeholder to get the comma-and-space at the end
83
+ if (e.delimiter != null) {
84
+ terms.push( "" );
85
+ this.value = terms.join( e.delimiter );
86
+ } else {
87
+ this.value = terms.join("");
88
+ if ($(this).attr('id_element')) {
89
+ $($(this).attr('id_element')).val(ui.item.id);
90
+ }
91
+ if ($(this).attr('data-update-elements')) {
92
+ var data = $(this).data(ui.item.id.toString());
93
+ var update_elements = $.parseJSON($(this).attr("data-update-elements"));
94
+ for (var key in update_elements) {
95
+ $(update_elements[key]).val(data[key]);
96
+ }
97
+ }
98
+ }
99
+ var remember_string = this.value;
100
+ $(this).bind('keyup.clearId', function(){
101
+ if($(this).val().trim() != remember_string.trim()){
102
+ $($(this).attr('id_element')).val("");
103
+ $(this).unbind('keyup.clearId');
104
+ }
105
+ });
106
+ $(this).trigger('railsAutocomplete.select');
100
107
 
101
- return false;
102
- }
103
- });
108
+ return false;
109
+ }
110
+ });
104
111
  }
105
112
  });
106
113
  })(jQuery);
@@ -15,92 +15,99 @@
15
15
  */
16
16
 
17
17
  $(document).ready(function(){
18
- $('input[data-autocomplete]').railsAutocomplete();
18
+ $('input[data-autocomplete]').railsAutocomplete();
19
19
  });
20
20
 
21
21
  (function(jQuery)
22
22
  {
23
- var self = null;
24
- jQuery.fn.railsAutocomplete = function() {
25
- return this.live('focus',function() {
26
- if (!this.railsAutoCompleter) {
27
- this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
28
- }
29
- });
30
- };
23
+ var self = null;
24
+ jQuery.fn.railsAutocomplete = function() {
25
+ return this.live('focus',function() {
26
+ if (!this.railsAutoCompleter) {
27
+ this.railsAutoCompleter = new jQuery.railsAutocomplete(this);
28
+ }
29
+ });
30
+ };
31
31
 
32
- jQuery.railsAutocomplete = function (e) {
33
- _e = e;
34
- this.init(_e);
35
- };
32
+ jQuery.railsAutocomplete = function (e) {
33
+ _e = e;
34
+ this.init(_e);
35
+ };
36
36
 
37
- jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
38
- railsAutocomplete: '0.0.1'
39
- };
37
+ jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
38
+ railsAutocomplete: '0.0.1'
39
+ };
40
40
 
41
- jQuery.railsAutocomplete.fn.extend = jQuery.railsAutocomplete.extend = jQuery.extend;
42
- jQuery.railsAutocomplete.fn.extend({
43
- init: function(e) {
44
- e.delimiter = $(e).attr('data-delimiter') || null;
45
- function split( val ) {
46
- return val.split( e.delimiter );
47
- }
48
- function extractLast( term ) {
49
- return split( term ).pop().replace(/^\s+/,"");
50
- }
41
+ jQuery.railsAutocomplete.fn.extend = jQuery.railsAutocomplete.extend = jQuery.extend;
42
+ jQuery.railsAutocomplete.fn.extend({
43
+ init: function(e) {
44
+ e.delimiter = $(e).attr('data-delimiter') || null;
45
+ function split( val ) {
46
+ return val.split( e.delimiter );
47
+ }
48
+ function extractLast( term ) {
49
+ return split( term ).pop().replace(/^\s+/,"");
50
+ }
51
51
 
52
- $(e).autocomplete({
53
- source: function( request, response ) {
54
- $.getJSON( $(e).attr('data-autocomplete'), {
55
- term: extractLast( request.term )
56
- }, function() {
57
- $(arguments[0]).each(function(i, el) {
58
- var obj = {};
59
- obj[el.id] = el;
60
- $(e).data(obj);
61
- });
62
- response.apply(null, arguments);
63
- });
64
- },
65
- search: function() {
66
- // custom minLength
67
- var term = extractLast( this.value );
68
- if ( term.length < 2 ) {
69
- return false;
70
- }
71
- },
72
- focus: function() {
73
- // prevent value inserted on focus
74
- return false;
75
- },
76
- select: function( event, ui ) {
77
- var terms = split( this.value );
78
- // remove the current input
79
- terms.pop();
80
- // add the selected item
81
- terms.push( ui.item.value );
82
- // add placeholder to get the comma-and-space at the end
83
- if (e.delimiter != null) {
84
- terms.push( "" );
85
- this.value = terms.join( e.delimiter );
86
- } else {
87
- this.value = terms.join("");
88
- if ($(this).attr('id_element')) {
89
- $($(this).attr('id_element')).val(ui.item.id);
90
- }
91
- if ($(this).attr('data-update-elements')) {
92
- var data = $(this).data(ui.item.id.toString());
93
- var update_elements = $.parseJSON($(this).attr("data-update-elements"));
94
- for (var key in update_elements) {
95
- $(update_elements[key]).val(data[key]);
96
- }
97
- }
98
- }
99
- $(this).trigger('railsAutocomplete.select');
52
+ $(e).autocomplete({
53
+ source: function( request, response ) {
54
+ $.getJSON( $(e).attr('data-autocomplete'), {
55
+ term: extractLast( request.term )
56
+ }, function() {
57
+ $(arguments[0]).each(function(i, el) {
58
+ var obj = {};
59
+ obj[el.id] = el;
60
+ $(e).data(obj);
61
+ });
62
+ response.apply(null, arguments);
63
+ });
64
+ },
65
+ search: function() {
66
+ // custom minLength
67
+ var term = extractLast( this.value );
68
+ if ( term.length < 2 ) {
69
+ return false;
70
+ }
71
+ },
72
+ focus: function() {
73
+ // prevent value inserted on focus
74
+ return false;
75
+ },
76
+ select: function( event, ui ) {
77
+ var terms = split( this.value );
78
+ // remove the current input
79
+ terms.pop();
80
+ // add the selected item
81
+ terms.push( ui.item.value );
82
+ // add placeholder to get the comma-and-space at the end
83
+ if (e.delimiter != null) {
84
+ terms.push( "" );
85
+ this.value = terms.join( e.delimiter );
86
+ } else {
87
+ this.value = terms.join("");
88
+ if ($(this).attr('id_element')) {
89
+ $($(this).attr('id_element')).val(ui.item.id);
90
+ }
91
+ if ($(this).attr('data-update-elements')) {
92
+ var data = $(this).data(ui.item.id.toString());
93
+ var update_elements = $.parseJSON($(this).attr("data-update-elements"));
94
+ for (var key in update_elements) {
95
+ $(update_elements[key]).val(data[key]);
96
+ }
97
+ }
98
+ }
99
+ var remember_string = this.value;
100
+ $(this).bind('keyup.clearId', function(){
101
+ if($(this).val().trim() != remember_string.trim()){
102
+ $($(this).attr('id_element')).val("");
103
+ $(this).unbind('keyup.clearId');
104
+ }
105
+ });
106
+ $(this).trigger('railsAutocomplete.select');
100
107
 
101
- return false;
102
- }
103
- });
108
+ return false;
109
+ }
110
+ });
104
111
  }
105
112
  });
106
113
  })(jQuery);
@@ -1,3 +1,3 @@
1
1
  module Rails3JQueryAutocomplete
2
- VERSION = '0.7.4'
2
+ VERSION = '0.7.5'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails3-jquery-autocomplete
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 4
10
- version: 0.7.4
9
+ - 5
10
+ version: 0.7.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Padilla
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-22 00:00:00 -04:00
18
+ date: 2011-06-13 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -135,6 +135,7 @@ extra_rdoc_files: []
135
135
  files:
136
136
  - .document
137
137
  - .gitignore
138
+ - CHANGELOG.md
138
139
  - Gemfile
139
140
  - LICENSE
140
141
  - README.markdown