activeadmin-ajax_filter 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 649a83cd01840f2914f720087797e4cee17042c5
4
- data.tar.gz: 1c186f6f3b64f93838606454c99da39de762a59c
2
+ SHA256:
3
+ metadata.gz: f5090653a55e873f40c9e9a351ec63226ca3cca2ad3b7343cd13027912ba6044
4
+ data.tar.gz: cb56d8df971f4d0fc4911224aebff16a42f982a9a45c0c95900f7a77a5dd4018
5
5
  SHA512:
6
- metadata.gz: 44aad72f10d8f83ad1924e754b5eaf586d4c166e9a91e0390f7a785cbb73d6b7f1e40e542c7ab7f2f8979448d40f2b89453442d2f634914f6b7c680e95da4203
7
- data.tar.gz: 33a7994ad34afbef8956bcaeb43d720ed182870fde27ab07b45a9d23b7340cf4b2eff6fdef5b2a659d37c548ede7f48cc15f57b0e2a32f8f0735217ba1e45cbf
6
+ metadata.gz: d95550d632e66dca2b3a29c3771bf946ba6d8ed20756ce6f481124053a9dbd4c48fb5cd9435f4996c9d6d0f9c20d220786c120545893e4568da6c8974cfb7f70
7
+ data.tar.gz: 11ec58fdfc1fe503a23099693263a0592bbe4b93146253e77c263ce3b1d98d2060d5d7c365760870882b30743ae36512cfb6b5773e1337ab6f7e0e1c5040cb6f
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.1
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.3
6
6
  - 2.4
7
7
  - 2.5
8
+ - 2.6
8
9
  - ruby-head
9
10
 
10
11
  matrix:
data/Gemfile.lock CHANGED
@@ -1,31 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activeadmin-ajax_filter (0.4.1)
4
+ activeadmin-ajax_filter (0.4.2)
5
5
  activeadmin (>= 1.0)
6
6
  coffee-rails (>= 4.1.0)
7
7
  has_scope (>= 0.6.0)
8
- rails (>= 4.2)
9
- selectize-rails (>= 0.11.2)
8
+ rails (>= 4.2.11)
9
+ selectize-rails (>= 0.12.6)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actionmailer (4.2.10)
15
- actionpack (= 4.2.10)
16
- actionview (= 4.2.10)
17
- activejob (= 4.2.10)
14
+ actionmailer (4.2.11)
15
+ actionpack (= 4.2.11)
16
+ actionview (= 4.2.11)
17
+ activejob (= 4.2.11)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 1.0, >= 1.0.5)
20
- actionpack (4.2.10)
21
- actionview (= 4.2.10)
22
- activesupport (= 4.2.10)
20
+ actionpack (4.2.11)
21
+ actionview (= 4.2.11)
22
+ activesupport (= 4.2.11)
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.10)
28
- activesupport (= 4.2.10)
27
+ actionview (4.2.11)
28
+ activesupport (= 4.2.11)
29
29
  builder (~> 3.1)
30
30
  erubis (~> 2.7.0)
31
31
  rails-dom-testing (~> 1.0, >= 1.0.5)
@@ -42,17 +42,17 @@ GEM
42
42
  ransack (>= 1.8.7)
43
43
  sass (~> 3.1)
44
44
  sprockets (< 4.1)
45
- activejob (4.2.10)
46
- activesupport (= 4.2.10)
45
+ activejob (4.2.11)
46
+ activesupport (= 4.2.11)
47
47
  globalid (>= 0.3.0)
48
- activemodel (4.2.10)
49
- activesupport (= 4.2.10)
48
+ activemodel (4.2.11)
49
+ activesupport (= 4.2.11)
50
50
  builder (~> 3.1)
51
- activerecord (4.2.10)
52
- activemodel (= 4.2.10)
53
- activesupport (= 4.2.10)
51
+ activerecord (4.2.11)
52
+ activemodel (= 4.2.11)
53
+ activesupport (= 4.2.11)
54
54
  arel (~> 6.0)
55
- activesupport (4.2.10)
55
+ activesupport (4.2.11)
56
56
  i18n (~> 0.7)
57
57
  minitest (~> 5.1)
58
58
  thread_safe (~> 0.3, >= 0.3.4)
@@ -79,7 +79,7 @@ GEM
79
79
  coffee-script-source
80
80
  execjs
81
81
  coffee-script-source (1.12.2)
82
- concurrent-ruby (1.0.5)
82
+ concurrent-ruby (1.1.4)
83
83
  crass (1.0.4)
84
84
  database_cleaner (1.5.3)
85
85
  diff-lcs (1.2.5)
@@ -96,11 +96,11 @@ GEM
96
96
  factory_girl_rails (4.5.0)
97
97
  factory_girl (~> 4.5.0)
98
98
  railties (>= 3.0.0)
99
- ffi (1.9.25)
99
+ ffi (1.10.0)
100
100
  formtastic (3.1.5)
101
101
  actionpack (>= 3.2.13)
102
102
  formtastic_i18n (0.6.0)
103
- globalid (0.4.1)
103
+ globalid (0.4.2)
104
104
  activesupport (>= 4.2.0)
105
105
  has_scope (0.7.2)
106
106
  actionpack (>= 4.1)
@@ -140,10 +140,10 @@ GEM
140
140
  mime-types-data (~> 3.2015)
141
141
  mime-types-data (3.2018.0812)
142
142
  mini_mime (1.0.1)
143
- mini_portile2 (2.3.0)
143
+ mini_portile2 (2.4.0)
144
144
  minitest (5.11.3)
145
- nokogiri (1.8.5)
146
- mini_portile2 (~> 2.3.0)
145
+ nokogiri (1.10.1)
146
+ mini_portile2 (~> 2.4.0)
147
147
  phantomjs (2.1.1.0)
148
148
  poltergeist (1.10.0)
149
149
  capybara (~> 2.1)
@@ -152,16 +152,16 @@ GEM
152
152
  rack (1.6.11)
153
153
  rack-test (0.6.3)
154
154
  rack (>= 1.0)
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)
155
+ rails (4.2.11)
156
+ actionmailer (= 4.2.11)
157
+ actionpack (= 4.2.11)
158
+ actionview (= 4.2.11)
159
+ activejob (= 4.2.11)
160
+ activemodel (= 4.2.11)
161
+ activerecord (= 4.2.11)
162
+ activesupport (= 4.2.11)
163
163
  bundler (>= 1.3.0, < 2.0)
164
- railties (= 4.2.10)
164
+ railties (= 4.2.11)
165
165
  sprockets-rails
166
166
  rails-deprecated_sanitizer (1.0.3)
167
167
  activesupport (>= 4.2.0.alpha)
@@ -171,25 +171,25 @@ GEM
171
171
  rails-deprecated_sanitizer (>= 1.0.1)
172
172
  rails-html-sanitizer (1.0.4)
173
173
  loofah (~> 2.2, >= 2.2.2)
174
- railties (4.2.10)
175
- actionpack (= 4.2.10)
176
- activesupport (= 4.2.10)
174
+ railties (4.2.11)
175
+ actionpack (= 4.2.11)
176
+ activesupport (= 4.2.11)
177
177
  rake (>= 0.8.7)
178
178
  thor (>= 0.18.1, < 2.0)
179
179
  rake (10.5.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)
180
+ ransack (1.8.10)
181
+ actionpack (>= 3.0, < 5.2)
182
+ activerecord (>= 3.0, < 5.2)
183
+ activesupport (>= 3.0, < 5.2)
184
184
  i18n
185
185
  rb-fsevent (0.10.3)
186
- rb-inotify (0.9.10)
187
- ffi (>= 0.5.0, < 2)
186
+ rb-inotify (0.10.0)
187
+ ffi (~> 1.0)
188
188
  request_store (1.4.1)
189
189
  rack (>= 1.4)
190
- responders (2.4.0)
191
- actionpack (>= 4.2.0, < 5.3)
192
- railties (>= 4.2.0, < 5.3)
190
+ responders (2.4.1)
191
+ actionpack (>= 4.2.0, < 6.0)
192
+ railties (>= 4.2.0, < 6.0)
193
193
  rspec (3.3.0)
194
194
  rspec-core (~> 3.3.0)
195
195
  rspec-expectations (~> 3.3.0)
@@ -211,12 +211,12 @@ GEM
211
211
  rspec-mocks (~> 3.3.0)
212
212
  rspec-support (~> 3.3.0)
213
213
  rspec-support (3.3.0)
214
- sass (3.7.2)
214
+ sass (3.7.3)
215
215
  sass-listen (~> 4.0.0)
216
216
  sass-listen (4.0.0)
217
217
  rb-fsevent (~> 0.9, >= 0.9.4)
218
218
  rb-inotify (~> 0.9, >= 0.9.7)
219
- selectize-rails (0.12.4)
219
+ selectize-rails (0.12.6)
220
220
  simplecov (0.11.1)
221
221
  docile (~> 1.1.0)
222
222
  json (~> 1.8)
@@ -233,7 +233,7 @@ GEM
233
233
  temping (3.3.0)
234
234
  activerecord (>= 3.1)
235
235
  activesupport (>= 3.1)
236
- thor (0.20.0)
236
+ thor (0.20.3)
237
237
  thread_safe (0.3.6)
238
238
  tzinfo (1.2.5)
239
239
  thread_safe (~> 0.1)
@@ -265,4 +265,4 @@ DEPENDENCIES
265
265
  temping (~> 3.3, >= 3.3.0)
266
266
 
267
267
  BUNDLED WITH
268
- 1.16.2
268
+ 1.17.2
data/README.md CHANGED
@@ -100,6 +100,7 @@ You can use next parameters in `data` hash:
100
100
  * `url` - url for AJAX query by default is builded from field name. For inputs you can use url helpers, but on filters level url helpers isn't available, so if you need them you can pass symbols and it will be evaluated as url path (e.g. `:filter_admin_users_path`). `String` with relative path (like `/admin/users/filter`) can be used for both inputs and filters.
101
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.
102
102
  * `static_ransack` - hash of ransack predicates which will be applied statically and independently from current input field value
103
+ * `min_chars_count_to_request` - minimal count of chars in the input field to make an AJAX request
103
104
 
104
105
  ## Caveats
105
106
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |gem|
20
20
  gem.require_paths = ['lib']
21
21
 
22
22
  gem.add_dependency 'activeadmin', '>= 1.0'
23
- gem.add_dependency 'rails', '>= 4.2'
23
+ gem.add_dependency 'rails', '>= 4.2.11'
24
24
  gem.add_dependency 'coffee-rails', '>= 4.1.0'
25
- gem.add_dependency 'selectize-rails', '>= 0.11.2'
25
+ gem.add_dependency 'selectize-rails', '>= 0.12.6'
26
26
  gem.add_dependency 'has_scope', '>= 0.6.0' # Force Ruby 2.1.5 support
27
27
  gem.add_development_dependency 'bundler', '~> 1.10'
28
28
  gem.add_development_dependency 'rake', '~> 10.0'
@@ -10,6 +10,7 @@ $ ->
10
10
  display_fields = select.data('display-fields').split(' ')
11
11
  searchFields = select.data('search-fields').split(' ')
12
12
  staticRansack = select.data('static-ransack')
13
+ minCharsCountToRequest = select.data('min-chars-count-to-request') || 1
13
14
 
14
15
  ajaxFields = select.data('ajax-search-fields')
15
16
  if ajaxFields
@@ -67,7 +68,7 @@ $ ->
67
68
  "<div class='item'>#{html.join('')}</div>"
68
69
 
69
70
  load: (query, callback) ->
70
- if query.length
71
+ if query.length && query.length >= minCharsCountToRequest
71
72
  q = {}
72
73
  q[select.data('ransack')] = query
73
74
 
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module AjaxFilter
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ module ActiveAdmin
19
19
  'data-static-ransack' => static_ransack,
20
20
  'data-selected-value' => selected_value,
21
21
  'data-url' => url,
22
+ 'data-min-chars-count-to-request' => min_chars_count_to_request,
22
23
  )
23
24
  end
24
25
 
@@ -62,6 +63,10 @@ module ActiveAdmin
62
63
  ajax_data.fetch(:static_ransack, {}).to_json
63
64
  end
64
65
 
66
+ def min_chars_count_to_request
67
+ ajax_data[:min_chars_count_to_request] || 1
68
+ end
69
+
65
70
  def url
66
71
  case (url = ajax_data[:url])
67
72
  when nil then "#{method.to_s.pluralize}/filter"
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Emelyanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.2'
33
+ version: 4.2.11
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.2'
40
+ version: 4.2.11
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.11.2
61
+ version: 0.12.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.11.2
68
+ version: 0.12.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: has_scope
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -112,22 +112,22 @@ dependencies:
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.3'
118
115
  - - ">="
119
116
  - !ruby/object:Gem::Version
120
117
  version: 3.3.0
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '3.3'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: '3.3'
128
125
  - - ">="
129
126
  - !ruby/object:Gem::Version
130
127
  version: 3.3.0
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '3.3'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rspec-rails
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -180,22 +180,22 @@ dependencies:
180
180
  name: temping
181
181
  requirement: !ruby/object:Gem::Requirement
182
182
  requirements:
183
- - - "~>"
184
- - !ruby/object:Gem::Version
185
- version: '3.3'
186
183
  - - ">="
187
184
  - !ruby/object:Gem::Version
188
185
  version: 3.3.0
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '3.3'
189
189
  type: :development
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - "~>"
194
- - !ruby/object:Gem::Version
195
- version: '3.3'
196
193
  - - ">="
197
194
  - !ruby/object:Gem::Version
198
195
  version: 3.3.0
196
+ - - "~>"
197
+ - !ruby/object:Gem::Version
198
+ version: '3.3'
199
199
  - !ruby/object:Gem::Dependency
200
200
  name: codeclimate-test-reporter
201
201
  requirement: !ruby/object:Gem::Requirement
@@ -305,6 +305,7 @@ extra_rdoc_files: []
305
305
  files:
306
306
  - ".gitignore"
307
307
  - ".rspec"
308
+ - ".ruby-version"
308
309
  - ".travis.yml"
309
310
  - CODE_OF_CONDUCT.md
310
311
  - Gemfile
@@ -343,8 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
344
  - !ruby/object:Gem::Version
344
345
  version: '0'
345
346
  requirements: []
346
- rubyforge_project:
347
- rubygems_version: 2.6.13
347
+ rubygems_version: 3.0.1
348
348
  signing_key:
349
349
  specification_version: 4
350
350
  summary: AJAX filters for ActiveAdmin