idris-auto_complete_jquery 0.1.0

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.
Files changed (6) hide show
  1. data/CHANGELOG +1 -0
  2. data/README +57 -0
  3. data/Rakefile +11 -0
  4. data/auto_complete_jquery.gemspec +19 -0
  5. data/init.rb +1 -0
  6. metadata +60 -0
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ * 1 July 2008: Switched to a different jQuery autocomplete plugin to be used with this plugin. The previous plugin was not handling case insensitivity, was slow, and lacked various other options. The new jQuery autocomplete plugin this depends on his a nice improvement, being massively faster, providing a CSS style you can use while your AJAX request runs, handling case properly, and adding a slew of options.
data/README ADDED
@@ -0,0 +1,57 @@
1
+ This plugin provides a auto-complete method for your controllers to be used
2
+ with Dylan Verheul's jquery autocomplete plugin. This jQuery plugin is not
3
+ included, and can be obtained from:
4
+
5
+ http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
6
+
7
+ This auto_complete_jquery plugin is just a modified version of the standard
8
+ Rails auto_complete plugin. It provides the same auto_complete_for method
9
+ for your controllers, but eliminates the various view helper methods, as
10
+ those are not needed when using jQuery and Unobtrusive JavaScript.
11
+
12
+ To use this, you need to have jQuery and the autocomplete plugin mentioned
13
+ above (as well as appropriate CSS). Then, there are four aspects of setting
14
+ up an auto-complete field:
15
+
16
+ 1) Create the text field in your view, which is just a regular form text
17
+ field as you'd create in a Rails erb view:
18
+
19
+ <%= post.text_field :title, :autocomplete =>"off" %>
20
+
21
+ 2) Include the appropriate JS files and CSS in your layout or similar:
22
+
23
+ <%= stylesheet_link_tag 'jquery.ui.autocomplete' %>
24
+ <%= javascript_include_tag 'jquery.min', 'jquery.dimensions.min', 'jquery.templating', 'jquery.ui.autocomplete.ext', 'jquery.ui.autocomplete', :cache => 'jquery' %>
25
+
26
+ 3) Use the auto_complete_for controller macro to generate the appropriate
27
+ auto-complete method in your controller, such as:
28
+
29
+ # Controller
30
+ class BlogController < ApplicationController
31
+ auto_complete_for :post, :title
32
+ end
33
+
34
+ 4) Hook up the text field's autocomplete event in your JavaScript file
35
+ using jQuery and the jquery-autocomplete plugin mechanism, for example:
36
+
37
+ $(document).ready(function() {
38
+ $("input#post_title").autocomplete("auto_complete_for_post_title")
39
+ });
40
+
41
+ By default, auto_complete_for limits the results to 10 entries,
42
+ and sorts by the given field.
43
+
44
+ auto_complete_for takes a third parameter, an options hash to
45
+ the find method used to search for the records:
46
+
47
+ auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
48
+
49
+ For more information, see:
50
+ * jQuery site: http://jquery.com
51
+ * Dylan Verheul jquery autocomplete plugin site: http://www.dyve.net/jquery/?autocomplete
52
+ * Good article on jQuery and Rails (note this mentions a different jquery autocomplete
53
+ plugin, which was originally used in this plugin): http://errtheblog.com/posts/73-the-jskinny-on-jquery
54
+ * Original Rails auto_complete plugin: http://github.com/rails/auto_complete
55
+
56
+
57
+ Copyright (c) 2008 Cobalt Edge LLC, released under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rake/rdoctask'
3
+
4
+ desc 'Generate documentation for auto_complete plugin.'
5
+ Rake::RDocTask.new(:rdoc) do |rdoc|
6
+ rdoc.rdoc_dir = 'rdoc'
7
+ rdoc.title = 'Auto Complete jQuery'
8
+ rdoc.options << '--line-numbers' << '--inline-source'
9
+ rdoc.rdoc_files.include('README')
10
+ rdoc.rdoc_files.include('lib/**/*.rb')
11
+ end
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "auto_complete_jquery"
3
+ s.version = "0.1.0"
4
+ s.date = "2008-12-28"
5
+ s.summary = "auto-complete method for Rails controllers using Dylan Verheul's jQuery autocomplete plugin"
6
+ s.email = "chris@cobaltedge.com"
7
+ s.homepage = "http://github.com/mojombo/grit"
8
+ s.description = "This plugin provides a auto-complete method for your controllers to be used with Dylan Verheul's jquery autocomplete plugin."
9
+ s.has_rdoc = true
10
+ s.authors = ["Chris Bailey"]
11
+ s.files = ["CHANGELOG",
12
+ "README",
13
+ "Rakefile",
14
+ "auto_complete_jquery.gemspec",
15
+ "init.rb",
16
+ "lib/quto_complete_jquery.rb"]
17
+ s.rdoc_options = ["--main", "README.txt"]
18
+ s.extra_rdoc_files = ["CHANGELOG", "README"]
19
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ ActionController::Base.send :include, AutoCompleteJquery
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: idris-auto_complete_jquery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Bailey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-28 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: This plugin provides a auto-complete method for your controllers to be used with Dylan Verheul's jquery autocomplete plugin.
17
+ email: chris@cobaltedge.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG
24
+ - README
25
+ files:
26
+ - CHANGELOG
27
+ - README
28
+ - Rakefile
29
+ - auto_complete_jquery.gemspec
30
+ - init.rb
31
+ - lib/quto_complete_jquery.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/mojombo/grit
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --main
37
+ - README.txt
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project:
55
+ rubygems_version: 1.2.0
56
+ signing_key:
57
+ specification_version: 2
58
+ summary: auto-complete method for Rails controllers using Dylan Verheul's jQuery autocomplete plugin
59
+ test_files: []
60
+