activeadmin-tom_select 4.1.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.
Files changed (196) hide show
  1. checksums.yaml +7 -0
  2. data/.actrc +20 -0
  3. data/.claude/commands/fix-tests.md +203 -0
  4. data/.github/workflows/ci.yml +174 -0
  5. data/.github/workflows/npm-publish.yml +50 -0
  6. data/.gitignore +35 -0
  7. data/.npmignore +58 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +75 -0
  10. data/.yardopts +2 -0
  11. data/AGENTS.md +39 -0
  12. data/Appraisals +9 -0
  13. data/CHANGELOG.md +64 -0
  14. data/CLAUDE.md +157 -0
  15. data/Gemfile +12 -0
  16. data/Gemfile.lock +368 -0
  17. data/LICENSE.txt +25 -0
  18. data/README.md +483 -0
  19. data/Rakefile +4 -0
  20. data/activeadmin-tom_select.gemspec +43 -0
  21. data/bin/rspec +17 -0
  22. data/config/database.yml +16 -0
  23. data/docs/activeadmin-4-detailed-reference.md +932 -0
  24. data/docs/activeadmin-4-gem-migration-guide.md +313 -0
  25. data/docs/combustion.md +213 -0
  26. data/docs/fail.png +0 -0
  27. data/docs/guide-update-your-app.md +283 -0
  28. data/docs/normal.png +0 -0
  29. data/docs/propshaft-readme.md +320 -0
  30. data/docs/propshaft-upgrade.md +484 -0
  31. data/docs/setup-activeadmin-app.md +552 -0
  32. data/docs/setup-activeadmin-gem.md +535 -0
  33. data/docs/tailwind/blog-page.md +341 -0
  34. data/docs/tailwind/upgrade-guide-enhanced.md +438 -0
  35. data/docs/tailwind/upgrade-guide.md +416 -0
  36. data/docs/tailwind-4/active_admin.rake +38 -0
  37. data/docs/tailwind-4/active_admin.tailwind.css +415 -0
  38. data/docs/tailwind-4/tailwind-active_admin.config.js +18 -0
  39. data/docs/test-app-change.md +154 -0
  40. data/docs/test-environment-fixes.md +58 -0
  41. data/docs/update-tom-select.md +184 -0
  42. data/docs/upload-system.md +225 -0
  43. data/gemfiles/rails_7.x_active_admin_4.x.gemfile +10 -0
  44. data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +377 -0
  45. data/gemfiles/rails_8.x_active_admin_4.x.gemfile +10 -0
  46. data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +372 -0
  47. data/lefthook.yml +17 -0
  48. data/lib/activeadmin/inputs/filters/searchable_select_input.rb +19 -0
  49. data/lib/activeadmin/inputs/searchable_select_input.rb +16 -0
  50. data/lib/activeadmin/tom_select/engine.rb +17 -0
  51. data/lib/activeadmin/tom_select/option_collection.rb +128 -0
  52. data/lib/activeadmin/tom_select/resource_dsl_extension.rb +56 -0
  53. data/lib/activeadmin/tom_select/resource_extension.rb +10 -0
  54. data/lib/activeadmin/tom_select/select_input_extension.rb +168 -0
  55. data/lib/activeadmin/tom_select/version.rb +5 -0
  56. data/lib/activeadmin/tom_select.rb +20 -0
  57. data/lib/activeadmin-tom_select.rb +5 -0
  58. data/lib/generators/active_admin/tom_select/install/install_generator.rb +180 -0
  59. data/npm-package/package-lock.json +51 -0
  60. data/npm-package/package.json +43 -0
  61. data/npm-package/src/index.js +153 -0
  62. data/npm-package/src/tom-select-tailwind.css +392 -0
  63. data/sonar-project.properties +25 -0
  64. data/spec/features/ajax_params_spec.rb +31 -0
  65. data/spec/features/asset_pipeline_diagnostic_spec.rb +155 -0
  66. data/spec/features/end_to_end_spec.rb +273 -0
  67. data/spec/features/filter_input_spec.rb +144 -0
  68. data/spec/features/form_input_spec.rb +122 -0
  69. data/spec/features/inline_ajax_setting_spec.rb +26 -0
  70. data/spec/features/input_errors_spec.rb +76 -0
  71. data/spec/features/input_html_options_spec.rb +30 -0
  72. data/spec/features/options_dsl_spec.rb +230 -0
  73. data/spec/features/production_build_spec.rb +108 -0
  74. data/spec/internal/.node-version +1 -0
  75. data/spec/internal/Gemfile +43 -0
  76. data/spec/internal/Gemfile.lock +333 -0
  77. data/spec/internal/Procfile.dev +3 -0
  78. data/spec/internal/README.md +24 -0
  79. data/spec/internal/Rakefile +6 -0
  80. data/spec/internal/app/admin/categories.rb +26 -0
  81. data/spec/internal/app/admin/dashboard.rb +29 -0
  82. data/spec/internal/app/admin/option_types.rb +19 -0
  83. data/spec/internal/app/admin/option_values.rb +30 -0
  84. data/spec/internal/app/admin/posts.rb +27 -0
  85. data/spec/internal/app/admin/products.rb +22 -0
  86. data/spec/internal/app/admin/rgb_colors.rb +25 -0
  87. data/spec/internal/app/admin/tag_names.rb +21 -0
  88. data/spec/internal/app/admin/test_ajax_params_category.rb +10 -0
  89. data/spec/internal/app/admin/test_ajax_params_post.rb +20 -0
  90. data/spec/internal/app/admin/test_form_post_class.rb +7 -0
  91. data/spec/internal/app/admin/test_form_post_custom.rb +11 -0
  92. data/spec/internal/app/admin/test_form_post_resource.rb +11 -0
  93. data/spec/internal/app/admin/test_form_post_resource_custom.rb +12 -0
  94. data/spec/internal/app/admin/test_inline_ajax_post.rb +9 -0
  95. data/spec/internal/app/admin/test_input_html_post.rb +11 -0
  96. data/spec/internal/app/admin/test_posts_display_text.rb +9 -0
  97. data/spec/internal/app/admin/test_posts_filter.rb +9 -0
  98. data/spec/internal/app/admin/test_posts_named.rb +9 -0
  99. data/spec/internal/app/admin/test_posts_pagination.rb +9 -0
  100. data/spec/internal/app/admin/test_posts_payload_lambda.rb +11 -0
  101. data/spec/internal/app/admin/test_posts_payload_proc.rb +9 -0
  102. data/spec/internal/app/admin/test_posts_scope_lambda.rb +8 -0
  103. data/spec/internal/app/admin/test_posts_scope_params.rb +8 -0
  104. data/spec/internal/app/admin/test_posts_scope_user.rb +8 -0
  105. data/spec/internal/app/admin/test_posts_text_attr.rb +5 -0
  106. data/spec/internal/app/admin/users.rb +23 -0
  107. data/spec/internal/app/admin/variants.rb +31 -0
  108. data/spec/internal/app/assets/config/manifest.js +2 -0
  109. data/spec/internal/app/assets/images/.keep +0 -0
  110. data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +16 -0
  111. data/spec/internal/app/assets/stylesheets/application.tailwind.css +15 -0
  112. data/spec/internal/app/controllers/application_controller.rb +9 -0
  113. data/spec/internal/app/controllers/concerns/.keep +0 -0
  114. data/spec/internal/app/helpers/application_helper.rb +2 -0
  115. data/spec/internal/app/javascript/active_admin.js +19 -0
  116. data/spec/internal/app/javascript/application.js +2 -0
  117. data/spec/internal/app/jobs/application_job.rb +7 -0
  118. data/spec/internal/app/mailers/application_mailer.rb +4 -0
  119. data/spec/internal/app/models/admin_user.rb +9 -0
  120. data/spec/internal/app/models/application_record.rb +3 -0
  121. data/spec/internal/app/models/article.rb +12 -0
  122. data/spec/internal/app/models/category.rb +12 -0
  123. data/spec/internal/app/models/color.rb +9 -0
  124. data/spec/internal/app/models/concerns/.keep +0 -0
  125. data/spec/internal/app/models/internal/tag_name.rb +14 -0
  126. data/spec/internal/app/models/internal_tag_name.rb +11 -0
  127. data/spec/internal/app/models/option_type.rb +12 -0
  128. data/spec/internal/app/models/option_value.rb +4 -0
  129. data/spec/internal/app/models/post.rb +15 -0
  130. data/spec/internal/app/models/product.rb +12 -0
  131. data/spec/internal/app/models/rgb_color.rb +16 -0
  132. data/spec/internal/app/models/tag.rb +12 -0
  133. data/spec/internal/app/models/tagging.rb +12 -0
  134. data/spec/internal/app/models/user.rb +12 -0
  135. data/spec/internal/app/models/variant.rb +12 -0
  136. data/spec/internal/app/views/layouts/application.html.erb +28 -0
  137. data/spec/internal/app/views/layouts/mailer.html.erb +13 -0
  138. data/spec/internal/app/views/layouts/mailer.text.erb +1 -0
  139. data/spec/internal/app/views/pwa/manifest.json.erb +22 -0
  140. data/spec/internal/app/views/pwa/service-worker.js +26 -0
  141. data/spec/internal/bin/bundle +117 -0
  142. data/spec/internal/bin/dev +11 -0
  143. data/spec/internal/bin/rackup +27 -0
  144. data/spec/internal/bin/rails +4 -0
  145. data/spec/internal/bin/rake +4 -0
  146. data/spec/internal/bin/setup +37 -0
  147. data/spec/internal/config/application.rb +50 -0
  148. data/spec/internal/config/boot.rb +3 -0
  149. data/spec/internal/config/credentials.yml.enc +1 -0
  150. data/spec/internal/config/database.yml +32 -0
  151. data/spec/internal/config/environment.rb +5 -0
  152. data/spec/internal/config/environments/development.rb +63 -0
  153. data/spec/internal/config/environments/production.rb +86 -0
  154. data/spec/internal/config/environments/test.rb +50 -0
  155. data/spec/internal/config/initializers/active_admin.rb +54 -0
  156. data/spec/internal/config/initializers/assets.rb +8 -0
  157. data/spec/internal/config/initializers/content_security_policy.rb +25 -0
  158. data/spec/internal/config/initializers/devise.rb +315 -0
  159. data/spec/internal/config/initializers/filter_parameter_logging.rb +8 -0
  160. data/spec/internal/config/initializers/inflections.rb +16 -0
  161. data/spec/internal/config/initializers/searchable_select.rb +6 -0
  162. data/spec/internal/config/locales/devise.en.yml +65 -0
  163. data/spec/internal/config/locales/en.yml +31 -0
  164. data/spec/internal/config/master.key +1 -0
  165. data/spec/internal/config/puma.rb +38 -0
  166. data/spec/internal/config/routes.rb +17 -0
  167. data/spec/internal/config.ru +6 -0
  168. data/spec/internal/db/schema.rb +174 -0
  169. data/spec/internal/db/seeds.rb +167 -0
  170. data/spec/internal/esbuild.config.js +34 -0
  171. data/spec/internal/lib/tasks/.keep +0 -0
  172. data/spec/internal/lib/tasks/active_admin.rake +55 -0
  173. data/spec/internal/log/.keep +0 -0
  174. data/spec/internal/package-lock.json +1954 -0
  175. data/spec/internal/package.json +21 -0
  176. data/spec/internal/public/400.html +114 -0
  177. data/spec/internal/public/404.html +114 -0
  178. data/spec/internal/public/406-unsupported-browser.html +114 -0
  179. data/spec/internal/public/422.html +114 -0
  180. data/spec/internal/public/500.html +114 -0
  181. data/spec/internal/public/icon.png +0 -0
  182. data/spec/internal/public/icon.svg +3 -0
  183. data/spec/internal/public/robots.txt +1 -0
  184. data/spec/internal/script/.keep +0 -0
  185. data/spec/internal/storage/.keep +0 -0
  186. data/spec/internal/tailwind.config.js +23 -0
  187. data/spec/internal/vendor/.keep +0 -0
  188. data/spec/internal/yarn.lock +824 -0
  189. data/spec/rails_helper.rb +62 -0
  190. data/spec/spec_helper.rb +138 -0
  191. data/spec/support/active_admin_helpers.rb +17 -0
  192. data/spec/support/capybara.rb +8 -0
  193. data/spec/support/models.rb +11 -0
  194. data/spec/support/pluck_polyfill.rb +12 -0
  195. data/spec/support/reset_settings.rb +5 -0
  196. metadata +497 -0
@@ -0,0 +1,62 @@
1
+ require_relative 'spec_helper'
2
+
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+
5
+ # Load required gems before Rails initialization
6
+ require 'devise'
7
+ require 'propshaft'
8
+
9
+ # Load the Rails test application
10
+ require_relative 'internal/config/environment'
11
+
12
+ require 'rspec/rails'
13
+ require 'capybara/rails'
14
+ require 'capybara-playwright-driver'
15
+ require 'database_cleaner/active_record'
16
+
17
+ # Load support files
18
+ Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require_relative f }
19
+
20
+ # Ensure ActiveAdmin loads properly with batch actions
21
+ ActiveAdmin.application.load!
22
+
23
+ # Configure Capybara with Playwright for modern browser testing
24
+ Capybara.register_driver :playwright do |app|
25
+ Capybara::Playwright::Driver.new(app,
26
+ browser_type: :chromium,
27
+ headless: ENV['HEADLESS'] != 'false')
28
+ end
29
+
30
+ Capybara.default_driver = :rack_test
31
+ Capybara.javascript_driver = :playwright
32
+ Capybara.default_max_wait_time = 5
33
+
34
+ RSpec.configure do |config|
35
+ config.use_transactional_fixtures = false
36
+ config.infer_spec_type_from_file_location!
37
+ config.filter_rails_from_backtrace!
38
+
39
+ # Database cleaner setup
40
+ config.before(:suite) do
41
+ DatabaseCleaner.clean_with(:truncation)
42
+ end
43
+
44
+ config.before(:each) do
45
+ DatabaseCleaner.strategy = :transaction
46
+ end
47
+
48
+ config.before(:each, js: true) do
49
+ DatabaseCleaner.strategy = :truncation
50
+ end
51
+
52
+ config.before(:each) do
53
+ DatabaseCleaner.start
54
+ end
55
+
56
+ config.after(:each) do
57
+ DatabaseCleaner.clean
58
+ end
59
+
60
+ # Include Capybara DSL in feature specs
61
+ config.include Capybara::DSL, type: :feature
62
+ end
@@ -0,0 +1,138 @@
1
+ # SimpleCov must be started before any application code is loaded
2
+ # Make SimpleCov optional so tests can run without it (e.g., in Appraisal gemfiles)
3
+ begin
4
+ require 'simplecov'
5
+ require 'simplecov_json_formatter'
6
+
7
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
8
+ [
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ SimpleCov::Formatter::JSONFormatter
11
+ ]
12
+ )
13
+
14
+ SimpleCov.start do
15
+ # Configure coverage directory
16
+ coverage_dir 'coverage'
17
+
18
+ # Add filters to exclude non-application code
19
+ add_filter '/spec/'
20
+ add_filter '/vendor/'
21
+ add_filter '/config/'
22
+ add_filter '/app/assets/builds/' # Exclude built assets
23
+ add_filter '/spec/internal/app/assets/builds/'
24
+ add_filter '/spec/internal/public/'
25
+ add_filter '/spec/internal/node_modules/'
26
+ add_filter '/spec/internal/package/' # Since these are now symlinks
27
+
28
+ # Track all files in lib and app directories
29
+ track_files 'lib/**/*.rb'
30
+ track_files 'app/**/*.rb'
31
+
32
+ # Set minimum coverage percentage (optional but recommended)
33
+ minimum_coverage 80
34
+ end
35
+ rescue LoadError
36
+ # SimpleCov not available, continue without coverage
37
+ # This allows tests to run in environments where SimpleCov is not installed
38
+ end
39
+
40
+ # This file was generated by the `rspec --init` command. Conventionally, all
41
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
42
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
43
+ # this file to always be loaded, without a need to explicitly require it in any
44
+ # files.
45
+ #
46
+ # Given that it is always loaded, you are encouraged to keep this file as
47
+ # light-weight as possible. Requiring heavyweight dependencies from this file
48
+ # will add to the boot time of your test suite on EVERY test run, even for an
49
+ # individual file that may not need all of that loaded. Instead, consider making
50
+ # a separate helper file that requires the additional dependencies and performs
51
+ # the additional setup, and require it from the spec files that actually need
52
+ # it.
53
+ #
54
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
55
+ RSpec.configure do |config|
56
+ # Exclude vendor and node_modules directories from spec discovery
57
+ # This prevents RSpec from picking up specs from dependencies
58
+ config.exclude_pattern = '**/vendor/**/*,**/node_modules/**/*'
59
+ # rspec-expectations config goes here. You can use an alternate
60
+ # assertion/expectation library such as wrong or the stdlib/minitest
61
+ # assertions if you prefer.
62
+ config.expect_with :rspec do |expectations|
63
+ # This option will default to `true` in RSpec 4. It makes the `description`
64
+ # and `failure_message` of custom matchers include text for helper methods
65
+ # defined using `chain`, e.g.:
66
+ # be_bigger_than(2).and_smaller_than(4).description
67
+ # # => "be bigger than 2 and smaller than 4"
68
+ # ...rather than:
69
+ # # => "be bigger than 2"
70
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
71
+ end
72
+
73
+ # rspec-mocks config goes here. You can use an alternate test double
74
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
75
+ config.mock_with :rspec do |mocks|
76
+ # Prevents you from mocking or stubbing a method that does not exist on
77
+ # a real object. This is generally recommended, and will default to
78
+ # `true` in RSpec 4.
79
+ mocks.verify_partial_doubles = true
80
+ end
81
+
82
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
83
+ # have no way to turn it off -- the option exists only for backwards
84
+ # compatibility in RSpec 3). It causes shared context metadata to be
85
+ # inherited by the metadata hash of host groups and examples, rather than
86
+ # triggering implicit auto-inclusion in groups with matching metadata.
87
+ config.shared_context_metadata_behavior = :apply_to_host_groups
88
+
89
+ # This allows you to limit a spec run to individual examples or groups
90
+ # you care about by tagging them with `:focus` metadata. When nothing
91
+ # is tagged with `:focus`, all examples get run. RSpec also provides
92
+ # aliases for `it`, `describe`, and `context` that include `:focus`
93
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
94
+ config.filter_run_when_matching :focus
95
+
96
+ # Allows RSpec to persist some state between runs in order to support
97
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
98
+ # you configure your source control system to ignore this file.
99
+ config.example_status_persistence_file_path = 'spec/examples.txt'
100
+
101
+ # Limits the available syntax to the non-monkey patched syntax that is
102
+ # recommended. For more details, see:
103
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
104
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
105
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
106
+ config.disable_monkey_patching!
107
+
108
+ # This setting enables warnings. It's recommended, but in some cases may
109
+ # be too noisy due to issues in dependencies.
110
+ config.warnings = false
111
+
112
+ # Many RSpec users commonly either run the entire suite or an individual
113
+ # file, and it's useful to allow more verbose output when running an
114
+ # individual spec file.
115
+ if config.files_to_run.one?
116
+ # Use the documentation formatter for detailed output,
117
+ # unless a formatter has already been configured
118
+ # (e.g. via a command-line flag).
119
+ config.default_formatter = 'doc'
120
+ end
121
+
122
+ # Print the 2 slowest examples at the
123
+ # end of the spec run, to help surface which specs are running
124
+ # particularly slow. No groups to save space in logs.
125
+ config.profile_examples = 2
126
+
127
+ # Run specs in random order to surface order dependencies. If you find an
128
+ # order dependency and want to debug it, you can fix the order by providing
129
+ # the seed, which is printed after each run.
130
+ # --seed 1234
131
+ config.order = :random
132
+
133
+ # Seed global randomization in this process using the `--seed` CLI option.
134
+ # Setting this allows you to use `--seed` to deterministically reproduce
135
+ # test failures related to randomization by passing the same `--seed` value
136
+ # as the one that triggered the failure.
137
+ Kernel.srand config.seed
138
+ end
@@ -0,0 +1,17 @@
1
+ module ActiveAdminHelpers
2
+ module_function
3
+
4
+ def reload_routes!
5
+ return unless Rails.application
6
+
7
+ Rails.application.reload_routes!
8
+ end
9
+
10
+ def setup
11
+ # Since we can't easily override static registrations,
12
+ # just yield to let tests define additional config if needed
13
+ # Most tests will need to be updated to work with existing static admin files
14
+ yield if block_given?
15
+ reload_routes!
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ require 'capybara/rspec'
2
+
3
+ # Capybara configuration is now in rails_helper.rb
4
+ # Using Playwright driver for modern browser testing
5
+
6
+ RSpec.configure do |config|
7
+ config.include Capybara::RSpecMatchers, type: :request
8
+ end
@@ -0,0 +1,11 @@
1
+ require 'database_cleaner-active_record'
2
+
3
+ # Models are now defined in the Rails app under spec/internal/app/models/
4
+ # This file only keeps the database cleaner configuration
5
+
6
+ RSpec.configure do |config|
7
+ config.after do
8
+ DatabaseCleaner.strategy = :truncation
9
+ DatabaseCleaner.clean
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # Required for ActiveSupport < 5
2
+ unless [].respond_to?(:pluck)
3
+ module Enumerable
4
+ def pluck(*keys)
5
+ if keys.many?
6
+ map { |element| keys.map { |key| element[key] } }
7
+ else
8
+ map { |element| element[keys.first] }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ ActiveAdmin::SearchableSelect.inline_ajax_options = false
4
+ end
5
+ end