rails3-jquery-autocomplete 0.0.1 → 0.0.2
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.
- data/Manifest +1 -1
- data/README.markdown +53 -0
- data/Rakefile +1 -1
- data/lib/generators/autocomplete_generator.rb +1 -1
- data/rails3-jquery-autocomplete.gemspec +4 -4
- metadata +6 -6
- data/README.rdoc +0 -0
data/Manifest
CHANGED
data/README.markdown
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# rails3-jquery-autocomplete
|
2
|
+
|
3
|
+
An easy way to use jQuery's autocomplete with Rails 3
|
4
|
+
|
5
|
+
## Before you start
|
6
|
+
|
7
|
+
Make sure your project is using jQuery and you have the Autocomplete plugin installed
|
8
|
+
before you continue.
|
9
|
+
|
10
|
+
You can find more info about that here:
|
11
|
+
|
12
|
+
* http://jquery.com/
|
13
|
+
* http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
|
14
|
+
* http://github.com/rails/jquery-ujs
|
15
|
+
|
16
|
+
I'd recommend you understand what's happening with those 3 tools before attempting to use this gem.
|
17
|
+
|
18
|
+
## Installing
|
19
|
+
|
20
|
+
Include the gem on your Gemfile
|
21
|
+
|
22
|
+
gem 'rails3-jquery-autocomplete'
|
23
|
+
|
24
|
+
And then, run the generator
|
25
|
+
|
26
|
+
rails generate autocomplete
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
### Controller
|
31
|
+
|
32
|
+
To set up an action on your controller, all you have to do is call it with the object name and the method
|
33
|
+
as in the following example:
|
34
|
+
|
35
|
+
class ProductsController < Admin::BaseController
|
36
|
+
autocomplete :brand, :name
|
37
|
+
end
|
38
|
+
|
39
|
+
This will magically generate an action autocomplete_brand_name, so,
|
40
|
+
don't forget to add it on your routes file
|
41
|
+
|
42
|
+
resources :products do
|
43
|
+
get :autocomplete_brand_name, :on => :collection
|
44
|
+
end
|
45
|
+
|
46
|
+
### View
|
47
|
+
|
48
|
+
On your view, all you have to do is include the attribute autocomplete on the text field
|
49
|
+
using the url to the autocomplete action as the value.
|
50
|
+
|
51
|
+
f.text_field :brand_name, :autocomplete => autocomplete_brand_name_products_path
|
52
|
+
|
53
|
+
That's it!
|
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.
|
5
|
+
Echoe.new('rails3-jquery-autocomplete', '0.0.2') 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"
|
@@ -5,7 +5,7 @@ class AutocompleteGenerator < Rails::Generators::Base
|
|
5
5
|
# Copy the unobtrusive JS file
|
6
6
|
copy_file('autocomplete-rails.js', 'public/autocomplete-rails.js')
|
7
7
|
# Rails initializer
|
8
|
-
copy_file('autocomplete.rb', 'initializers/autocomplete.rb')
|
8
|
+
copy_file('autocomplete.rb', 'config/initializers/autocomplete.rb')
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.source_root
|
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rails3-jquery-autocomplete}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
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.
|
13
|
-
s.files = ["README.
|
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"]
|
14
14
|
s.homepage = %q{http://github.com/crowdint/rails3-jquery-autocomplete}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rails3-jquery-autocomplete", "--main", "README.
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rails3-jquery-autocomplete", "--main", "README.markdown"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{rails3-jquery-autocomplete}
|
18
18
|
s.rubygems_version = %q{1.3.7}
|
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: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Padilla
|
@@ -26,13 +26,13 @@ executables: []
|
|
26
26
|
extensions: []
|
27
27
|
|
28
28
|
extra_rdoc_files:
|
29
|
-
- README.
|
29
|
+
- README.markdown
|
30
30
|
- lib/autocomplete.rb
|
31
31
|
- lib/generators/autocomplete_generator.rb
|
32
32
|
- lib/generators/templates/autocomplete-rails.js
|
33
33
|
- lib/generators/templates/autocomplete.rb
|
34
34
|
files:
|
35
|
-
- README.
|
35
|
+
- README.markdown
|
36
36
|
- Rakefile
|
37
37
|
- lib/autocomplete.rb
|
38
38
|
- lib/generators/autocomplete_generator.rb
|
@@ -51,7 +51,7 @@ rdoc_options:
|
|
51
51
|
- --title
|
52
52
|
- Rails3-jquery-autocomplete
|
53
53
|
- --main
|
54
|
-
- README.
|
54
|
+
- README.markdown
|
55
55
|
require_paths:
|
56
56
|
- lib
|
57
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README.rdoc
DELETED
File without changes
|