activeadmin-tom_select 4.1.0 → 4.1.1
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/.claude/commands/fix-tests.md +1 -1
- data/.github/workflows/ci.yml +3 -4
- data/.github/workflows/npm-publish.yml +3 -3
- data/.rubocop.yml +1 -1
- data/AGENTS.md +2 -2
- data/CHANGELOG.md +19 -1
- data/Gemfile.lock +85 -79
- data/README.md +20 -18
- data/activeadmin-tom_select.gemspec +3 -3
- data/docs/guide-update-your-app.md +198 -25
- data/docs/update-tom-select.md +322 -158
- data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +11 -11
- data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +66 -64
- data/lib/activeadmin/inputs/filters/searchable_select_input.rb +5 -12
- data/lib/activeadmin/inputs/filters/tom_select_input.rb +19 -0
- data/lib/activeadmin/inputs/searchable_select_input.rb +5 -11
- data/lib/activeadmin/inputs/tom_select_input.rb +16 -0
- data/lib/activeadmin/tom_select/engine.rb +3 -1
- data/lib/activeadmin/tom_select/option_collection.rb +1 -1
- data/lib/activeadmin/tom_select/resource_dsl_extension.rb +1 -1
- data/lib/activeadmin/tom_select/resource_extension.rb +1 -1
- data/lib/activeadmin/tom_select/select_input_extension.rb +14 -5
- data/lib/activeadmin/tom_select/version.rb +2 -2
- data/lib/activeadmin/tom_select.rb +3 -3
- data/lib/generators/active_admin/tom_select/install/install_generator.rb +5 -5
- data/npm-package/package-lock.json +2 -2
- data/npm-package/package.json +2 -2
- data/npm-package/src/index.js +1 -3
- data/npm-package/src/tom-select-tailwind.css +26 -20
- data/sonar-project.properties +5 -4
- data/spec/features/form_input_spec.rb +2 -2
- data/spec/features/inline_ajax_setting_spec.rb +1 -1
- data/spec/internal/Gemfile.lock +1 -1
- data/spec/internal/app/admin/articles.rb +28 -0
- data/spec/internal/app/assets/config/manifest.js +2 -1
- data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +1 -1
- data/spec/internal/app/assets/stylesheets/application.tailwind.css +0 -15
- data/spec/internal/app/javascript/active_admin.js +2 -4
- data/spec/internal/db/schema.rb +3 -1
- data/spec/internal/db/seeds.rb +4 -7
- data/spec/internal/package-lock.json +3 -3
- data/spec/internal/package.json +1 -1
- data/spec/internal/yarn.lock +1 -1
- data/spec/support/reset_settings.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ea14e48089cb7a4506440c4c816470e0be96c2f6f3449ad50868ffafba71b42
|
4
|
+
data.tar.gz: 74b504f7c25f5a9f19e6e01b3df391aaae79a09d9cffab90aace63103aa0a361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb1947ae6bc6b5381c340ed3cb96848cbd95a35138b3a3e7af2d140d1cf9cc0dcdc1fceef7a2ceabc7926a285b5081ff52c80b531bf081e09587c01494f34e0
|
7
|
+
data.tar.gz: 3c12495c95b537603cc91b2f0cf6e2d10cc6db6d700ee3ab75565b6f9e4d3eb57531e03beef0cc9625e4e729f582515fbcd5296cafe58fe4a89b74c1be0c1342
|
@@ -142,7 +142,7 @@ The gem's JavaScript is in `app/assets/javascripts/active_admin/searchable_selec
|
|
142
142
|
### 4. Inline AJAX Options Mode
|
143
143
|
For testing without real AJAX calls, enable inline mode:
|
144
144
|
```ruby
|
145
|
-
ActiveAdmin::
|
145
|
+
ActiveAdmin::TomSelect.inline_ajax_options = true
|
146
146
|
```
|
147
147
|
This renders all options statically in the HTML.
|
148
148
|
|
data/.github/workflows/ci.yml
CHANGED
@@ -81,7 +81,7 @@ jobs:
|
|
81
81
|
cd ../spec/internal
|
82
82
|
# Remove any existing symlink/folder
|
83
83
|
rm -rf package
|
84
|
-
rm -rf node_modules
|
84
|
+
rm -rf node_modules/activeadmin-tom_select
|
85
85
|
npm install
|
86
86
|
|
87
87
|
# Install from the extracted package
|
@@ -106,13 +106,12 @@ jobs:
|
|
106
106
|
|
107
107
|
- name: Setup test database
|
108
108
|
run: |
|
109
|
-
|
110
|
-
|
109
|
+
cd spec/internal
|
110
|
+
./bin/rails db:create db:schema:load RAILS_ENV=test
|
111
111
|
|
112
112
|
- name: Run tests with coverage
|
113
113
|
run: |
|
114
114
|
bundle exec rspec --format progress --format RspecJunitFormatter --out rspec-results.xml
|
115
|
-
continue-on-error: true
|
116
115
|
|
117
116
|
- name: Upload coverage to Codecov
|
118
117
|
if: matrix.ruby == '3.4' && matrix.gemfile == 'rails_7.x_active_admin_4.x'
|
@@ -40,11 +40,11 @@ jobs:
|
|
40
40
|
run: |
|
41
41
|
echo "### NPM Package Published! 🎉" >> $GITHUB_STEP_SUMMARY
|
42
42
|
echo "" >> $GITHUB_STEP_SUMMARY
|
43
|
-
echo "Package:
|
43
|
+
echo "Package: \`activeadmin-tom_select@$(cd npm-package && npm pkg get version | tr -d '"')\`" >> $GITHUB_STEP_SUMMARY
|
44
44
|
echo "" >> $GITHUB_STEP_SUMMARY
|
45
45
|
echo "Install with:" >> $GITHUB_STEP_SUMMARY
|
46
46
|
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
|
47
|
-
echo "npm install
|
47
|
+
echo "npm install activeadmin-tom_select" >> $GITHUB_STEP_SUMMARY
|
48
48
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
49
49
|
echo "" >> $GITHUB_STEP_SUMMARY
|
50
|
-
echo "View on NPM: https://www.npmjs.com/package
|
50
|
+
echo "View on NPM: https://www.npmjs.com/package/activeadmin-tom_select" >> $GITHUB_STEP_SUMMARY
|
data/.rubocop.yml
CHANGED
data/AGENTS.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Repository Guidelines
|
2
2
|
|
3
3
|
## Project Structure & Module Organization
|
4
|
-
- `lib/`: Ruby engine, extensions, and DSL under `ActiveAdmin::
|
4
|
+
- `lib/`: Ruby engine, extensions, and DSL under `ActiveAdmin::TomSelect`.
|
5
5
|
- `app/assets/`: Legacy Sprockets JS/CSS entry points for ActiveAdmin.
|
6
6
|
- `src/`: ESM sources for the npm package (`searchable_select.js/.scss`).
|
7
7
|
- `vendor/assets/javascripts/`: Importmap-friendly JS build.
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
## Coding Style & Naming Conventions
|
21
21
|
- Ruby: 2-space indent, TargetRuby 3.0, max line length 100; follow RuboCop rules.
|
22
|
-
- Names: Ruby files in `lib/activeadmin/
|
22
|
+
- Names: Ruby files in `lib/activeadmin/tom_select/` use snake_case; modules under `ActiveAdmin::TomSelect`.
|
23
23
|
- JS: ESM modules in `src/`; keep imports explicit. Avoid global jQuery except for ActiveAdmin integration.
|
24
24
|
|
25
25
|
## Testing Guidelines
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
### Version
|
3
|
+
### Version 4.1.1
|
4
|
+
|
5
|
+
#### ✨ Improvements
|
6
|
+
- **New Input Type**: Added `TomSelectInput` as the primary input class, with `SearchableSelectInput` now as a legacy alias for backward compatibility
|
7
|
+
- **Module Renaming**: Renamed internal module from `ActiveAdmin::SearchableSelect` to `ActiveAdmin::TomSelect` for consistency
|
8
|
+
- **NPM Package Name**: Changed npm package name from `@rocket-sensei/activeadmin-tom_select` to `activeadmin-tom_select` (without organization prefix)
|
9
|
+
- **Style Fixes**:
|
10
|
+
- Fixed dark mode background colors to match ActiveAdmin inputs (#374151)
|
11
|
+
- Fixed dark mode text color visibility
|
12
|
+
- Fixed border radius to match ActiveAdmin design (rounded-md)
|
13
|
+
- Fixed full width styling for select inputs
|
14
|
+
- **Documentation**: Updated README to show `as: :tom_select` usage (with backward compatibility note)
|
15
|
+
|
16
|
+
#### 🔄 Migration
|
17
|
+
- New code should use `f.input :field, as: :tom_select`
|
18
|
+
- Legacy `as: :searchable_select` continues to work for backward compatibility
|
19
|
+
- NPM install command: `npm install activeadmin-tom_select` (no organization prefix)
|
20
|
+
|
21
|
+
### Version 4.1.0
|
4
22
|
|
5
23
|
[Compare changes](https://github.com/glebtv/activeadmin-searchable_select/compare/1-8-stable...master)
|
6
24
|
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activeadmin-tom_select (4.1.
|
4
|
+
activeadmin-tom_select (4.1.1)
|
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.
|
12
|
-
actionpack (= 8.0.
|
13
|
-
activesupport (= 8.0.
|
11
|
+
actioncable (8.0.3)
|
12
|
+
actionpack (= 8.0.3)
|
13
|
+
activesupport (= 8.0.3)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
16
|
zeitwerk (~> 2.6)
|
17
|
-
actionmailbox (8.0.
|
18
|
-
actionpack (= 8.0.
|
19
|
-
activejob (= 8.0.
|
20
|
-
activerecord (= 8.0.
|
21
|
-
activestorage (= 8.0.
|
22
|
-
activesupport (= 8.0.
|
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)
|
23
23
|
mail (>= 2.8.0)
|
24
|
-
actionmailer (8.0.
|
25
|
-
actionpack (= 8.0.
|
26
|
-
actionview (= 8.0.
|
27
|
-
activejob (= 8.0.
|
28
|
-
activesupport (= 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)
|
29
29
|
mail (>= 2.8.0)
|
30
30
|
rails-dom-testing (~> 2.2)
|
31
|
-
actionpack (8.0.
|
32
|
-
actionview (= 8.0.
|
33
|
-
activesupport (= 8.0.
|
31
|
+
actionpack (8.0.3)
|
32
|
+
actionview (= 8.0.3)
|
33
|
+
activesupport (= 8.0.3)
|
34
34
|
nokogiri (>= 1.8.5)
|
35
35
|
rack (>= 2.2.4)
|
36
36
|
rack-session (>= 1.0.1)
|
@@ -38,15 +38,15 @@ GEM
|
|
38
38
|
rails-dom-testing (~> 2.2)
|
39
39
|
rails-html-sanitizer (~> 1.6)
|
40
40
|
useragent (~> 0.16)
|
41
|
-
actiontext (8.0.
|
42
|
-
actionpack (= 8.0.
|
43
|
-
activerecord (= 8.0.
|
44
|
-
activestorage (= 8.0.
|
45
|
-
activesupport (= 8.0.
|
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)
|
46
46
|
globalid (>= 0.6.0)
|
47
47
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (8.0.
|
49
|
-
activesupport (= 8.0.
|
48
|
+
actionview (8.0.3)
|
49
|
+
activesupport (= 8.0.3)
|
50
50
|
builder (~> 3.1)
|
51
51
|
erubi (~> 1.11)
|
52
52
|
rails-dom-testing (~> 2.2)
|
@@ -60,22 +60,22 @@ GEM
|
|
60
60
|
kaminari (>= 1.2.1)
|
61
61
|
railties (>= 7.0)
|
62
62
|
ransack (>= 4.0)
|
63
|
-
activejob (8.0.
|
64
|
-
activesupport (= 8.0.
|
63
|
+
activejob (8.0.3)
|
64
|
+
activesupport (= 8.0.3)
|
65
65
|
globalid (>= 0.3.6)
|
66
|
-
activemodel (8.0.
|
67
|
-
activesupport (= 8.0.
|
68
|
-
activerecord (8.0.
|
69
|
-
activemodel (= 8.0.
|
70
|
-
activesupport (= 8.0.
|
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)
|
71
71
|
timeout (>= 0.4.0)
|
72
|
-
activestorage (8.0.
|
73
|
-
actionpack (= 8.0.
|
74
|
-
activejob (= 8.0.
|
75
|
-
activerecord (= 8.0.
|
76
|
-
activesupport (= 8.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)
|
77
77
|
marcel (~> 1.0)
|
78
|
-
activesupport (8.0.
|
78
|
+
activesupport (8.0.3)
|
79
79
|
base64
|
80
80
|
benchmark (>= 0.3)
|
81
81
|
bigdecimal
|
@@ -142,7 +142,7 @@ GEM
|
|
142
142
|
formtastic (5.0.0)
|
143
143
|
actionpack (>= 6.0.0)
|
144
144
|
formtastic_i18n (0.7.0)
|
145
|
-
globalid (1.
|
145
|
+
globalid (1.3.0)
|
146
146
|
activesupport (>= 6.1)
|
147
147
|
has_scope (0.8.2)
|
148
148
|
actionpack (>= 5.2)
|
@@ -159,7 +159,7 @@ GEM
|
|
159
159
|
pp (>= 0.6.0)
|
160
160
|
rdoc (>= 4.0.0)
|
161
161
|
reline (>= 0.4.2)
|
162
|
-
json (2.
|
162
|
+
json (2.15.0)
|
163
163
|
kaminari (1.2.2)
|
164
164
|
activesupport (>= 4.1.0)
|
165
165
|
kaminari-actionview (= 1.2.2)
|
@@ -172,6 +172,8 @@ GEM
|
|
172
172
|
activerecord
|
173
173
|
kaminari-core (= 1.2.2)
|
174
174
|
kaminari-core (1.2.2)
|
175
|
+
language_server-protocol (3.17.0.5)
|
176
|
+
lint_roller (1.1.0)
|
175
177
|
logger (1.7.0)
|
176
178
|
loofah (2.24.1)
|
177
179
|
crass (~> 1.0.2)
|
@@ -181,12 +183,12 @@ GEM
|
|
181
183
|
net-imap
|
182
184
|
net-pop
|
183
185
|
net-smtp
|
184
|
-
marcel (1.0
|
186
|
+
marcel (1.1.0)
|
185
187
|
matrix (0.4.3)
|
186
188
|
mime-types (3.7.0)
|
187
189
|
logger
|
188
190
|
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
189
|
-
mime-types-data (3.2025.
|
191
|
+
mime-types-data (3.2025.0924)
|
190
192
|
mini_mime (1.1.5)
|
191
193
|
minitest (5.25.5)
|
192
194
|
net-imap (0.5.10)
|
@@ -199,7 +201,7 @@ GEM
|
|
199
201
|
net-smtp (0.5.1)
|
200
202
|
net-protocol
|
201
203
|
nio4r (2.7.4)
|
202
|
-
nokogiri (1.18.
|
204
|
+
nokogiri (1.18.10-x86_64-linux-gnu)
|
203
205
|
racc (~> 1.4)
|
204
206
|
orm_adapter (0.5.0)
|
205
207
|
parallel (1.27.0)
|
@@ -212,8 +214,8 @@ GEM
|
|
212
214
|
pp (0.6.2)
|
213
215
|
prettyprint
|
214
216
|
prettyprint (0.2.0)
|
215
|
-
prism (1.
|
216
|
-
propshaft (1.
|
217
|
+
prism (1.5.1)
|
218
|
+
propshaft (1.3.1)
|
217
219
|
actionpack (>= 7.0.0)
|
218
220
|
activesupport (>= 7.0.0)
|
219
221
|
rack
|
@@ -232,20 +234,20 @@ GEM
|
|
232
234
|
rack (>= 1.3)
|
233
235
|
rackup (2.2.1)
|
234
236
|
rack (>= 3)
|
235
|
-
rails (8.0.
|
236
|
-
actioncable (= 8.0.
|
237
|
-
actionmailbox (= 8.0.
|
238
|
-
actionmailer (= 8.0.
|
239
|
-
actionpack (= 8.0.
|
240
|
-
actiontext (= 8.0.
|
241
|
-
actionview (= 8.0.
|
242
|
-
activejob (= 8.0.
|
243
|
-
activemodel (= 8.0.
|
244
|
-
activerecord (= 8.0.
|
245
|
-
activestorage (= 8.0.
|
246
|
-
activesupport (= 8.0.
|
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)
|
247
249
|
bundler (>= 1.15.0)
|
248
|
-
railties (= 8.0.
|
250
|
+
railties (= 8.0.3)
|
249
251
|
rails-dom-testing (2.3.0)
|
250
252
|
activesupport (>= 5.0.0)
|
251
253
|
minitest
|
@@ -253,31 +255,30 @@ GEM
|
|
253
255
|
rails-html-sanitizer (1.6.2)
|
254
256
|
loofah (~> 2.21)
|
255
257
|
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)
|
256
|
-
railties (8.0.
|
257
|
-
actionpack (= 8.0.
|
258
|
-
activesupport (= 8.0.
|
258
|
+
railties (8.0.3)
|
259
|
+
actionpack (= 8.0.3)
|
260
|
+
activesupport (= 8.0.3)
|
259
261
|
irb (~> 1.13)
|
260
262
|
rackup (>= 1.0.0)
|
261
263
|
rake (>= 12.2)
|
262
264
|
thor (~> 1.0, >= 1.2.2)
|
265
|
+
tsort (>= 0.2)
|
263
266
|
zeitwerk (~> 2.6)
|
264
|
-
rainbow (
|
265
|
-
rake
|
267
|
+
rainbow (3.1.1)
|
266
268
|
rake (13.3.0)
|
267
|
-
ransack (4.
|
268
|
-
activerecord (>=
|
269
|
-
activesupport (>=
|
269
|
+
ransack (4.4.0)
|
270
|
+
activerecord (>= 7.1)
|
271
|
+
activesupport (>= 7.1)
|
270
272
|
i18n
|
271
273
|
rdoc (6.14.2)
|
272
274
|
erb
|
273
275
|
psych (>= 4.0.0)
|
274
|
-
regexp_parser (2.11.
|
276
|
+
regexp_parser (2.11.3)
|
275
277
|
reline (0.6.2)
|
276
278
|
io-console (~> 0.5)
|
277
279
|
responders (3.1.1)
|
278
280
|
actionpack (>= 5.2)
|
279
281
|
railties (>= 5.2)
|
280
|
-
rexml (3.4.4)
|
281
282
|
rspec-core (3.13.5)
|
282
283
|
rspec-support (~> 3.13.0)
|
283
284
|
rspec-expectations (3.13.5)
|
@@ -294,24 +295,26 @@ GEM
|
|
294
295
|
rspec-expectations (~> 3.13)
|
295
296
|
rspec-mocks (~> 3.13)
|
296
297
|
rspec-support (~> 3.13)
|
297
|
-
rspec-support (3.13.
|
298
|
+
rspec-support (3.13.6)
|
298
299
|
rspec_junit_formatter (0.6.0)
|
299
300
|
rspec-core (>= 2, < 4, != 2.12.0)
|
300
|
-
rubocop (1.
|
301
|
+
rubocop (1.80.2)
|
301
302
|
json (~> 2.3)
|
303
|
+
language_server-protocol (~> 3.17.0.2)
|
304
|
+
lint_roller (~> 1.1.0)
|
302
305
|
parallel (~> 1.10)
|
303
|
-
parser (>= 3.
|
306
|
+
parser (>= 3.3.0.2)
|
304
307
|
rainbow (>= 2.2.2, < 4.0)
|
305
|
-
regexp_parser (>=
|
306
|
-
|
307
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
308
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
309
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
308
310
|
ruby-progressbar (~> 1.7)
|
309
|
-
unicode-display_width (>= 2.4.0, <
|
311
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
310
312
|
rubocop-ast (1.46.0)
|
311
313
|
parser (>= 3.3.7.2)
|
312
314
|
prism (~> 1.4)
|
313
|
-
rubocop-rspec (3.
|
314
|
-
|
315
|
+
rubocop-rspec (3.7.0)
|
316
|
+
lint_roller (~> 1.1)
|
317
|
+
rubocop (~> 1.72, >= 1.72.1)
|
315
318
|
ruby-progressbar (1.13.0)
|
316
319
|
securerandom (0.4.1)
|
317
320
|
simplecov (0.22.0)
|
@@ -320,13 +323,16 @@ GEM
|
|
320
323
|
simplecov_json_formatter (~> 0.1)
|
321
324
|
simplecov-html (0.13.2)
|
322
325
|
simplecov_json_formatter (0.1.4)
|
323
|
-
sqlite3 (2.7.
|
326
|
+
sqlite3 (2.7.4-x86_64-linux-gnu)
|
324
327
|
stringio (3.1.7)
|
325
328
|
thor (1.4.0)
|
326
329
|
timeout (0.4.3)
|
330
|
+
tsort (0.2.0)
|
327
331
|
tzinfo (2.0.6)
|
328
332
|
concurrent-ruby (~> 1.0)
|
329
|
-
unicode-display_width (2.
|
333
|
+
unicode-display_width (3.2.0)
|
334
|
+
unicode-emoji (~> 4.1)
|
335
|
+
unicode-emoji (4.1.0)
|
330
336
|
uri (1.0.3)
|
331
337
|
useragent (0.16.11)
|
332
338
|
warden (1.2.9)
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# ActiveAdmin Tom Select
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/activeadmin-tom_select)
|
4
|
-
[](https://badge.fury.io/js/activeadmin-tom_select)
|
5
|
+
[](https://www.npmjs.com/package/activeadmin-tom_select)
|
6
6
|
[](https://github.com/rs-pro/activeadmin-tom_select/actions)
|
7
7
|
|
8
8
|
Searchable select boxes (via [Tom Select](https://tom-select.js.org/)) for
|
@@ -37,7 +37,7 @@ rails generate active_admin:searchable_select:install --bundler=importmap
|
|
37
37
|
|
38
38
|
1. Install npm packages:
|
39
39
|
```bash
|
40
|
-
npm install
|
40
|
+
npm install activeadmin-tom_select tom-select
|
41
41
|
```
|
42
42
|
|
43
43
|
2. In `app/javascript/active_admin.js`:
|
@@ -49,7 +49,7 @@ import TomSelect from 'tom-select';
|
|
49
49
|
window.TomSelect = TomSelect;
|
50
50
|
|
51
51
|
// Import and auto-initialize searchable selects
|
52
|
-
import { setupAutoInit } from '
|
52
|
+
import { setupAutoInit } from 'activeadmin-tom_select';
|
53
53
|
setupAutoInit();
|
54
54
|
```
|
55
55
|
|
@@ -80,19 +80,19 @@ Import stylesheets and require javascripts:
|
|
80
80
|
Add to `package.json`:
|
81
81
|
```json
|
82
82
|
"dependencies": {
|
83
|
-
"
|
83
|
+
"activeadmin-tom_select": "^4.1.0"
|
84
84
|
}
|
85
85
|
```
|
86
86
|
|
87
87
|
In `app/javascript/packs/active_admin.js`:
|
88
88
|
```javascript
|
89
|
-
import { setupAutoInit } from '
|
89
|
+
import { setupAutoInit } from 'activeadmin-tom_select';
|
90
90
|
setupAutoInit();
|
91
91
|
```
|
92
92
|
|
93
93
|
In `app/javascript/stylesheets/active_admin.scss`:
|
94
94
|
```css
|
95
|
-
@import '
|
95
|
+
@import 'activeadmin-tom_select/css';
|
96
96
|
```
|
97
97
|
|
98
98
|
## Usage
|
@@ -100,12 +100,12 @@ In `app/javascript/stylesheets/active_admin.scss`:
|
|
100
100
|
### Making Select Boxes Searchable
|
101
101
|
|
102
102
|
To add search functionality to a select box, use the
|
103
|
-
`:
|
103
|
+
`:tom_select` input type:
|
104
104
|
|
105
105
|
```ruby
|
106
106
|
ActiveAdmin.register Product do
|
107
107
|
form do |f|
|
108
|
-
f.input(:category, as: :
|
108
|
+
f.input(:category, as: :tom_select)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
```
|
@@ -114,16 +114,18 @@ This also works for filters:
|
|
114
114
|
|
115
115
|
```ruby
|
116
116
|
ActiveAdmin.register Product do
|
117
|
-
filter(:category, as: :
|
117
|
+
filter(:category, as: :tom_select)
|
118
118
|
end
|
119
119
|
```
|
120
120
|
|
121
|
+
**Note:** The legacy `:searchable_select` input type is still supported for backward compatibility but `:tom_select` is recommended for new code.
|
122
|
+
|
121
123
|
By default, you can only select one at a time for a filter. You can
|
122
124
|
specify a multi-select with:
|
123
125
|
|
124
126
|
```ruby
|
125
127
|
ActiveAdmin.register Product do
|
126
|
-
filter(:category, as: :
|
128
|
+
filter(:category, as: :tom_select, multiple: true)
|
127
129
|
end
|
128
130
|
```
|
129
131
|
|
@@ -137,7 +139,7 @@ once the user begins to type:
|
|
137
139
|
|
138
140
|
ActiveAdmin.register Product do
|
139
141
|
filter(:category,
|
140
|
-
as: :
|
142
|
+
as: :tom_select,
|
141
143
|
ajax: true)
|
142
144
|
end
|
143
145
|
```
|
@@ -209,7 +211,7 @@ based on the input attribute name, you can pass an object with a
|
|
209
211
|
ActiveAdmin.register Product do
|
210
212
|
form do |f|
|
211
213
|
f.input(:additional_category,
|
212
|
-
as: :
|
214
|
+
as: :tom_select,
|
213
215
|
ajax: { resource: Category })
|
214
216
|
end
|
215
217
|
end
|
@@ -238,7 +240,7 @@ To specify which collection to use, pass an object with a
|
|
238
240
|
ActiveAdmin.register Product do
|
239
241
|
form do |f|
|
240
242
|
f.input(:category,
|
241
|
-
as: :
|
243
|
+
as: :tom_select,
|
242
244
|
ajax: { collection_name: :favorites })
|
243
245
|
end
|
244
246
|
end
|
@@ -288,7 +290,7 @@ You can pass additional parameters to the options endpoint:
|
|
288
290
|
ActiveAdmin.register Product do
|
289
291
|
form do |f|
|
290
292
|
f.input(:category,
|
291
|
-
as: :
|
293
|
+
as: :tom_select,
|
292
294
|
ajax: {
|
293
295
|
params: {
|
294
296
|
some: 'value'
|
@@ -357,7 +359,7 @@ ActiveAdmin.register(Variant) do
|
|
357
359
|
form do |f|
|
358
360
|
...
|
359
361
|
f.input(:option_value,
|
360
|
-
as: :
|
362
|
+
as: :tom_select,
|
361
363
|
ajax: {
|
362
364
|
resource: OptionValue,
|
363
365
|
path_params: {
|
@@ -386,7 +388,7 @@ for feature specs:
|
|
386
388
|
```ruby
|
387
389
|
RSpec.configure do |config|
|
388
390
|
config.before(:each) do |example|
|
389
|
-
ActiveAdmin::
|
391
|
+
ActiveAdmin::TomSelect.inline_ajax_options = (example.metadata[:type] == :feature)
|
390
392
|
end
|
391
393
|
end
|
392
394
|
|
@@ -404,7 +406,7 @@ has stopped typing before sending the request:
|
|
404
406
|
```ruby
|
405
407
|
...
|
406
408
|
f.input(:category,
|
407
|
-
as: :
|
409
|
+
as: :tom_select,
|
408
410
|
ajax: true,
|
409
411
|
input_html: {
|
410
412
|
data: {
|
@@ -4,7 +4,7 @@ require 'activeadmin/tom_select/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'activeadmin-tom_select'
|
7
|
-
spec.version = ActiveAdmin::
|
7
|
+
spec.version = ActiveAdmin::TomSelect::VERSION
|
8
8
|
spec.summary = 'Use Tom Select for searchable selects in Active Admin forms and filters.'
|
9
9
|
spec.license = 'MIT'
|
10
10
|
spec.authors = ['Rocket Sensei']
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency 'rspec_junit_formatter'
|
36
36
|
spec.add_development_dependency 'simplecov'
|
37
37
|
|
38
|
-
spec.
|
39
|
-
spec.
|
38
|
+
spec.add_dependency 'activeadmin', '>= 3.0', '< 5'
|
39
|
+
spec.add_dependency 'ransack', '>= 1.8', '< 5'
|
40
40
|
|
41
41
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
42
42
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|