forked from cainlevy/recordselect
-
Notifications
You must be signed in to change notification settings - Fork 16
/
README
51 lines (34 loc) · 1.49 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
RecordSelect
============
(c) 2007 - 2016 Sergio Cambra, Lance Ivy
RecordSelect is a Rails widget to help you pick one record out of many. I designed it as a more usable and performant alternative to generating a massive dropdown list. It relies on AJAX, powered by jQuery, so jQuery must be loaded first, either from jquery-rails gem or just loading the JS in the assets pipeline, or imported before importing record_select if using importmap.
Please see the ActionView::Helpers::RecordSelectHelpers for the most common API. More documentation (and HOWTOs) can be found online at the wiki.
= USAGE WITH ASSETS PIPELINE
Add to application.js
```js
//= require jquery
//= require record_select
```
= USAGE WITH IMPORTMAP
Add to importmap.rb
```rb
pin "jquery"
pin "record_select"
```
Add to app/assets/config/manifest.js
```js
//= link jquery.js
//= link record_select.js
```
Add to app/javascript/application.js
```js
import 'jquery'
import 'record_select'
```
= USAGE WITH ACTIVE_SCAFFOLD
Either using assets pipeline or importmap, it will be loaded when requiring or importing active_scaffold, so no need to add it to application.js, importmap.rb or manifest.js
= DEPENDENCIES
This depends on the excellent Paginator gem by Bruce Williams. This simple gem is available at paginator.rubyforge.org.
It should autoselect js framework, but you can select :jquery or :prototype framework with config/initializer file:
RecordSelect::Config.js_framework = :jquery
RecordSelect::Config.js_framework = :prototype