activeadmin-ajax_filter 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/Gemfile +2 -1
- data/Gemfile.lock +99 -96
- data/README.md +20 -0
- data/activeadmin-ajax_filter.gemspec +2 -2
- data/app/assets/javascripts/activeadmin-ajax_filter.js.coffee +8 -3
- data/app/assets/stylesheets/{activeadmin-ajax_filter.css → activeadmin-ajax_filter.scss} +0 -0
- data/lib/active_admin/ajax_filter.rb +4 -4
- data/lib/active_admin/ajax_filter/version.rb +1 -1
- data/lib/active_admin/inputs/ajax_core.rb +5 -0
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c172a963f8a95375c2b510f11c9ec7f4f2641253
|
|
4
|
+
data.tar.gz: 32f874eb19074d53b794e975300ee782a8c2919a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e771c42b7d88b7c91fea8998856d2e295028a19bba9ae1888614fa4e09e8fc218004e26b4f7adbe9b803218ff216623f342fa6de6bc6917ca04aea1f0523dd93
|
|
7
|
+
data.tar.gz: 50846de39f9c27886e158c9214ae4669c53fb237dc7fdc175a1192486c32d2dda925f3a4fdaf14e2dd6835e9d7a061b6b12f5235b409888b695064faa972663c
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
activeadmin-ajax_filter (0.
|
|
5
|
-
activeadmin (>= 1.0
|
|
4
|
+
activeadmin-ajax_filter (0.4.0)
|
|
5
|
+
activeadmin (>= 1.0)
|
|
6
6
|
coffee-rails (>= 4.1.0)
|
|
7
7
|
has_scope (>= 0.6.0)
|
|
8
|
-
rails (>= 4)
|
|
8
|
+
rails (>= 4.2)
|
|
9
9
|
selectize-rails (>= 0.11.2)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actionmailer (4.2.
|
|
15
|
-
actionpack (= 4.2.
|
|
16
|
-
actionview (= 4.2.
|
|
17
|
-
activejob (= 4.2.
|
|
14
|
+
actionmailer (4.2.10)
|
|
15
|
+
actionpack (= 4.2.10)
|
|
16
|
+
actionview (= 4.2.10)
|
|
17
|
+
activejob (= 4.2.10)
|
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
|
19
19
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
20
|
-
actionpack (4.2.
|
|
21
|
-
actionview (= 4.2.
|
|
22
|
-
activesupport (= 4.2.
|
|
20
|
+
actionpack (4.2.10)
|
|
21
|
+
actionview (= 4.2.10)
|
|
22
|
+
activesupport (= 4.2.10)
|
|
23
23
|
rack (~> 1.6)
|
|
24
24
|
rack-test (~> 0.6.2)
|
|
25
25
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
-
actionview (4.2.
|
|
28
|
-
activesupport (= 4.2.
|
|
27
|
+
actionview (4.2.10)
|
|
28
|
+
activesupport (= 4.2.10)
|
|
29
29
|
builder (~> 3.1)
|
|
30
30
|
erubis (~> 2.7.0)
|
|
31
31
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
32
32
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
-
activeadmin (1.
|
|
33
|
+
activeadmin (1.3.1)
|
|
34
34
|
arbre (>= 1.1.1)
|
|
35
|
-
bourbon
|
|
36
35
|
coffee-rails
|
|
37
36
|
formtastic (~> 3.1)
|
|
38
37
|
formtastic_i18n
|
|
39
|
-
inherited_resources (
|
|
40
|
-
jquery-rails
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
sass-rails
|
|
38
|
+
inherited_resources (>= 1.9.0)
|
|
39
|
+
jquery-rails (>= 4.2.0)
|
|
40
|
+
kaminari (>= 0.15)
|
|
41
|
+
railties (>= 4.2, < 5.3)
|
|
42
|
+
ransack (>= 1.8.7)
|
|
43
|
+
sass (~> 3.1)
|
|
46
44
|
sprockets (< 4.1)
|
|
47
|
-
activejob (4.2.
|
|
48
|
-
activesupport (= 4.2.
|
|
45
|
+
activejob (4.2.10)
|
|
46
|
+
activesupport (= 4.2.10)
|
|
49
47
|
globalid (>= 0.3.0)
|
|
50
|
-
activemodel (4.2.
|
|
51
|
-
activesupport (= 4.2.
|
|
48
|
+
activemodel (4.2.10)
|
|
49
|
+
activesupport (= 4.2.10)
|
|
52
50
|
builder (~> 3.1)
|
|
53
|
-
activerecord (4.2.
|
|
54
|
-
activemodel (= 4.2.
|
|
55
|
-
activesupport (= 4.2.
|
|
51
|
+
activerecord (4.2.10)
|
|
52
|
+
activemodel (= 4.2.10)
|
|
53
|
+
activesupport (= 4.2.10)
|
|
56
54
|
arel (~> 6.0)
|
|
57
|
-
activesupport (4.2.
|
|
55
|
+
activesupport (4.2.10)
|
|
58
56
|
i18n (~> 0.7)
|
|
59
57
|
minitest (~> 5.1)
|
|
60
58
|
thread_safe (~> 0.3, >= 0.3.4)
|
|
@@ -63,9 +61,6 @@ GEM
|
|
|
63
61
|
arbre (1.1.1)
|
|
64
62
|
activesupport (>= 3.0.0)
|
|
65
63
|
arel (6.0.4)
|
|
66
|
-
bourbon (4.3.4)
|
|
67
|
-
sass (~> 3.4)
|
|
68
|
-
thor (~> 0.19)
|
|
69
64
|
builder (3.2.3)
|
|
70
65
|
capybara (2.7.1)
|
|
71
66
|
addressable
|
|
@@ -85,9 +80,15 @@ GEM
|
|
|
85
80
|
execjs
|
|
86
81
|
coffee-script-source (1.12.2)
|
|
87
82
|
concurrent-ruby (1.0.5)
|
|
83
|
+
crass (1.0.4)
|
|
88
84
|
database_cleaner (1.5.3)
|
|
89
85
|
diff-lcs (1.2.5)
|
|
90
86
|
docile (1.1.5)
|
|
87
|
+
draper (2.1.0)
|
|
88
|
+
actionpack (>= 3.0)
|
|
89
|
+
activemodel (>= 3.0)
|
|
90
|
+
activesupport (>= 3.0)
|
|
91
|
+
request_store (~> 1.0)
|
|
91
92
|
erubis (2.7.0)
|
|
92
93
|
execjs (2.7.0)
|
|
93
94
|
factory_girl (4.5.0)
|
|
@@ -95,93 +96,97 @@ GEM
|
|
|
95
96
|
factory_girl_rails (4.5.0)
|
|
96
97
|
factory_girl (~> 4.5.0)
|
|
97
98
|
railties (>= 3.0.0)
|
|
99
|
+
ffi (1.9.25)
|
|
98
100
|
formtastic (3.1.5)
|
|
99
101
|
actionpack (>= 3.2.13)
|
|
100
102
|
formtastic_i18n (0.6.0)
|
|
101
|
-
globalid (0.4.
|
|
103
|
+
globalid (0.4.1)
|
|
102
104
|
activesupport (>= 4.2.0)
|
|
103
|
-
has_scope (0.7.
|
|
104
|
-
actionpack (>= 4.1
|
|
105
|
-
activesupport (>= 4.1
|
|
106
|
-
i18n (0.
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
has_scope (0.7.2)
|
|
106
|
+
actionpack (>= 4.1)
|
|
107
|
+
activesupport (>= 4.1)
|
|
108
|
+
i18n (0.9.5)
|
|
109
|
+
concurrent-ruby (~> 1.0)
|
|
110
|
+
inherited_resources (1.9.0)
|
|
111
|
+
actionpack (>= 4.2, < 5.3)
|
|
109
112
|
has_scope (~> 0.6)
|
|
110
|
-
railties (>=
|
|
113
|
+
railties (>= 4.2, < 5.3)
|
|
111
114
|
responders
|
|
112
|
-
jquery-rails (4.3.
|
|
115
|
+
jquery-rails (4.3.3)
|
|
113
116
|
rails-dom-testing (>= 1, < 3)
|
|
114
117
|
railties (>= 4.2.0)
|
|
115
118
|
thor (>= 0.14, < 2.0)
|
|
116
|
-
jquery-ui-rails (6.0.1)
|
|
117
|
-
railties (>= 3.2.16)
|
|
118
119
|
json (1.8.6)
|
|
119
|
-
kaminari (1.
|
|
120
|
+
kaminari (1.1.1)
|
|
120
121
|
activesupport (>= 4.1.0)
|
|
121
|
-
kaminari-actionview (= 1.
|
|
122
|
-
kaminari-activerecord (= 1.
|
|
123
|
-
kaminari-core (= 1.
|
|
124
|
-
kaminari-actionview (1.
|
|
122
|
+
kaminari-actionview (= 1.1.1)
|
|
123
|
+
kaminari-activerecord (= 1.1.1)
|
|
124
|
+
kaminari-core (= 1.1.1)
|
|
125
|
+
kaminari-actionview (1.1.1)
|
|
125
126
|
actionview
|
|
126
|
-
kaminari-core (= 1.
|
|
127
|
-
kaminari-activerecord (1.
|
|
127
|
+
kaminari-core (= 1.1.1)
|
|
128
|
+
kaminari-activerecord (1.1.1)
|
|
128
129
|
activerecord
|
|
129
|
-
kaminari-core (= 1.
|
|
130
|
-
kaminari-core (1.
|
|
130
|
+
kaminari-core (= 1.1.1)
|
|
131
|
+
kaminari-core (1.1.1)
|
|
131
132
|
launchy (2.4.3)
|
|
132
133
|
addressable (~> 2.3)
|
|
133
|
-
loofah (2.
|
|
134
|
+
loofah (2.2.2)
|
|
135
|
+
crass (~> 1.0.2)
|
|
134
136
|
nokogiri (>= 1.5.9)
|
|
135
|
-
mail (2.
|
|
136
|
-
|
|
137
|
-
mime-types (3.
|
|
137
|
+
mail (2.7.0)
|
|
138
|
+
mini_mime (>= 0.1.1)
|
|
139
|
+
mime-types (3.2.2)
|
|
138
140
|
mime-types-data (~> 3.2015)
|
|
139
|
-
mime-types-data (3.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
mime-types-data (3.2018.0812)
|
|
142
|
+
mini_mime (1.0.1)
|
|
143
|
+
mini_portile2 (2.3.0)
|
|
144
|
+
minitest (5.11.3)
|
|
145
|
+
nokogiri (1.8.4)
|
|
146
|
+
mini_portile2 (~> 2.3.0)
|
|
144
147
|
phantomjs (2.1.1.0)
|
|
145
148
|
poltergeist (1.10.0)
|
|
146
149
|
capybara (~> 2.1)
|
|
147
150
|
cliver (~> 0.3.1)
|
|
148
151
|
websocket-driver (>= 0.2.0)
|
|
149
|
-
|
|
150
|
-
activerecord (>= 3.0)
|
|
151
|
-
rack (1.6.8)
|
|
152
|
+
rack (1.6.10)
|
|
152
153
|
rack-test (0.6.3)
|
|
153
154
|
rack (>= 1.0)
|
|
154
|
-
rails (4.2.
|
|
155
|
-
actionmailer (= 4.2.
|
|
156
|
-
actionpack (= 4.2.
|
|
157
|
-
actionview (= 4.2.
|
|
158
|
-
activejob (= 4.2.
|
|
159
|
-
activemodel (= 4.2.
|
|
160
|
-
activerecord (= 4.2.
|
|
161
|
-
activesupport (= 4.2.
|
|
155
|
+
rails (4.2.10)
|
|
156
|
+
actionmailer (= 4.2.10)
|
|
157
|
+
actionpack (= 4.2.10)
|
|
158
|
+
actionview (= 4.2.10)
|
|
159
|
+
activejob (= 4.2.10)
|
|
160
|
+
activemodel (= 4.2.10)
|
|
161
|
+
activerecord (= 4.2.10)
|
|
162
|
+
activesupport (= 4.2.10)
|
|
162
163
|
bundler (>= 1.3.0, < 2.0)
|
|
163
|
-
railties (= 4.2.
|
|
164
|
+
railties (= 4.2.10)
|
|
164
165
|
sprockets-rails
|
|
165
166
|
rails-deprecated_sanitizer (1.0.3)
|
|
166
167
|
activesupport (>= 4.2.0.alpha)
|
|
167
|
-
rails-dom-testing (1.0.
|
|
168
|
-
activesupport (>= 4.2.0
|
|
168
|
+
rails-dom-testing (1.0.9)
|
|
169
|
+
activesupport (>= 4.2.0, < 5.0)
|
|
169
170
|
nokogiri (~> 1.6)
|
|
170
171
|
rails-deprecated_sanitizer (>= 1.0.1)
|
|
171
|
-
rails-html-sanitizer (1.0.
|
|
172
|
-
loofah (~> 2.
|
|
173
|
-
railties (4.2.
|
|
174
|
-
actionpack (= 4.2.
|
|
175
|
-
activesupport (= 4.2.
|
|
172
|
+
rails-html-sanitizer (1.0.4)
|
|
173
|
+
loofah (~> 2.2, >= 2.2.2)
|
|
174
|
+
railties (4.2.10)
|
|
175
|
+
actionpack (= 4.2.10)
|
|
176
|
+
activesupport (= 4.2.10)
|
|
176
177
|
rake (>= 0.8.7)
|
|
177
178
|
thor (>= 0.18.1, < 2.0)
|
|
178
179
|
rake (10.5.0)
|
|
179
|
-
ransack (1.8.
|
|
180
|
-
actionpack (>= 3.0)
|
|
181
|
-
activerecord (>= 3.0)
|
|
182
|
-
activesupport (>= 3.0)
|
|
180
|
+
ransack (1.8.9)
|
|
181
|
+
actionpack (>= 3.0, <= 5.1.1)
|
|
182
|
+
activerecord (>= 3.0, <= 5.1.1)
|
|
183
|
+
activesupport (>= 3.0, <= 5.1.1)
|
|
183
184
|
i18n
|
|
184
|
-
|
|
185
|
+
rb-fsevent (0.10.3)
|
|
186
|
+
rb-inotify (0.9.10)
|
|
187
|
+
ffi (>= 0.5.0, < 2)
|
|
188
|
+
request_store (1.4.1)
|
|
189
|
+
rack (>= 1.4)
|
|
185
190
|
responders (2.4.0)
|
|
186
191
|
actionpack (>= 4.2.0, < 5.3)
|
|
187
192
|
railties (>= 4.2.0, < 5.3)
|
|
@@ -206,20 +211,18 @@ GEM
|
|
|
206
211
|
rspec-mocks (~> 3.3.0)
|
|
207
212
|
rspec-support (~> 3.3.0)
|
|
208
213
|
rspec-support (3.3.0)
|
|
209
|
-
sass (3.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
sprockets-rails (>= 2.0, < 4.0)
|
|
215
|
-
tilt (>= 1.1, < 3)
|
|
214
|
+
sass (3.5.7)
|
|
215
|
+
sass-listen (~> 4.0.0)
|
|
216
|
+
sass-listen (4.0.0)
|
|
217
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
218
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
216
219
|
selectize-rails (0.12.4)
|
|
217
220
|
simplecov (0.11.1)
|
|
218
221
|
docile (~> 1.1.0)
|
|
219
222
|
json (~> 1.8)
|
|
220
223
|
simplecov-html (~> 0.10.0)
|
|
221
224
|
simplecov-html (0.10.0)
|
|
222
|
-
sprockets (3.7.
|
|
225
|
+
sprockets (3.7.2)
|
|
223
226
|
concurrent-ruby (~> 1.0)
|
|
224
227
|
rack (> 1, < 3)
|
|
225
228
|
sprockets-rails (3.2.1)
|
|
@@ -232,8 +235,7 @@ GEM
|
|
|
232
235
|
activesupport (>= 3.1)
|
|
233
236
|
thor (0.20.0)
|
|
234
237
|
thread_safe (0.3.6)
|
|
235
|
-
|
|
236
|
-
tzinfo (1.2.3)
|
|
238
|
+
tzinfo (1.2.5)
|
|
237
239
|
thread_safe (~> 0.1)
|
|
238
240
|
websocket-driver (0.6.4)
|
|
239
241
|
websocket-extensions (>= 0.1.0)
|
|
@@ -250,6 +252,7 @@ DEPENDENCIES
|
|
|
250
252
|
capybara (~> 2.1)
|
|
251
253
|
codeclimate-test-reporter (~> 0.4)
|
|
252
254
|
database_cleaner (~> 1.5.0)
|
|
255
|
+
draper
|
|
253
256
|
factory_girl_rails
|
|
254
257
|
launchy (~> 2.4.3)
|
|
255
258
|
phantomjs (~> 2.1.1)
|
|
@@ -262,4 +265,4 @@ DEPENDENCIES
|
|
|
262
265
|
temping (~> 3.3, >= 3.3.0)
|
|
263
266
|
|
|
264
267
|
BUNDLED WITH
|
|
265
|
-
1.
|
|
268
|
+
1.16.2
|
data/README.md
CHANGED
|
@@ -17,6 +17,8 @@ Filter
|
|
|
17
17
|
|
|
18
18
|
## Prerequisites
|
|
19
19
|
|
|
20
|
+
Minimum Ruby version `2.3`
|
|
21
|
+
|
|
20
22
|
This extension assumes that you're using [Active Admin](https://github.com/activeadmin/activeadmin) with [Ransack](https://github.com/activerecord-hackery/ransack). And for AJAX input it uses [selectize-rails](https://github.com/manuelvanrijn/selectize-rails)
|
|
21
23
|
|
|
22
24
|
## Installation
|
|
@@ -90,6 +92,7 @@ end
|
|
|
90
92
|
You can use next parameters in `data` hash:
|
|
91
93
|
|
|
92
94
|
* `search_fields` - fields by which AJAX search will be performed, **required**
|
|
95
|
+
* `display_fields` - fields which will be displayed in drop down list during search, first field will be displayed for selected option
|
|
93
96
|
* `limit` - count of the items which will be requested by AJAX, by default `5`
|
|
94
97
|
* `value_field` - value field for html select element, by default `id`
|
|
95
98
|
* `ordering` - sort string like `email ASC, customer_uid DESC`, by default it uses first value of `search_fields` with `ASC` direction
|
|
@@ -98,6 +101,23 @@ You can use next parameters in `data` hash:
|
|
|
98
101
|
* `ajax_search_fields` - array of field names. `ajax_select` input depends on `ajax_search_fields` values: e.g. you can scope user by languages.
|
|
99
102
|
* `static_ransack` - hash of ransack predicates which will be applied statically and independently from current input field value
|
|
100
103
|
|
|
104
|
+
## Caveats
|
|
105
|
+
|
|
106
|
+
### Ransack _cont on Integer column
|
|
107
|
+
|
|
108
|
+
Due to issue with Ransack and Postgres it's not possbile to make searches like `id_cont` because `id` is a `Integer` type (more here https://github.com/activerecord-hackery/ransack/issues/85)
|
|
109
|
+
|
|
110
|
+
The way to handle it find with another predicate like:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
filter :user_id, as: :ajax_select, collection: [], data: {
|
|
114
|
+
url: '/admin/users/filter',
|
|
115
|
+
display_fields: [:full_name, :phone],
|
|
116
|
+
ransack: 'id_eq', # !!! predicate is ovewritten to `eq` by default it's `cont`
|
|
117
|
+
search_fields: ['id'],
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
101
121
|
## Development
|
|
102
122
|
|
|
103
123
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
20
|
gem.require_paths = ['lib']
|
|
21
21
|
|
|
22
|
-
gem.add_dependency 'activeadmin', '>= 1.0
|
|
23
|
-
gem.add_dependency 'rails', '>= 4'
|
|
22
|
+
gem.add_dependency 'activeadmin', '>= 1.0'
|
|
23
|
+
gem.add_dependency 'rails', '>= 4.2'
|
|
24
24
|
gem.add_dependency 'coffee-rails', '>= 4.1.0'
|
|
25
25
|
gem.add_dependency 'selectize-rails', '>= 0.11.2'
|
|
26
26
|
gem.add_dependency 'has_scope', '>= 0.6.0' # Force Ruby 2.1.5 support
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
$ ->
|
|
2
|
+
unique = (array) ->
|
|
3
|
+
array.filter (item, i, array) ->
|
|
4
|
+
i == array.indexOf(item)
|
|
5
|
+
|
|
2
6
|
apply_filter_ajax_select = () ->
|
|
3
7
|
$('.filter_ajax_select select, .ajax_select select').each (_, select) ->
|
|
4
8
|
select = $(select)
|
|
5
9
|
valueField = select.data('value-field')
|
|
10
|
+
display_fields = select.data('display-fields').split(' ')
|
|
6
11
|
searchFields = select.data('search-fields').split(' ')
|
|
7
12
|
staticRansack = select.data('static-ransack')
|
|
8
13
|
|
|
@@ -40,7 +45,7 @@ $ ->
|
|
|
40
45
|
|
|
41
46
|
select.selectize
|
|
42
47
|
valueField: valueField
|
|
43
|
-
labelField:
|
|
48
|
+
labelField: display_fields[0]
|
|
44
49
|
searchField: searchFields
|
|
45
50
|
sortField: ordering.split(',').map (clause)->
|
|
46
51
|
c = clause.trim().split(' ')
|
|
@@ -49,7 +54,7 @@ $ ->
|
|
|
49
54
|
create: false
|
|
50
55
|
render:
|
|
51
56
|
option: (item, escape) ->
|
|
52
|
-
html = searchFields.map (field, index)->
|
|
57
|
+
html = unique(display_fields.concat(searchFields)).map (field, index)->
|
|
53
58
|
value = escape(item[field])
|
|
54
59
|
|
|
55
60
|
if index == 0
|
|
@@ -103,4 +108,4 @@ $ ->
|
|
|
103
108
|
|
|
104
109
|
# apply ajax filter on inputs inside has_many entries
|
|
105
110
|
$("form.formtastic .has_many_add").click ->
|
|
106
|
-
setTimeout((-> apply_filter_ajax_select()), 0)
|
|
111
|
+
setTimeout((-> apply_filter_ajax_select()), 0)
|
|
File without changes
|
|
@@ -14,10 +14,10 @@ module ActiveAdmin
|
|
|
14
14
|
def included(dsl)
|
|
15
15
|
dsl.instance_eval do
|
|
16
16
|
collection_action :filter, method: :get do
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
render plain: apply_collection_decorator(
|
|
18
|
+
find_collection(except: [:pagination, :collection_decorator])
|
|
19
|
+
.order(params[:order]).limit(params[:limit] || 10),
|
|
20
|
+
).to_json
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -11,6 +11,7 @@ module ActiveAdmin
|
|
|
11
11
|
super.merge(
|
|
12
12
|
'data-limit' => collection_limit,
|
|
13
13
|
'data-value-field' => value_field,
|
|
14
|
+
'data-display-fields' => display_fields,
|
|
14
15
|
'data-search-fields' => search_fields,
|
|
15
16
|
'data-ajax-search-fields' => ajax_search_fields,
|
|
16
17
|
'data-ordering' => ordering,
|
|
@@ -37,6 +38,10 @@ module ActiveAdmin
|
|
|
37
38
|
ajax_data[:value_field] || :id
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def display_fields
|
|
42
|
+
ajax_data[:display_fields] || search_fields[0]
|
|
43
|
+
end
|
|
44
|
+
|
|
40
45
|
def search_fields
|
|
41
46
|
ajax_data[:search_fields] || raise(ArgumentError, 'search_fields in required')
|
|
42
47
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activeadmin-ajax_filter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Emelyanov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-09-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activeadmin
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.0
|
|
19
|
+
version: '1.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.0
|
|
26
|
+
version: '1.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rails
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '4'
|
|
33
|
+
version: '4.2'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '4'
|
|
40
|
+
version: '4.2'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: coffee-rails
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -314,7 +314,7 @@ files:
|
|
|
314
314
|
- Rakefile
|
|
315
315
|
- activeadmin-ajax_filter.gemspec
|
|
316
316
|
- app/assets/javascripts/activeadmin-ajax_filter.js.coffee
|
|
317
|
-
- app/assets/stylesheets/activeadmin-ajax_filter.
|
|
317
|
+
- app/assets/stylesheets/activeadmin-ajax_filter.scss
|
|
318
318
|
- bin/console
|
|
319
319
|
- bin/setup
|
|
320
320
|
- lib/active_admin/ajax_filter.rb
|
|
@@ -344,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
344
344
|
version: '0'
|
|
345
345
|
requirements: []
|
|
346
346
|
rubyforge_project:
|
|
347
|
-
rubygems_version: 2.6.
|
|
347
|
+
rubygems_version: 2.6.14
|
|
348
348
|
signing_key:
|
|
349
349
|
specification_version: 4
|
|
350
350
|
summary: AJAX filters for ActiveAdmin
|