activeadmin_selectize 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/app/assets/javascripts/activeadmin/selectize_input.js +13 -6
- data/lib/activeadmin/selectize/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e2093aedb2e382b18c8e1af2d8efc96a2a69f37
|
4
|
+
data.tar.gz: b378a94c0b8ca17917b489cb5ce764498a934de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f450b2c81f547de8bc6cce1af359e21a9d42d667daed84eca835ae2054e139e389dc451e93d520e2fad79eb81b1e035c19c2f576aee6c994592df973d8a4082
|
7
|
+
data.tar.gz: b1e182ad2dc3c851cc39330dff7dca083f3d08c9ff12f761adbff3ec001356fc3425a9b00fe227fc01ed17951196650f30cee60c71f500b506ca8a1378e33790
|
data/README.md
CHANGED
@@ -6,11 +6,13 @@ Features:
|
|
6
6
|
- nice select inputs
|
7
7
|
- items search
|
8
8
|
- AJAX content loading
|
9
|
+
- improve many-to-many / one-to-many selection
|
9
10
|
|
10
11
|
## Install
|
11
12
|
|
12
|
-
- Add to your Gemfile
|
13
|
+
- Add to your Gemfile:
|
13
14
|
`gem 'activeadmin_selectize'`
|
15
|
+
- Add _jquery-rails_ gem or include jQuery manually
|
14
16
|
- Execute bundle
|
15
17
|
- Add at the end of your ActiveAdmin styles (_app/assets/stylesheets/active_admin.scss_):
|
16
18
|
`@import 'activeadmin/selectize_input';`
|
@@ -21,7 +23,7 @@ Features:
|
|
21
23
|
```
|
22
24
|
- Use the input with `as: :selectize` in Active Admin model conf
|
23
25
|
|
24
|
-
Why 2 separated scripts? In this way you can include a different version of
|
26
|
+
Why 2 separated scripts? In this way you can include a different version of Selectize.js if you like.
|
25
27
|
|
26
28
|
## Example
|
27
29
|
|
@@ -54,7 +56,11 @@ Pass the required options using `input_html`.
|
|
54
56
|
- **data-opt-remote**: URL used for AJAX search requests (method GET)
|
55
57
|
- **data-opt-text**: field to use as option label
|
56
58
|
- **data-opt-value**: field to use as select value
|
57
|
-
- **data-opt
|
59
|
+
- **data-opt-NAME**: option _NAME_ passed directly to Selectize.js - see [options](https://github.com/selectize/selectize.js/blob/master/docs/usage.md#configuration)
|
60
|
+
|
61
|
+
Alternative syntax:
|
62
|
+
|
63
|
+
- **data-options**: overrides Selectize options - example: `'data-options': '{"highlight":true,"plugins":[]}'`
|
58
64
|
|
59
65
|
## Contributors
|
60
66
|
|
@@ -13,12 +13,19 @@ $(document).ready( function() {
|
|
13
13
|
searchField: field_text,
|
14
14
|
valueField: field_value
|
15
15
|
};
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if( name
|
20
|
-
|
21
|
-
|
16
|
+
|
17
|
+
if (!$(this).data('options') ) {
|
18
|
+
$.each( this.attributes, function( i, attr ) {
|
19
|
+
if( attr.name.startsWith( 'data-opt-' ) ) {
|
20
|
+
var name = attr.name.substr( 9 );
|
21
|
+
if( name != 'remote' && name != 'text' && name != 'value' ) opts[name] = ( attr.value == 'true' ) ? true : ( ( attr.value == 'false' ) ? false : attr.value );
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
opts = $.extend({}, opts, $(this).data('options'));
|
27
|
+
}
|
28
|
+
|
22
29
|
opts['load'] = function( query, callback ) {
|
23
30
|
if( !query.length ) return callback();
|
24
31
|
$.ajax({
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_selectize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|