AutoAwesompleteTag
Provide tag-helper methods for create awesomplete elements by the same way as any other view elements.
Installation
Firstly install AutoAwesomplete with dependency. Then add this line to your application's Gemfile:
gem 'auto_awesomplete_tag'
And execute:
$ bundle
Example
(stub)
Usage
Gem provide only one helper method for initialize awesomplete elements:
- awesomplete_ajax_tag
details about realization you can find on AutoAwesomplete page.
awesomplete_ajax_tag
awesomplete_ajax_tag(name, searcher, value = nil, = {})
All allowed options for this helper can be found on AutoAwesomplete page. look at example below; this is an easy way to understand helper parameters.
Example of usage awesomplete_ajax_tag
If you define SearchAdapter
named MySearchAdapterName
, you can use the follow code:
= awesomplete_ajax_tag :my_awesomplete_name,
:my_search_adapter_name,
placeholder: 'Fill me now!',
search_method: :unusual_case,
class: 'my-awesomplete-input'
If you want lightweight selection over columns of ActiveRecord
model:
= awesomplete_ajax_tag :my_awesomplete_name,
{class_name: :your_model_name, text_column: :name},
placeholder: 'Fill me now!'
In this case you get awesomplete with search by name
column over model YourModelName
.
Contributing
- Fork it ( http://github.com/Tab10id/auto_awesomplete_tag/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request