rails3-jquery-autocomplete 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +7 -1
- data/Rakefile +2 -0
- data/lib/form_helper.rb +27 -0
- data/lib/generators/templates/autocomplete-rails.js +2 -2
- data/lib/rails3-jquery-autocomplete.rb +3 -1
- data/test/form_helper_test.rb +11 -0
- metadata +8 -11
- data/.document +0 -5
- data/.gitignore +0 -24
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -94
- data/VERSION +0 -1
- data/rails3-jquery-autocomplete.gemspec +0 -60
data/README.markdown
CHANGED
@@ -20,7 +20,7 @@ I'd encourage you to understand how to use those 3 amazing tools before attempti
|
|
20
20
|
|
21
21
|
Include the gem on your Gemfile
|
22
22
|
|
23
|
-
gem 'rails3-jquery-autocomplete', '
|
23
|
+
gem 'rails3-jquery-autocomplete', '0.3.0'
|
24
24
|
|
25
25
|
Install it
|
26
26
|
|
@@ -34,6 +34,12 @@ And include autocomplete-rails.js on your layouts
|
|
34
34
|
|
35
35
|
javascript_include_tag "autocomplete-rails.js"
|
36
36
|
|
37
|
+
## Upgrading from 0.2.x
|
38
|
+
|
39
|
+
If you are upgrading from a previous version, run the generator after installing to replace the javascript file.
|
40
|
+
|
41
|
+
rails generate autocomplete
|
42
|
+
|
37
43
|
## Usage
|
38
44
|
|
39
45
|
### Model Example
|
data/Rakefile
CHANGED
@@ -11,6 +11,8 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/crowdint/rails3-jquery-autocomplete"
|
12
12
|
gem.authors = ["David Padilla"]
|
13
13
|
gem.add_development_dependency "rails", ">= 3.0.0.rc2"
|
14
|
+
gem.files = %w(README.markdown Rakefile) + Dir.glob("{lib,test}/**/*")
|
15
|
+
|
14
16
|
end
|
15
17
|
Jeweler::GemcutterTasks.new
|
16
18
|
rescue LoadError
|
data/lib/form_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module FormHelper
|
4
|
+
alias_method :original_text_field, :text_field
|
5
|
+
def text_field(object_name, method, options = {})
|
6
|
+
original_text_field(object_name, method, rename_autocomplete_option(options))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module FormTagHelper
|
11
|
+
alias_method :original_text_field_tag, :text_field_tag
|
12
|
+
def text_field_tag(name, value = nil, options = {})
|
13
|
+
original_text_field_tag(name, value, rename_autocomplete_option(options))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Method used to rename the autocomplete key to a more standard
|
19
|
+
# data-autocomplete key
|
20
|
+
#
|
21
|
+
private
|
22
|
+
def rename_autocomplete_option(options)
|
23
|
+
options["data-autocomplete"] = options.delete(:autocomplete)
|
24
|
+
options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -15,9 +15,9 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
$(document).ready(function(){
|
18
|
-
$('input[autocomplete]').each(function(i){
|
18
|
+
$('input[data-autocomplete]').each(function(i){
|
19
19
|
$(this).autocomplete({
|
20
|
-
source: $(this).attr('autocomplete'),
|
20
|
+
source: $(this).attr('data-autocomplete'),
|
21
21
|
select: function(event, ui) {
|
22
22
|
if($(this).attr('id_element')) {
|
23
23
|
$($(this).attr('id_element')).val(ui.item.id);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class FormHelperTest < ActionView::TestCase
|
4
|
+
def test_text_field_tag
|
5
|
+
assert_match(/data-autocomplete=\"some\/path\"/, text_field_tag('field_name', '', :autocomplete => 'some/path'))
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_text_field
|
9
|
+
assert_match(/data-autocomplete=\"some\/path\"/, text_field('field_name', '', :autocomplete => 'some/path'))
|
10
|
+
end
|
11
|
+
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 2
|
9
8
|
- 3
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
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: 2010-
|
18
|
+
date: 2010-09-07 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -45,21 +45,17 @@ extra_rdoc_files:
|
|
45
45
|
- LICENSE
|
46
46
|
- README.markdown
|
47
47
|
files:
|
48
|
-
- .document
|
49
|
-
- .gitignore
|
50
|
-
- Gemfile
|
51
|
-
- Gemfile.lock
|
52
|
-
- LICENSE
|
53
48
|
- README.markdown
|
54
49
|
- Rakefile
|
55
|
-
-
|
50
|
+
- lib/form_helper.rb
|
56
51
|
- lib/generators/autocomplete_generator.rb
|
57
52
|
- lib/generators/templates/autocomplete-rails.js
|
58
53
|
- lib/rails3-jquery-autocomplete.rb
|
59
|
-
- rails3-jquery-autocomplete.gemspec
|
60
54
|
- test/autocomplete_generator_test.rb
|
61
55
|
- test/controller_module_test.rb
|
56
|
+
- test/form_helper_test.rb
|
62
57
|
- test/test_helper.rb
|
58
|
+
- LICENSE
|
63
59
|
has_rdoc: true
|
64
60
|
homepage: http://github.com/crowdint/rails3-jquery-autocomplete
|
65
61
|
licenses: []
|
@@ -97,4 +93,5 @@ summary: Use jQuery's autocomplete plugin with Rails 3.
|
|
97
93
|
test_files:
|
98
94
|
- test/autocomplete_generator_test.rb
|
99
95
|
- test/controller_module_test.rb
|
96
|
+
- test/form_helper_test.rb
|
100
97
|
- test/test_helper.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.0)
|
6
|
-
actionpack (= 3.0.0)
|
7
|
-
mail (~> 2.2.5)
|
8
|
-
actionpack (3.0.0)
|
9
|
-
activemodel (= 3.0.0)
|
10
|
-
activesupport (= 3.0.0)
|
11
|
-
builder (~> 2.1.2)
|
12
|
-
erubis (~> 2.6.6)
|
13
|
-
i18n (~> 0.4.1)
|
14
|
-
rack (~> 1.2.1)
|
15
|
-
rack-mount (~> 0.6.12)
|
16
|
-
rack-test (~> 0.5.4)
|
17
|
-
tzinfo (~> 0.3.23)
|
18
|
-
activemodel (3.0.0)
|
19
|
-
activesupport (= 3.0.0)
|
20
|
-
builder (~> 2.1.2)
|
21
|
-
i18n (~> 0.4.1)
|
22
|
-
activerecord (3.0.0)
|
23
|
-
activemodel (= 3.0.0)
|
24
|
-
activesupport (= 3.0.0)
|
25
|
-
arel (~> 1.0.0)
|
26
|
-
tzinfo (~> 0.3.23)
|
27
|
-
activeresource (3.0.0)
|
28
|
-
activemodel (= 3.0.0)
|
29
|
-
activesupport (= 3.0.0)
|
30
|
-
activesupport (3.0.0)
|
31
|
-
arel (1.0.1)
|
32
|
-
activesupport (~> 3.0.0)
|
33
|
-
builder (2.1.2)
|
34
|
-
erubis (2.6.6)
|
35
|
-
abstract (>= 1.0.0)
|
36
|
-
gemcutter (0.6.1)
|
37
|
-
git (1.2.5)
|
38
|
-
i18n (0.4.1)
|
39
|
-
jeweler (1.4.0)
|
40
|
-
gemcutter (>= 0.1.0)
|
41
|
-
git (>= 1.2.5)
|
42
|
-
rubyforge (>= 2.0.0)
|
43
|
-
json_pure (1.4.6)
|
44
|
-
mail (2.2.5)
|
45
|
-
activesupport (>= 2.3.6)
|
46
|
-
mime-types
|
47
|
-
treetop (>= 1.4.5)
|
48
|
-
mime-types (1.16)
|
49
|
-
polyglot (0.3.1)
|
50
|
-
rack (1.2.1)
|
51
|
-
rack-mount (0.6.12)
|
52
|
-
rack (>= 1.0.0)
|
53
|
-
rack-test (0.5.4)
|
54
|
-
rack (>= 1.0)
|
55
|
-
rails (3.0.0)
|
56
|
-
actionmailer (= 3.0.0)
|
57
|
-
actionpack (= 3.0.0)
|
58
|
-
activerecord (= 3.0.0)
|
59
|
-
activeresource (= 3.0.0)
|
60
|
-
activesupport (= 3.0.0)
|
61
|
-
bundler (~> 1.0.0)
|
62
|
-
railties (= 3.0.0)
|
63
|
-
railties (3.0.0)
|
64
|
-
actionpack (= 3.0.0)
|
65
|
-
activesupport (= 3.0.0)
|
66
|
-
rake (>= 0.8.4)
|
67
|
-
thor (~> 0.14.0)
|
68
|
-
rake (0.8.7)
|
69
|
-
reek (1.2.8)
|
70
|
-
ruby2ruby (~> 1.2)
|
71
|
-
ruby_parser (~> 2.0)
|
72
|
-
sexp_processor (~> 3.0)
|
73
|
-
ruby2ruby (1.2.4)
|
74
|
-
ruby_parser (~> 2.0)
|
75
|
-
sexp_processor (~> 3.0)
|
76
|
-
ruby_parser (2.0.4)
|
77
|
-
sexp_processor (~> 3.0)
|
78
|
-
rubyforge (2.0.4)
|
79
|
-
json_pure (>= 1.1.7)
|
80
|
-
sexp_processor (3.0.4)
|
81
|
-
sqlite3-ruby (1.3.1)
|
82
|
-
thor (0.14.0)
|
83
|
-
treetop (1.4.8)
|
84
|
-
polyglot (>= 0.3.1)
|
85
|
-
tzinfo (0.3.23)
|
86
|
-
|
87
|
-
PLATFORMS
|
88
|
-
ruby
|
89
|
-
|
90
|
-
DEPENDENCIES
|
91
|
-
jeweler
|
92
|
-
rails (= 3.0.0)
|
93
|
-
reek
|
94
|
-
sqlite3-ruby
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.3
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{rails3-jquery-autocomplete}
|
8
|
-
s.version = "0.2.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["David Padilla"]
|
12
|
-
s.date = %q{2010-08-31}
|
13
|
-
s.description = %q{Use jQuery's autocomplete plugin with Rails 3.}
|
14
|
-
s.email = %q{david.padilla@crowdint.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
|
-
"LICENSE",
|
25
|
-
"README.markdown",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"lib/generators/autocomplete_generator.rb",
|
29
|
-
"lib/generators/templates/autocomplete-rails.js",
|
30
|
-
"lib/rails3-jquery-autocomplete.rb",
|
31
|
-
"rails3-jquery-autocomplete.gemspec",
|
32
|
-
"test/autocomplete_generator_test.rb",
|
33
|
-
"test/controller_module_test.rb",
|
34
|
-
"test/test_helper.rb"
|
35
|
-
]
|
36
|
-
s.homepage = %q{http://github.com/crowdint/rails3-jquery-autocomplete}
|
37
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
-
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = %q{1.3.7}
|
40
|
-
s.summary = %q{Use jQuery's autocomplete plugin with Rails 3.}
|
41
|
-
s.test_files = [
|
42
|
-
"test/autocomplete_generator_test.rb",
|
43
|
-
"test/controller_module_test.rb",
|
44
|
-
"test/test_helper.rb"
|
45
|
-
]
|
46
|
-
|
47
|
-
if s.respond_to? :specification_version then
|
48
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
-
s.specification_version = 3
|
50
|
-
|
51
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_development_dependency(%q<rails>, [">= 3.0.0.rc2"])
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<rails>, [">= 3.0.0.rc2"])
|
55
|
-
end
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<rails>, [">= 3.0.0.rc2"])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|