https://github.com/ekylibre/combo_box
Adds the combo_box control in Rails 3 based on jQuery UI
https://github.com/ekylibre/combo_box
Last synced: about 2 months ago
JSON representation
Adds the combo_box control in Rails 3 based on jQuery UI
- Host: GitHub
- URL: https://github.com/ekylibre/combo_box
- Owner: ekylibre
- License: mit
- Created: 2011-09-05T06:42:07.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-05-18T21:40:40.000Z (about 12 years ago)
- Last Synced: 2025-02-24T04:46:31.264Z (3 months ago)
- Language: Ruby
- Homepage: https://github.com/burisu/combo_box
- Size: 145 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE
Awesome Lists containing this project
README
= ComboBox
Adds helpers for Rails views and controller in order to manage 'dynamic select'. It uses jQuery UI as support for inobtrusive use in forms. It's not the classic Autocompleter, its use is limited to belongs_to reflections.
== Rails 3.0
ComboBox requires the gem +jquery-rails+, so if you don't already use it:
rails generate jquery:install --uiThen install +combo_box+ in your app like +jquery-rails+:
rails generate combo_box:installThen the javascript and/or stylesheet files must be included in the application layout:
<%= javascript_include_tag('combo_box') -%>
<%= stylesheet_link_tag('combo_box') -%>== Rails 3.1
Nothing to install. With the asset pipeline, there is no need to run generators or copy files. So for stylesheets:
# app/assets/stylesheets/application.css
*= require combo_boxAnd for javascripts:
# app/assets/javascripts/application.js
//= require combo_box== Usage
Classic usage in resource forms:
# app/controllers/orders_controller.rb
class OrdersController < ApplicationController
search_for :client
end# app/views/orders/_form.html.haml
combo_box :order, :clientUsage in non-resource forms with personalized controller method:
# app/controllers/orders_controller.rb
class OrdersController < ApplicationController
def search_for_orders
orders = Order.find_all_by_number(params[:term])
render orders.collect{|r| {:label=>r.number, :id=>r.id}}.to_json
end
end# app/views/orders/search.html.haml
combo_box_tag "search", :search_for_orders== Contributing to ComboBox
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.== Copyright
Copyright (c) 2011 Brice Texier. See LICENSE.txt for
further details.