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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/fix-tests.md +1 -1
  3. data/.github/workflows/ci.yml +3 -4
  4. data/.github/workflows/npm-publish.yml +3 -3
  5. data/.rubocop.yml +1 -1
  6. data/AGENTS.md +2 -2
  7. data/CHANGELOG.md +19 -1
  8. data/Gemfile.lock +85 -79
  9. data/README.md +20 -18
  10. data/activeadmin-tom_select.gemspec +3 -3
  11. data/docs/guide-update-your-app.md +198 -25
  12. data/docs/update-tom-select.md +322 -158
  13. data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +11 -11
  14. data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +66 -64
  15. data/lib/activeadmin/inputs/filters/searchable_select_input.rb +5 -12
  16. data/lib/activeadmin/inputs/filters/tom_select_input.rb +19 -0
  17. data/lib/activeadmin/inputs/searchable_select_input.rb +5 -11
  18. data/lib/activeadmin/inputs/tom_select_input.rb +16 -0
  19. data/lib/activeadmin/tom_select/engine.rb +3 -1
  20. data/lib/activeadmin/tom_select/option_collection.rb +1 -1
  21. data/lib/activeadmin/tom_select/resource_dsl_extension.rb +1 -1
  22. data/lib/activeadmin/tom_select/resource_extension.rb +1 -1
  23. data/lib/activeadmin/tom_select/select_input_extension.rb +14 -5
  24. data/lib/activeadmin/tom_select/version.rb +2 -2
  25. data/lib/activeadmin/tom_select.rb +3 -3
  26. data/lib/generators/active_admin/tom_select/install/install_generator.rb +5 -5
  27. data/npm-package/package-lock.json +2 -2
  28. data/npm-package/package.json +2 -2
  29. data/npm-package/src/index.js +1 -3
  30. data/npm-package/src/tom-select-tailwind.css +26 -20
  31. data/sonar-project.properties +5 -4
  32. data/spec/features/form_input_spec.rb +2 -2
  33. data/spec/features/inline_ajax_setting_spec.rb +1 -1
  34. data/spec/internal/Gemfile.lock +1 -1
  35. data/spec/internal/app/admin/articles.rb +28 -0
  36. data/spec/internal/app/assets/config/manifest.js +2 -1
  37. data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +1 -1
  38. data/spec/internal/app/assets/stylesheets/application.tailwind.css +0 -15
  39. data/spec/internal/app/javascript/active_admin.js +2 -4
  40. data/spec/internal/db/schema.rb +3 -1
  41. data/spec/internal/db/seeds.rb +4 -7
  42. data/spec/internal/package-lock.json +3 -3
  43. data/spec/internal/package.json +1 -1
  44. data/spec/internal/yarn.lock +1 -1
  45. data/spec/support/reset_settings.rb +1 -1
  46. metadata +5 -2
@@ -10,11 +10,11 @@ RSpec.describe 'form input', type: :request do
10
10
  # So we'll test with that configuration
11
11
  describe 'with ajax option (from static admin file)' do
12
12
  before(:each) do
13
- ActiveAdmin::SearchableSelect.inline_ajax_options = true
13
+ ActiveAdmin::TomSelect.inline_ajax_options = true
14
14
  end
15
15
 
16
16
  after(:each) do
17
- ActiveAdmin::SearchableSelect.inline_ajax_options = false
17
+ ActiveAdmin::TomSelect.inline_ajax_options = false
18
18
  end
19
19
  it 'renders select input with searchable-select-input css class' do
20
20
  get "#{ADMIN_POSTS_PATH}/new"
@@ -12,7 +12,7 @@ RSpec.describe 'inline_ajax_options setting', type: :request do
12
12
  Category.create!(name: 'Music')
13
13
  Category.create!(name: 'Cooking')
14
14
 
15
- ActiveAdmin::SearchableSelect.inline_ajax_options = true
15
+ ActiveAdmin::TomSelect.inline_ajax_options = true
16
16
  get '/admin/test_inline_ajax_posts/new'
17
17
 
18
18
  expect(response.body).to have_selector('.searchable-select-input option',
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- activeadmin-tom_select (4.1.0)
4
+ activeadmin-tom_select (4.1.1)
5
5
  activeadmin (>= 3.0, < 5)
6
6
  ransack (>= 1.8, < 5)
7
7
 
@@ -0,0 +1,28 @@
1
+ ActiveAdmin.register Post, as: 'Article' do
2
+ permit_params :title, :body, :category_id, :user_id, :created_at, :updated_at
3
+
4
+ index do
5
+ selectable_column
6
+ id_column
7
+ column :title
8
+ column :category
9
+ column :user
10
+ column :created_at
11
+ actions
12
+ end
13
+
14
+ # Use the new tom_select input type
15
+ filter :title
16
+ filter :category, as: :tom_select, ajax: true
17
+ filter :user, as: :tom_select, ajax: true
18
+
19
+ form do |f|
20
+ f.inputs do
21
+ f.input :title
22
+ f.input :body
23
+ f.input :category, as: :tom_select, ajax: true
24
+ f.input :user, as: :tom_select, ajax: true
25
+ end
26
+ f.actions
27
+ end
28
+ end
@@ -1,2 +1,3 @@
1
1
  //= link_tree ../images
2
- //= link_tree ../builds
2
+ //= link_tree ../builds
3
+ //= link active_admin.css
@@ -2,7 +2,7 @@
2
2
  @import "tailwindcss/components";
3
3
  @import "tailwindcss/utilities";
4
4
 
5
- @import "@rocket-sensei/activeadmin-tom_select/src/tom-select-tailwind.css";
5
+ @import "activeadmin-tom_select/src/tom-select-tailwind.css";
6
6
 
7
7
  /* Additional batch actions dropdown styles that aren't in the ActiveAdmin plugin */
8
8
  @layer components {
@@ -1,15 +0,0 @@
1
- @import "tailwindcss";
2
-
3
- /* Import our Tom Select Tailwind theme overrides */
4
- @import '../../../../../src/tom-select-tailwind.css';
5
-
6
- /* Additional batch actions dropdown styles that aren't in the ActiveAdmin plugin */
7
- @layer components {
8
- .batch-actions-dropdown-toggle:disabled {
9
- @apply opacity-50 cursor-not-allowed;
10
- }
11
-
12
- .batch-actions-dropdown-arrow {
13
- @apply w-2.5 h-2.5;
14
- }
15
- }
@@ -8,12 +8,10 @@ import TomSelect from 'tom-select';
8
8
  window.TomSelect = TomSelect;
9
9
 
10
10
  // Import and setup ActiveAdmin Tom Select
11
- import { setupAutoInit, initSearchableSelects } from '@rocket-sensei/activeadmin-tom_select';
11
+ import { setupAutoInit, initSearchableSelects } from 'activeadmin-tom_select';
12
12
 
13
13
  // Make the init function globally available for tests
14
14
  window.initSearchableSelects = initSearchableSelects;
15
15
 
16
16
  // Initialize the module after everything is loaded
17
- setupAutoInit();
18
-
19
- console.log('ActiveAdmin JS loaded with Tom Select');
17
+ setupAutoInit();
@@ -10,7 +10,9 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[8.0].define(version: 0) do
13
+ # Use appropriate version based on Rails version
14
+ schema_version = Rails.version.start_with?('8') ? '8.0' : '7.1'
15
+ ActiveRecord::Schema[schema_version].define(version: 0) do
14
16
  create_table 'active_admin_comments', force: :cascade do |t|
15
17
  t.string 'namespace'
16
18
  t.text 'body'
@@ -50,7 +50,7 @@ rgb_colors_data = [
50
50
  { code: '#FFFFFF', description: 'White' }
51
51
  ]
52
52
 
53
- rgb_colors = rgb_colors_data.map do |color|
53
+ rgb_colors_data.map do |color|
54
54
  RgbColor.find_or_create_by(code: color[:code]) do |rgb|
55
55
  rgb.description = color[:description]
56
56
  end
@@ -58,10 +58,7 @@ end
58
58
 
59
59
  # Create internal tag names
60
60
  10.times do |i|
61
- InternalTagName.find_or_create_by(name: "Internal Tag #{i + 1}") do |tag|
62
- tag.description = "Description for internal tag #{i + 1}"
63
- tag.color_id = rgb_colors.sample.id
64
- end
61
+ InternalTagName.find_or_create_by(name: "Internal Tag #{i + 1}")
65
62
  end
66
63
 
67
64
  # Create option types and values
@@ -72,7 +69,7 @@ option_types = []
72
69
 
73
70
  5.times do |j|
74
71
  OptionValue.find_or_create_by(
75
- value: "Value #{j + 1} for #{option_type.name}",
72
+ name: "Value #{j + 1} for #{option_type.name}",
76
73
  option_type_id: option_type.id
77
74
  )
78
75
  end
@@ -114,7 +111,7 @@ end
114
111
 
115
112
  # Update posts with colors
116
113
  Post.all.each do |post|
117
- post.update(color: colors.sample) if post.color_id.nil?
114
+ post.update(color_id: colors.sample.id) if post.color_id.nil?
118
115
  end
119
116
 
120
117
  # Create Tags
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@activeadmin/activeadmin": "^4.0.0-beta16",
10
10
  "@rails/ujs": "^7.1.400",
11
- "@rocket-sensei/activeadmin-tom_select": "file:../../npm-package",
11
+ "activeadmin-tom_select": "file:../../npm-package",
12
12
  "tailwindcss": "^3.4.17",
13
13
  "tom-select": "^2.4.3"
14
14
  },
@@ -17,7 +17,7 @@
17
17
  }
18
18
  },
19
19
  "../../npm-package": {
20
- "name": "@rocket-sensei/activeadmin-tom_select",
20
+ "name": "activeadmin-tom_select",
21
21
  "version": "4.1.0",
22
22
  "license": "MIT",
23
23
  "peerDependencies": {
@@ -622,7 +622,7 @@
622
622
  "integrity": "sha512-SFtA5X59BimNG8cy60pgZhPf1bGpg5KXVYF6Jj5H5hrwwNXKNmD2yNZhHC+WfuLqBN+972cZHR9Fto6nJQz+Xw==",
623
623
  "license": "MIT"
624
624
  },
625
- "node_modules/@rocket-sensei/activeadmin-tom_select": {
625
+ "node_modules/activeadmin-tom_select": {
626
626
  "resolved": "../../npm-package",
627
627
  "link": true
628
628
  },
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "@activeadmin/activeadmin": "^4.0.0-beta16",
16
16
  "@rails/ujs": "^7.1.400",
17
- "@rocket-sensei/activeadmin-tom_select": "file:../../npm-package",
17
+ "activeadmin-tom_select": "file:../../npm-package",
18
18
  "tailwindcss": "^3.4.17",
19
19
  "tom-select": "^2.4.3"
20
20
  }
@@ -111,7 +111,7 @@
111
111
  resolved "https://registry.npmjs.org/@rails/ujs/-/ujs-7.1.2.tgz"
112
112
  integrity sha512-c5x02djEKEVVE4qfN4XgElJS4biM0xxtIVpcJ0ZHLK116U19rowTtmD0AJ/RCb3Xaewa4GPIWLlwgeC0dCQqzw==
113
113
 
114
- "@rocket-sensei/activeadmin-tom_select@file:../../npm-package":
114
+ "activeadmin-tom_select@file:../../npm-package":
115
115
  version "4.1.0"
116
116
  resolved "file:../../npm-package"
117
117
 
@@ -1,5 +1,5 @@
1
1
  RSpec.configure do |config|
2
2
  config.before(:each) do
3
- ActiveAdmin::SearchableSelect.inline_ajax_options = false
3
+ ActiveAdmin::TomSelect.inline_ajax_options = false
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-tom_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocket Sensei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-15 00:00:00.000000000 Z
11
+ date: 2025-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -320,7 +320,9 @@ files:
320
320
  - lefthook.yml
321
321
  - lib/activeadmin-tom_select.rb
322
322
  - lib/activeadmin/inputs/filters/searchable_select_input.rb
323
+ - lib/activeadmin/inputs/filters/tom_select_input.rb
323
324
  - lib/activeadmin/inputs/searchable_select_input.rb
325
+ - lib/activeadmin/inputs/tom_select_input.rb
324
326
  - lib/activeadmin/tom_select.rb
325
327
  - lib/activeadmin/tom_select/engine.rb
326
328
  - lib/activeadmin/tom_select/option_collection.rb
@@ -350,6 +352,7 @@ files:
350
352
  - spec/internal/Procfile.dev
351
353
  - spec/internal/README.md
352
354
  - spec/internal/Rakefile
355
+ - spec/internal/app/admin/articles.rb
353
356
  - spec/internal/app/admin/categories.rb
354
357
  - spec/internal/app/admin/dashboard.rb
355
358
  - spec/internal/app/admin/option_types.rb