activeadmin_selectize 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -13
- data/app/assets/stylesheets/activeadmin/_selectize_input.sass +1 -1
- 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: 3547c31cd6c7e4133b4e01207346c6b49d362f54
|
4
|
+
data.tar.gz: 8374b9f2f4adff98f540a6de0ebc4810acc486be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82d587c55041402d5ddc4ddd21cae3f34e5a52678a8bab34ecfccba05af16c4344a4086677e1ab1d3a23f944d8dffacb4d55582c3357614a6db0e0fd4185759
|
7
|
+
data.tar.gz: 8e50003c64850744ca0de6827916fb911f06de7ef0fabfd8b78791cd4419c0be631ac962d7bb6beb1ee23185368b9ec5697a0157cb1717385d1e374abab4d657
|
data/README.md
CHANGED
@@ -25,19 +25,7 @@ Features:
|
|
25
25
|
|
26
26
|
Why 2 separated scripts? In this way you can include a different version of Selectize.js if you like.
|
27
27
|
|
28
|
-
##
|
29
|
-
|
30
|
-
- In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example:
|
31
|
-
|
32
|
-
```rb
|
33
|
-
index download_links: [:csv, :json] do
|
34
|
-
# ...
|
35
|
-
end
|
36
|
-
```
|
37
|
-
|
38
|
-
- If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'`
|
39
|
-
|
40
|
-
## Example
|
28
|
+
## Examples
|
41
29
|
|
42
30
|
Example 1: an Article model with a many-to-many relation with Tag model:
|
43
31
|
|
@@ -70,6 +58,28 @@ filter :name_eq, as: :selectize, collection: Author.all.pluck( :name, :name )
|
|
70
58
|
filter :tags_id_eq, as: :selectize, collection: [], input_html: { 'data-opt-remote': '/admin/tags.json', 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opts': '{"dropdownParent":"body"}', placeholder: 'Search a tag...' }
|
71
59
|
```
|
72
60
|
|
61
|
+
## Notes
|
62
|
+
|
63
|
+
- In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example:
|
64
|
+
|
65
|
+
```rb
|
66
|
+
index download_links: [:csv, :json] do
|
67
|
+
# ...
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
You can customize the JSON response overriding the *as_json* method of the model:
|
72
|
+
|
73
|
+
```rb
|
74
|
+
def as_json( options = nil )
|
75
|
+
super({ only: [:id], methods: [:fullname] }.merge(options || {}))
|
76
|
+
end
|
77
|
+
```
|
78
|
+
|
79
|
+
- If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'`
|
80
|
+
|
81
|
+
- Alternative syntax to pass data attributes: `input_html: { data: { opts: '{}' } }`
|
82
|
+
|
73
83
|
## Options
|
74
84
|
|
75
85
|
Pass the required options using `input_html`.
|
@@ -83,6 +93,12 @@ Alternative syntax:
|
|
83
93
|
|
84
94
|
- **data-opts**: overrides Selectize options - example: `'data-opts': '{"highlight":true,"plugins":[]}'`
|
85
95
|
|
96
|
+
## Do you like it? Star it!
|
97
|
+
|
98
|
+
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
|
99
|
+
|
100
|
+
Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
|
101
|
+
|
86
102
|
## Contributors
|
87
103
|
|
88
104
|
- [Mattia Roccoberton](http://blocknot.es) - creator, maintainer
|
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.5
|
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-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|