rails3-jquery-autocomplete 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -3,5 +3,4 @@ Rakefile
3
3
  lib/autocomplete.rb
4
4
  lib/generators/autocomplete_generator.rb
5
5
  lib/generators/templates/autocomplete-rails.js
6
- lib/generators/templates/autocomplete.rb
7
6
  Manifest
@@ -19,8 +19,12 @@ I'd recommend you understand what's happening with those 3 tools before attempti
19
19
 
20
20
  Include the gem on your Gemfile
21
21
 
22
- gem 'rails3-jquery-autocomplete'
23
-
22
+ gem 'rails3-jquery-autocomplete', '>= 0.0.3', :require => 'autocomplete'
23
+
24
+ Install it
25
+
26
+ bundle install
27
+
24
28
  And then, run the generator
25
29
 
26
30
  rails generate autocomplete
@@ -47,7 +51,18 @@ don't forget to add it on your routes file
47
51
 
48
52
  On your view, all you have to do is include the attribute autocomplete on the text field
49
53
  using the url to the autocomplete action as the value.
54
+ form_for @product do |f|
55
+ f.text_field :brand_name, :autocomplete => autocomplete_brand_name_products_path
56
+ end
57
+
58
+ This will generate an HTML tag that looks like:
59
+
60
+ <input type="text" autocomplete="products/autocomplete_brand_name">
61
+
62
+ Now your autocomplete JS code is unobtrusive, Rails 3 style.
63
+
64
+ And... That's it!
50
65
 
51
- f.text_field :brand_name, :autocomplete => autocomplete_brand_name_products_path
66
+ ## TODO
52
67
 
53
- That's it!
68
+ Tests
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('rails3-jquery-autocomplete', '0.0.2') do |p|
5
+ Echoe.new('rails3-jquery-autocomplete', '0.0.3') do |p|
6
6
  p.description = "Use jQuery's autocomplete plugin with Rails 3."
7
7
  p.url = "http://github.com/crowdint/rails3-jquery-autocomplete"
8
8
  p.author = "David Padilla"
@@ -1,5 +1,4 @@
1
- module AutoComplete
2
-
1
+ module Autocomplete
3
2
  def self.included(base)
4
3
  base.extend(ClassMethods)
5
4
  end
@@ -42,4 +41,8 @@ module AutoComplete
42
41
  end
43
42
  end
44
43
  end
44
+ end
45
+
46
+ class ActionController::Base
47
+ include Autocomplete
45
48
  end
@@ -4,8 +4,6 @@ class AutocompleteGenerator < Rails::Generators::Base
4
4
  def install
5
5
  # Copy the unobtrusive JS file
6
6
  copy_file('autocomplete-rails.js', 'public/autocomplete-rails.js')
7
- # Rails initializer
8
- copy_file('autocomplete.rb', 'config/initializers/autocomplete.rb')
9
7
  end
10
8
 
11
9
  def self.source_root
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rails3-jquery-autocomplete}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["David Padilla"]
9
9
  s.date = %q{2010-07-13}
10
10
  s.description = %q{Use jQuery's autocomplete plugin with Rails 3.}
11
11
  s.email = %q{david@crowdint.com}
12
- s.extra_rdoc_files = ["README.markdown", "lib/autocomplete.rb", "lib/generators/autocomplete_generator.rb", "lib/generators/templates/autocomplete-rails.js", "lib/generators/templates/autocomplete.rb"]
13
- s.files = ["README.markdown", "Rakefile", "lib/autocomplete.rb", "lib/generators/autocomplete_generator.rb", "lib/generators/templates/autocomplete-rails.js", "lib/generators/templates/autocomplete.rb", "Manifest", "rails3-jquery-autocomplete.gemspec"]
12
+ s.extra_rdoc_files = ["README.markdown", "lib/autocomplete.rb", "lib/generators/autocomplete_generator.rb", "lib/generators/templates/autocomplete-rails.js"]
13
+ s.files = ["README.markdown", "Rakefile", "lib/autocomplete.rb", "lib/generators/autocomplete_generator.rb", "lib/generators/templates/autocomplete-rails.js", "Manifest", "rails3-jquery-autocomplete.gemspec"]
14
14
  s.homepage = %q{http://github.com/crowdint/rails3-jquery-autocomplete}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rails3-jquery-autocomplete", "--main", "README.markdown"]
16
16
  s.require_paths = ["lib"]
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Padilla
@@ -30,14 +30,12 @@ extra_rdoc_files:
30
30
  - lib/autocomplete.rb
31
31
  - lib/generators/autocomplete_generator.rb
32
32
  - lib/generators/templates/autocomplete-rails.js
33
- - lib/generators/templates/autocomplete.rb
34
33
  files:
35
34
  - README.markdown
36
35
  - Rakefile
37
36
  - lib/autocomplete.rb
38
37
  - lib/generators/autocomplete_generator.rb
39
38
  - lib/generators/templates/autocomplete-rails.js
40
- - lib/generators/templates/autocomplete.rb
41
39
  - Manifest
42
40
  - rails3-jquery-autocomplete.gemspec
43
41
  has_rdoc: true
@@ -1,2 +0,0 @@
1
- require 'autocomplete'
2
- ActionController::Base.send :include, AutoComplete