activeadmin-tom_select 4.1.1 → 4.2.0.beta1

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +10 -7
  3. data/.gitignore +1 -0
  4. data/Appraisals +2 -2
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +137 -104
  8. data/README.md +1 -1
  9. data/docs/activeadmin-4-asset-setup.md +171 -0
  10. data/docs/activeadmin-tailwind-4.md +125 -0
  11. data/docs/guide-update-your-app.md +89 -356
  12. data/docs/setup-activeadmin-app.md +69 -492
  13. data/docs/setup-activeadmin-gem.md +83 -449
  14. data/gemfiles/rails_7.x_active_admin_4.x.gemfile +2 -1
  15. data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +158 -116
  16. data/gemfiles/rails_8.x_active_admin_4.x.gemfile +2 -1
  17. data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +148 -104
  18. data/lib/activeadmin/tom_select/option_collection.rb +4 -6
  19. data/lib/activeadmin/tom_select/select_input_extension.rb +42 -20
  20. data/lib/activeadmin/tom_select/version.rb +1 -1
  21. data/npm-package/package.json +1 -1
  22. data/sonar-project.properties +11 -11
  23. data/spec/features/ajax_false_input_spec.rb +74 -0
  24. data/spec/features/end_to_end_spec.rb +33 -20
  25. data/spec/features/input_errors_spec.rb +1 -3
  26. data/spec/features/options_dsl_spec.rb +6 -6
  27. data/spec/internal/Gemfile +1 -0
  28. data/spec/internal/Gemfile.lock +152 -107
  29. data/spec/internal/app/admin/option_values.rb +6 -6
  30. data/spec/internal/app/admin/posts.rb +4 -4
  31. data/spec/internal/app/admin/test_ajax_false.rb +18 -0
  32. data/spec/internal/app/admin/variants.rb +2 -2
  33. data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +8 -5
  34. data/spec/internal/app/models/option_value.rb +8 -0
  35. data/spec/internal/bin/tailwindcss +27 -0
  36. data/spec/internal/lib/tasks/active_admin.rake +9 -4
  37. data/spec/internal/package-lock.json +15 -1371
  38. data/spec/internal/package.json +1 -2
  39. data/{docs/tailwind-4/tailwind-active_admin.config.js → spec/internal/tailwind-active_admin.config.mjs} +9 -4
  40. data/spec/internal/yarn.lock +128 -728
  41. metadata +9 -23
  42. data/docs/activeadmin-4-detailed-reference.md +0 -932
  43. data/docs/activeadmin-4-gem-migration-guide.md +0 -313
  44. data/docs/combustion.md +0 -213
  45. data/docs/fail.png +0 -0
  46. data/docs/normal.png +0 -0
  47. data/docs/propshaft-readme.md +0 -320
  48. data/docs/propshaft-upgrade.md +0 -484
  49. data/docs/tailwind/blog-page.md +0 -341
  50. data/docs/tailwind/upgrade-guide-enhanced.md +0 -438
  51. data/docs/tailwind/upgrade-guide.md +0 -416
  52. data/docs/tailwind-4/active_admin.rake +0 -38
  53. data/docs/tailwind-4/active_admin.tailwind.css +0 -415
  54. data/docs/test-app-change.md +0 -154
  55. data/docs/test-environment-fixes.md +0 -58
  56. data/docs/update-tom-select.md +0 -348
@@ -1,36 +1,38 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activeadmin-tom_select (4.1.1)
4
+ activeadmin-tom_select (4.2.0.beta1)
5
5
  activeadmin (>= 3.0, < 5)
6
6
  ransack (>= 1.8, < 5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (8.0.3)
12
- actionpack (= 8.0.3)
13
- activesupport (= 8.0.3)
11
+ action_text-trix (2.1.15)
12
+ railties
13
+ actioncable (8.1.1)
14
+ actionpack (= 8.1.1)
15
+ activesupport (= 8.1.1)
14
16
  nio4r (~> 2.0)
15
17
  websocket-driver (>= 0.6.1)
16
18
  zeitwerk (~> 2.6)
17
- actionmailbox (8.0.3)
18
- actionpack (= 8.0.3)
19
- activejob (= 8.0.3)
20
- activerecord (= 8.0.3)
21
- activestorage (= 8.0.3)
22
- activesupport (= 8.0.3)
19
+ actionmailbox (8.1.1)
20
+ actionpack (= 8.1.1)
21
+ activejob (= 8.1.1)
22
+ activerecord (= 8.1.1)
23
+ activestorage (= 8.1.1)
24
+ activesupport (= 8.1.1)
23
25
  mail (>= 2.8.0)
24
- actionmailer (8.0.3)
25
- actionpack (= 8.0.3)
26
- actionview (= 8.0.3)
27
- activejob (= 8.0.3)
28
- activesupport (= 8.0.3)
26
+ actionmailer (8.1.1)
27
+ actionpack (= 8.1.1)
28
+ actionview (= 8.1.1)
29
+ activejob (= 8.1.1)
30
+ activesupport (= 8.1.1)
29
31
  mail (>= 2.8.0)
30
32
  rails-dom-testing (~> 2.2)
31
- actionpack (8.0.3)
32
- actionview (= 8.0.3)
33
- activesupport (= 8.0.3)
33
+ actionpack (8.1.1)
34
+ actionview (= 8.1.1)
35
+ activesupport (= 8.1.1)
34
36
  nokogiri (>= 1.8.5)
35
37
  rack (>= 2.2.4)
36
38
  rack-session (>= 1.0.1)
@@ -38,20 +40,21 @@ GEM
38
40
  rails-dom-testing (~> 2.2)
39
41
  rails-html-sanitizer (~> 1.6)
40
42
  useragent (~> 0.16)
41
- actiontext (8.0.3)
42
- actionpack (= 8.0.3)
43
- activerecord (= 8.0.3)
44
- activestorage (= 8.0.3)
45
- activesupport (= 8.0.3)
43
+ actiontext (8.1.1)
44
+ action_text-trix (~> 2.1.15)
45
+ actionpack (= 8.1.1)
46
+ activerecord (= 8.1.1)
47
+ activestorage (= 8.1.1)
48
+ activesupport (= 8.1.1)
46
49
  globalid (>= 0.6.0)
47
50
  nokogiri (>= 1.8.5)
48
- actionview (8.0.3)
49
- activesupport (= 8.0.3)
51
+ actionview (8.1.1)
52
+ activesupport (= 8.1.1)
50
53
  builder (~> 3.1)
51
54
  erubi (~> 1.11)
52
55
  rails-dom-testing (~> 2.2)
53
56
  rails-html-sanitizer (~> 1.6)
54
- activeadmin (4.0.0.beta16)
57
+ activeadmin (4.0.0.beta19)
55
58
  arbre (~> 2.0)
56
59
  csv
57
60
  formtastic (>= 5.0)
@@ -60,47 +63,46 @@ GEM
60
63
  kaminari (>= 1.2.1)
61
64
  railties (>= 7.0)
62
65
  ransack (>= 4.0)
63
- activejob (8.0.3)
64
- activesupport (= 8.0.3)
66
+ activejob (8.1.1)
67
+ activesupport (= 8.1.1)
65
68
  globalid (>= 0.3.6)
66
- activemodel (8.0.3)
67
- activesupport (= 8.0.3)
68
- activerecord (8.0.3)
69
- activemodel (= 8.0.3)
70
- activesupport (= 8.0.3)
69
+ activemodel (8.1.1)
70
+ activesupport (= 8.1.1)
71
+ activerecord (8.1.1)
72
+ activemodel (= 8.1.1)
73
+ activesupport (= 8.1.1)
71
74
  timeout (>= 0.4.0)
72
- activestorage (8.0.3)
73
- actionpack (= 8.0.3)
74
- activejob (= 8.0.3)
75
- activerecord (= 8.0.3)
76
- activesupport (= 8.0.3)
75
+ activestorage (8.1.1)
76
+ actionpack (= 8.1.1)
77
+ activejob (= 8.1.1)
78
+ activerecord (= 8.1.1)
79
+ activesupport (= 8.1.1)
77
80
  marcel (~> 1.0)
78
- activesupport (8.0.3)
81
+ activesupport (8.1.1)
79
82
  base64
80
- benchmark (>= 0.3)
81
83
  bigdecimal
82
84
  concurrent-ruby (~> 1.0, >= 1.3.1)
83
85
  connection_pool (>= 2.2.5)
84
86
  drb
85
87
  i18n (>= 1.6, < 2)
88
+ json
86
89
  logger (>= 1.4.2)
87
90
  minitest (>= 5.1)
88
91
  securerandom (>= 0.3)
89
92
  tzinfo (~> 2.0, >= 2.0.5)
90
93
  uri (>= 0.13.1)
91
- addressable (2.8.7)
92
- public_suffix (>= 2.0.2, < 7.0)
94
+ addressable (2.8.8)
95
+ public_suffix (>= 2.0.2, < 8.0)
93
96
  appraisal (2.5.0)
94
97
  bundler
95
98
  rake
96
99
  thor (>= 0.14.0)
97
- arbre (2.2.0)
100
+ arbre (2.2.1)
98
101
  activesupport (>= 7.0)
99
102
  ast (2.4.3)
100
103
  base64 (0.3.0)
101
104
  bcrypt (3.1.20)
102
- benchmark (0.4.1)
103
- bigdecimal (3.2.3)
105
+ bigdecimal (4.0.1)
104
106
  builder (3.3.0)
105
107
  capybara (3.40.0)
106
108
  addressable
@@ -119,15 +121,15 @@ GEM
119
121
  activesupport (>= 3.0.0)
120
122
  railties (>= 3.0.0)
121
123
  thor (>= 0.14.6)
122
- concurrent-ruby (1.3.5)
123
- connection_pool (2.5.4)
124
+ concurrent-ruby (1.3.6)
125
+ connection_pool (3.0.2)
124
126
  crass (1.0.6)
125
127
  csv (3.3.5)
126
128
  database_cleaner-active_record (2.2.2)
127
129
  activerecord (>= 5.a)
128
130
  database_cleaner-core (~> 2.0)
129
131
  database_cleaner-core (2.0.1)
130
- date (3.4.1)
132
+ date (3.5.1)
131
133
  devise (4.9.4)
132
134
  bcrypt (~> 3.0)
133
135
  orm_adapter (~> 0.1)
@@ -137,16 +139,16 @@ GEM
137
139
  diff-lcs (1.6.2)
138
140
  docile (1.4.1)
139
141
  drb (2.2.3)
140
- erb (5.0.2)
142
+ erb (6.0.1)
141
143
  erubi (1.13.1)
142
144
  formtastic (5.0.0)
143
145
  actionpack (>= 6.0.0)
144
146
  formtastic_i18n (0.7.0)
145
147
  globalid (1.3.0)
146
148
  activesupport (>= 6.1)
147
- has_scope (0.8.2)
148
- actionpack (>= 5.2)
149
- activesupport (>= 5.2)
149
+ has_scope (0.9.0)
150
+ actionpack (>= 7.0)
151
+ activesupport (>= 7.0)
150
152
  i18n (1.14.7)
151
153
  concurrent-ruby (~> 1.0)
152
154
  inherited_resources (2.1.0)
@@ -154,12 +156,12 @@ GEM
154
156
  has_scope (>= 0.6)
155
157
  railties (>= 7.0)
156
158
  responders (>= 2)
157
- io-console (0.8.1)
158
- irb (1.15.2)
159
+ io-console (0.8.2)
160
+ irb (1.16.0)
159
161
  pp (>= 0.6.0)
160
162
  rdoc (>= 4.0.0)
161
163
  reline (>= 0.4.2)
162
- json (2.15.0)
164
+ json (2.18.0)
163
165
  kaminari (1.2.2)
164
166
  activesupport (>= 4.1.0)
165
167
  kaminari-actionview (= 1.2.2)
@@ -175,10 +177,11 @@ GEM
175
177
  language_server-protocol (3.17.0.5)
176
178
  lint_roller (1.1.0)
177
179
  logger (1.7.0)
178
- loofah (2.24.1)
180
+ loofah (2.25.0)
179
181
  crass (~> 1.0.2)
180
182
  nokogiri (>= 1.12.0)
181
- mail (2.8.1)
183
+ mail (2.9.0)
184
+ logger
182
185
  mini_mime (>= 0.1.1)
183
186
  net-imap
184
187
  net-pop
@@ -190,8 +193,9 @@ GEM
190
193
  mime-types-data (~> 3.2025, >= 3.2025.0507)
191
194
  mime-types-data (3.2025.0924)
192
195
  mini_mime (1.1.5)
193
- minitest (5.25.5)
194
- net-imap (0.5.10)
196
+ minitest (6.0.0)
197
+ prism (~> 1.5)
198
+ net-imap (0.6.2)
195
199
  date
196
200
  net-protocol
197
201
  net-pop (0.1.2)
@@ -200,54 +204,68 @@ GEM
200
204
  timeout
201
205
  net-smtp (0.5.1)
202
206
  net-protocol
203
- nio4r (2.7.4)
207
+ nio4r (2.7.5)
208
+ nokogiri (1.18.10-aarch64-linux-gnu)
209
+ racc (~> 1.4)
210
+ nokogiri (1.18.10-aarch64-linux-musl)
211
+ racc (~> 1.4)
212
+ nokogiri (1.18.10-arm-linux-gnu)
213
+ racc (~> 1.4)
214
+ nokogiri (1.18.10-arm-linux-musl)
215
+ racc (~> 1.4)
216
+ nokogiri (1.18.10-arm64-darwin)
217
+ racc (~> 1.4)
218
+ nokogiri (1.18.10-x86_64-darwin)
219
+ racc (~> 1.4)
204
220
  nokogiri (1.18.10-x86_64-linux-gnu)
205
221
  racc (~> 1.4)
222
+ nokogiri (1.18.10-x86_64-linux-musl)
223
+ racc (~> 1.4)
206
224
  orm_adapter (0.5.0)
207
225
  parallel (1.27.0)
208
- parser (3.3.9.0)
226
+ parser (3.3.10.0)
209
227
  ast (~> 2.4.1)
210
228
  racc
211
- playwright-ruby-client (1.55.0)
229
+ playwright-ruby-client (1.57.0)
212
230
  concurrent-ruby (>= 1.1.6)
213
231
  mime-types (>= 3.0)
214
- pp (0.6.2)
232
+ pp (0.6.3)
215
233
  prettyprint
216
234
  prettyprint (0.2.0)
217
- prism (1.5.1)
235
+ prism (1.7.0)
218
236
  propshaft (1.3.1)
219
237
  actionpack (>= 7.0.0)
220
238
  activesupport (>= 7.0.0)
221
239
  rack
222
- psych (5.2.6)
240
+ psych (5.3.1)
223
241
  date
224
242
  stringio
225
- public_suffix (6.0.2)
243
+ public_suffix (7.0.0)
226
244
  puma (6.6.1)
227
245
  nio4r (~> 2.0)
228
246
  racc (1.8.1)
229
- rack (3.2.1)
247
+ rack (3.2.4)
230
248
  rack-session (2.1.1)
231
249
  base64 (>= 0.1.0)
232
250
  rack (>= 3.0.0)
233
251
  rack-test (2.2.0)
234
252
  rack (>= 1.3)
235
- rackup (2.2.1)
253
+ rackup (2.3.1)
236
254
  rack (>= 3)
237
- rails (8.0.3)
238
- actioncable (= 8.0.3)
239
- actionmailbox (= 8.0.3)
240
- actionmailer (= 8.0.3)
241
- actionpack (= 8.0.3)
242
- actiontext (= 8.0.3)
243
- actionview (= 8.0.3)
244
- activejob (= 8.0.3)
245
- activemodel (= 8.0.3)
246
- activerecord (= 8.0.3)
247
- activestorage (= 8.0.3)
248
- activesupport (= 8.0.3)
255
+ rails (8.1.1)
256
+ actioncable (= 8.1.1)
257
+ actionmailbox (= 8.1.1)
258
+ actionmailer (= 8.1.1)
259
+ actionpack (= 8.1.1)
260
+ actiontext (= 8.1.1)
261
+ actionview (= 8.1.1)
262
+ activejob (= 8.1.1)
263
+ activemodel (= 8.1.1)
264
+ activerecord (= 8.1.1)
265
+ activestorage (= 8.1.1)
266
+ activesupport (= 8.1.1)
249
267
  bundler (>= 1.15.0)
250
- railties (= 8.0.3)
268
+ railties (= 8.1.1)
251
269
  rails-dom-testing (2.3.0)
252
270
  activesupport (>= 5.0.0)
253
271
  minitest
@@ -255,9 +273,9 @@ GEM
255
273
  rails-html-sanitizer (1.6.2)
256
274
  loofah (~> 2.21)
257
275
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
258
- railties (8.0.3)
259
- actionpack (= 8.0.3)
260
- activesupport (= 8.0.3)
276
+ railties (8.1.1)
277
+ actionpack (= 8.1.1)
278
+ activesupport (= 8.1.1)
261
279
  irb (~> 1.13)
262
280
  rackup (>= 1.0.0)
263
281
  rake (>= 12.2)
@@ -265,26 +283,27 @@ GEM
265
283
  tsort (>= 0.2)
266
284
  zeitwerk (~> 2.6)
267
285
  rainbow (3.1.1)
268
- rake (13.3.0)
269
- ransack (4.4.0)
270
- activerecord (>= 7.1)
271
- activesupport (>= 7.1)
286
+ rake (13.3.1)
287
+ ransack (4.4.1)
288
+ activerecord (>= 7.2)
289
+ activesupport (>= 7.2)
272
290
  i18n
273
- rdoc (6.14.2)
291
+ rdoc (7.0.1)
274
292
  erb
275
293
  psych (>= 4.0.0)
294
+ tsort
276
295
  regexp_parser (2.11.3)
277
- reline (0.6.2)
296
+ reline (0.6.3)
278
297
  io-console (~> 0.5)
279
- responders (3.1.1)
280
- actionpack (>= 5.2)
281
- railties (>= 5.2)
282
- rspec-core (3.13.5)
298
+ responders (3.2.0)
299
+ actionpack (>= 7.0)
300
+ railties (>= 7.0)
301
+ rspec-core (3.13.6)
283
302
  rspec-support (~> 3.13.0)
284
303
  rspec-expectations (3.13.5)
285
304
  diff-lcs (>= 1.2.0, < 2.0)
286
305
  rspec-support (~> 3.13.0)
287
- rspec-mocks (3.13.5)
306
+ rspec-mocks (3.13.7)
288
307
  diff-lcs (>= 1.2.0, < 2.0)
289
308
  rspec-support (~> 3.13.0)
290
309
  rspec-rails (6.1.5)
@@ -323,17 +342,34 @@ GEM
323
342
  simplecov_json_formatter (~> 0.1)
324
343
  simplecov-html (0.13.2)
325
344
  simplecov_json_formatter (0.1.4)
326
- sqlite3 (2.7.4-x86_64-linux-gnu)
327
- stringio (3.1.7)
345
+ sqlite3 (2.8.1-aarch64-linux-gnu)
346
+ sqlite3 (2.8.1-aarch64-linux-musl)
347
+ sqlite3 (2.8.1-arm-linux-gnu)
348
+ sqlite3 (2.8.1-arm-linux-musl)
349
+ sqlite3 (2.8.1-arm64-darwin)
350
+ sqlite3 (2.8.1-x86_64-darwin)
351
+ sqlite3 (2.8.1-x86_64-linux-gnu)
352
+ sqlite3 (2.8.1-x86_64-linux-musl)
353
+ stringio (3.2.0)
354
+ tailwindcss-rails (4.4.0)
355
+ railties (>= 7.0.0)
356
+ tailwindcss-ruby (~> 4.0)
357
+ tailwindcss-ruby (4.1.18)
358
+ tailwindcss-ruby (4.1.18-aarch64-linux-gnu)
359
+ tailwindcss-ruby (4.1.18-aarch64-linux-musl)
360
+ tailwindcss-ruby (4.1.18-arm64-darwin)
361
+ tailwindcss-ruby (4.1.18-x86_64-darwin)
362
+ tailwindcss-ruby (4.1.18-x86_64-linux-gnu)
363
+ tailwindcss-ruby (4.1.18-x86_64-linux-musl)
328
364
  thor (1.4.0)
329
- timeout (0.4.3)
365
+ timeout (0.6.0)
330
366
  tsort (0.2.0)
331
367
  tzinfo (2.0.6)
332
368
  concurrent-ruby (~> 1.0)
333
369
  unicode-display_width (3.2.0)
334
370
  unicode-emoji (~> 4.1)
335
- unicode-emoji (4.1.0)
336
- uri (1.0.3)
371
+ unicode-emoji (4.2.0)
372
+ uri (1.1.1)
337
373
  useragent (0.16.11)
338
374
  warden (1.2.9)
339
375
  rack (>= 2.0.9)
@@ -343,13 +379,20 @@ GEM
343
379
  websocket-extensions (0.1.5)
344
380
  xpath (3.2.0)
345
381
  nokogiri (~> 1.8)
346
- zeitwerk (2.7.3)
382
+ zeitwerk (2.7.4)
347
383
 
348
384
  PLATFORMS
349
- x86_64-linux
385
+ aarch64-linux-gnu
386
+ aarch64-linux-musl
387
+ arm-linux-gnu
388
+ arm-linux-musl
389
+ arm64-darwin
390
+ x86_64-darwin
391
+ x86_64-linux-gnu
392
+ x86_64-linux-musl
350
393
 
351
394
  DEPENDENCIES
352
- activeadmin (= 4.0.0.beta16)
395
+ activeadmin (= 4.0.0.beta19)
353
396
  activeadmin-tom_select!
354
397
  appraisal (~> 2.2)
355
398
  bundler (>= 1.5, < 3)
@@ -369,6 +412,7 @@ DEPENDENCIES
369
412
  rubocop-rspec (~> 3.0)
370
413
  simplecov
371
414
  sqlite3 (~> 2.1)
415
+ tailwindcss-rails (~> 4.4.0)
372
416
 
373
417
  BUNDLED WITH
374
- 2.4.10
418
+ 2.6.7
@@ -88,9 +88,8 @@ module ActiveAdmin
88
88
  def extract_display_text_option(options)
89
89
  options.fetch(:display_text) do
90
90
  text_attribute = options.fetch(:text_attribute) do
91
- raise('Missing option: display_text or text_attribute. ' \
92
- 'Either pass a proc to determine the display text for a record ' \
93
- 'or set the text_attribute option.')
91
+ raise('Missing option: text_attribute. ' \
92
+ 'Pass the name of the attribute to use for display text.')
94
93
  end
95
94
 
96
95
  ->(record) { record.send(text_attribute) }
@@ -100,9 +99,8 @@ module ActiveAdmin
100
99
  def extract_filter_option(options)
101
100
  options.fetch(:filter) do
102
101
  text_attribute = options.fetch(:text_attribute) do
103
- raise('Missing option: filter or text_attribute. ' \
104
- 'Either pass a proc which filters the scope according to a given ' \
105
- 'or set the text_attribute option to apply a default Ransack filter.')
102
+ raise('Missing option: text_attribute. ' \
103
+ 'Pass the name of the attribute to use for filtering.')
106
104
  end
107
105
 
108
106
  ->(term, scope) { scope.ransack("#{text_attribute}_cont" => term).result }
@@ -26,15 +26,16 @@ module ActiveAdmin
26
26
  #
27
27
  # If the `ajax` option is present, the `collection` option is
28
28
  # ignored.
29
- module SelectInputExtension
29
+ module SelectInputExtension # rubocop:disable Metrics/ModuleLength
30
30
  # @api private
31
31
  def to_html
32
32
  super
33
33
  rescue RuntimeError => e
34
- # In development/test, display the error message
35
- raise e unless Rails.env.development? || Rails.env.test?
36
-
37
- template.content_tag(:div, e.message, class: 'searchable-select-error')
34
+ # Display helpful error message
35
+ error_html = e.message.gsub("\n", '<br>').html_safe
36
+ error_style = 'color: red; padding: 10px; background: #fee; ' \
37
+ 'border: 1px solid #fcc; border-radius: 4px; margin: 5px 0;'
38
+ template.content_tag(:div, error_html, class: 'searchable-select-error', style: error_style)
38
39
  end
39
40
 
40
41
  # @api private
@@ -46,18 +47,31 @@ module ActiveAdmin
46
47
  end
47
48
 
48
49
  # @api private
50
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
51
+ # rubocop:disable Metrics/PerceivedComplexity
49
52
  def collection_from_options
50
- return super unless options[:ajax]
51
-
52
- collection = if TomSelect.inline_ajax_options
53
- all_options_collection
54
- else
55
- selected_value_collection
56
- end
57
-
58
- # Remove any empty/blank options since we use clear button instead
59
- collection.reject { |item| item.first.to_s.strip.empty? && item.last.to_s.strip.empty? }
53
+ if ajax?
54
+ collection = if TomSelect.inline_ajax_options
55
+ all_options_collection
56
+ else
57
+ selected_value_collection
58
+ end
59
+
60
+ # Remove any empty/blank options since we use clear button instead
61
+ collection.reject { |item| item.first.to_s.strip.empty? && item.last.to_s.strip.empty? }
62
+ else
63
+ # When not using ajax, get the original collection
64
+ collection = super
65
+ # Add empty option at the beginning if not present to prevent auto-selection
66
+ if collection.present? && collection.none? { |item| item.last.to_s.strip.empty? }
67
+ [['', '']] + collection
68
+ else
69
+ collection
70
+ end
71
+ end
60
72
  end
73
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
74
+ # rubocop:enable Metrics/PerceivedComplexity
61
75
 
62
76
  private
63
77
 
@@ -72,7 +86,8 @@ module ActiveAdmin
72
86
  end
73
87
 
74
88
  def ajax?
75
- options[:ajax].present?
89
+ # Default to true unless explicitly set to false
90
+ options[:ajax] != false
76
91
  end
77
92
 
78
93
  def clearable?
@@ -81,7 +96,7 @@ module ActiveAdmin
81
96
  end
82
97
 
83
98
  def ajax_url
84
- return unless options[:ajax]
99
+ return unless ajax?
85
100
 
86
101
  [ajax_resource.route_collection_path(path_params),
87
102
  '/',
@@ -121,12 +136,19 @@ module ActiveAdmin
121
136
  option_collection.scope(template, path_params.merge(ajax_params))
122
137
  end
123
138
 
124
- def option_collection
139
+ def option_collection # rubocop:disable Metrics/MethodLength
125
140
  ajax_resource
126
141
  .searchable_select_option_collections
127
142
  .fetch(ajax_option_collection_name) do
128
- raise("No option collection named '#{ajax_option_collection_name}' " \
129
- "defined in '#{ajax_resource_class.name}' admin.")
143
+ model_name = ajax_resource_class.name
144
+ raise('The required ajax endpoint is missing. ' \
145
+ "Add `searchable_select_options` to the '#{model_name}' admin resource:\n\n " \
146
+ "ActiveAdmin.register #{model_name} do\n " \
147
+ "searchable_select_options(scope: #{model_name},\n " \
148
+ "text_attribute: :name) # or :title, :email, etc.\n " \
149
+ "end\n\n" \
150
+ "Or disable ajax mode for this input:\n " \
151
+ "f.input :#{method}, as: :searchable_select, ajax: false")
130
152
  end
131
153
  end
132
154
 
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module TomSelect
3
- VERSION = '4.1.1'.freeze
3
+ VERSION = '4.2.0.beta1'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activeadmin-tom_select",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "Use Tom Select for searchable selects in Active Admin forms and filters.",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -2,25 +2,25 @@
2
2
  sonar.projectKey=rs-pro_activeadmin-tom_select
3
3
  sonar.organization=rs-pro
4
4
  sonar.projectName=activeadmin-tom_select
5
- sonar.projectVersion=4.1.0
5
+ sonar.projectVersion=4.1.2
6
+ sonar.qualitygate.wait=true
6
7
 
7
8
  # Source code directories
8
- sonar.sources=lib,app
9
+ sonar.sources=lib,npm-package
9
10
  sonar.tests=spec
10
11
 
11
- # Language
12
- sonar.language=ruby
13
-
14
12
  # Encoding
15
13
  sonar.sourceEncoding=UTF-8
16
14
 
17
- # Ruby specific settings
15
+ # File suffixes for different languages
18
16
  sonar.ruby.file.suffixes=.rb,.rake
17
+ sonar.javascript.file.suffixes=.js,.jsx
18
+ sonar.css.file.suffixes=.css,.scss
19
+
20
+ # Test coverage and results reporting
19
21
  sonar.ruby.coverage.reportPaths=coverage/coverage.json
22
+ sonar.ruby.rspec.reportPaths=rspec-results.xml
20
23
 
21
- # Exclusions
22
- sonar.exclusions=spec/**/*,vendor/**/*,coverage/**/*,tmp/**/*,*.gemspec,gemfiles/**/*,Appraisals
23
- sonar.test.exclusions=spec/internal/app/assets/builds/**/*,spec/internal/public/**/*,spec/internal/node_modules/**/*
24
24
 
25
- # Coverage exclusions (files that don't need coverage)
26
- sonar.coverage.exclusions=spec/**/*,vendor/**/*,spec/internal/**/*,**/*_spec.rb
25
+ # Exclusions
26
+ sonar.exclusions=**/*_test.rb,**/test/**,**/spec/**,**/vendor/**,**/node_modules/**,**/coverage/**,**/tmp/**,**/log/**,**/public/**,*.gemspec,gemfiles/**/*,Appraisals,spec/internal/app/assets/builds/**/*,**/app/assets/builds/**/*,npm-package/node_modules/**/*