Skip to content

Commit

Permalink
Merge remote branch 'crowdint/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Slash4 committed Nov 23, 2011
2 parents 9f5fa6c + 2464cc5 commit 3937866
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

* 1.0.3 Fixed Formtastic 2.0 + Ruby 1.8.7 compat issue
* 1.0.2 Fixed issue #93, #94
* 1.0.1 Formtastic 2.0 compatibility fix
* 1.0.0 Rails 3.1 asset pipeline support
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,30 @@ And include autocomplete-rails.js on your layouts

javascript_include_tag "autocomplete-rails.js"

### Rails 3.1.x

Just add it to your app/assets/javascripts/application.js file

//= require jquery
//= require jquery_ujs
//= require autocomplete-rails

## Upgrading from older versions
#### Upgrading from older versions

If you are upgrading from a previous version, run the generator after installing to replace the javascript file.

rails generate autocomplete:install

I'd recommend you do this every time you update to make sure you have the latest JS file.

## Uncompressed Javascript file
#### Uncompressed Javascript file

If you want to make changes to the JS file, you can install the
uncompressed version by running:

rails generate autocomplete:uncompressed

### Rails 3.1.x

Just add it to your app/assets/javascripts/application.js file

//= require jquery
//= require jquery_ujs
//= require jquery_ui
//= require autocomplete-rails

## Usage

### Model Example
Expand Down Expand Up @@ -223,8 +224,8 @@ The previous example would fetch the extra attribute slogan and update jQuery('#
A javascript event named *railsAutocomplete.select* is fired on the input field when a value is selected from the autocomplete drop down. If you need to do something more complex than update fields with data, you can hook into this event, like so:

$('#my_autocomplete_field').bind('railsAutocomplete.select', function(event, data){
/* Do something here */
alert(data.item.id);
/* Do something here */
alert(data.item.id);
});

## Formtastic
Expand Down
2 changes: 1 addition & 1 deletion integration/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gem 'rails', '~> 3.0.10'
gem 'annotate'
gem 'capybara'
gem 'cucumber-rails'
gem 'formtastic' #, path: '../../formtastic'
gem 'formtastic'#, :path => '../../formtastic'
gem 'rspec-rails'
gem 'steak'
gem 'database_cleaner'
Expand Down
2 changes: 1 addition & 1 deletion integration/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../
specs:
rails3-jquery-autocomplete (1.0.2)
rails3-jquery-autocomplete (1.0.3)
rails (~> 3.0)

GEM
Expand Down
11 changes: 7 additions & 4 deletions lib/rails3-jquery-autocomplete/formtastic.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#
# Load the formtastic plugin if using Formtastic
#
begin
require 'formtastic'
begin
require "formtastic/version"
rescue LoadError
end

if Formtastic.constants.include?(:VERSION)

if defined?(Formtastic::VERSION)
#
# Formtastic 2.0
# Formtastic 2.x
#


module Formtastic
module Inputs
class AutocompleteInput
Expand Down
2 changes: 1 addition & 1 deletion lib/rails3-jquery-autocomplete/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Rails3JQueryAutocomplete
VERSION = '1.0.2'
VERSION = '1.0.4'
end

0 comments on commit 3937866

Please sign in to comment.