зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-07 12:05:51 +03:00
fix: Update tests and CI for ActiveAdmin 4 compatibility
- Fix active_admin_comments to use active_admin_comments_for in AA4 - Add author to CSS test to fix validation error - Update has_many support for AA4 using .has-many-add button click - Simplify GitHub Actions workflow for AA4 testing - All tests now passing with ActiveAdmin 4.0.0.beta16 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Этот коммит содержится в:
5
.github/workflows/specs.yml
поставляемый
5
.github/workflows/specs.yml
поставляемый
@@ -102,12 +102,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
gem install bundler
|
gem install bundler
|
||||||
bundle config set --local without 'development'
|
bundle config set --local without 'development'
|
||||||
bundle add activeadmin --version '~> 4.0.0.beta' --skip-install
|
|
||||||
bundle add importmap-rails --skip-install
|
|
||||||
bundle add propshaft --skip-install if [ "${{ matrix.rails }}" = "7.2" ]
|
|
||||||
bundle install --jobs 4 --retry 3
|
bundle install --jobs 4 --retry 3
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: ${{ matrix.rails }}
|
RAILS_VERSION: ${{ matrix.rails }}
|
||||||
|
ACTIVEADMIN_VERSION: ''
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -118,7 +116,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd spec/dummy
|
cd spec/dummy
|
||||||
npm install
|
npm install
|
||||||
npm install @activeadmin/activeadmin@^4.0.0-beta
|
|
||||||
|
|
||||||
- name: Build assets
|
- name: Build assets
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ ActiveAdmin.register Author do
|
|||||||
row :profile
|
row :profile
|
||||||
row :posts
|
row :posts
|
||||||
end
|
end
|
||||||
active_admin_comments
|
active_admin_comments_for(resource) if active_admin_config.comments?
|
||||||
end
|
end
|
||||||
|
|
||||||
form do |f|
|
form do |f|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ ActiveAdmin.register Post do
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
active_admin_comments
|
active_admin_comments_for(resource) if active_admin_config.comments?
|
||||||
end
|
end
|
||||||
|
|
||||||
form do |f|
|
form do |f|
|
||||||
|
|||||||
@@ -3086,10 +3086,14 @@
|
|||||||
document.addEventListener("turbo:load", initQuillEditors);
|
document.addEventListener("turbo:load", initQuillEditors);
|
||||||
document.addEventListener("turbo:render", initQuillEditors);
|
document.addEventListener("turbo:render", initQuillEditors);
|
||||||
document.addEventListener("turbolinks:load", initQuillEditors);
|
document.addEventListener("turbolinks:load", initQuillEditors);
|
||||||
document.addEventListener("has_many_add:after", function(event) {
|
document.addEventListener("click", function(event) {
|
||||||
const newFields = event.target.querySelectorAll("[data-aa-quill-editor]");
|
if (event.target.closest(".has-many-add")) {
|
||||||
newFields.forEach(initQuillEditor);
|
setTimeout(function() {
|
||||||
setupFormSubmission();
|
const newEditors = document.querySelectorAll("[data-aa-quill-editor]:not(.quill-editor--active)");
|
||||||
|
newEditors.forEach(initQuillEditor);
|
||||||
|
setupFormSubmission();
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const QuillEditor = {
|
const QuillEditor = {
|
||||||
|
|||||||
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
@@ -69,7 +69,8 @@ RSpec.describe 'CSS Loading', type: :system do
|
|||||||
|
|
||||||
it 'applies Quill styles correctly when editor is present' do
|
it 'applies Quill styles correctly when editor is present' do
|
||||||
# Create a test model with Quill editor
|
# Create a test model with Quill editor
|
||||||
post = Post.create!(title: 'Test Post', description: '<p>Test content</p>')
|
author = Author.create!(email: 'test@example.com', name: 'Test Author', age: 30)
|
||||||
|
post = Post.create!(author: author, title: 'Test Post', description: '<p>Test content</p>')
|
||||||
visit "/admin/posts/#{post.id}/edit"
|
visit "/admin/posts/#{post.id}/edit"
|
||||||
|
|
||||||
# Wait for editor to load
|
# Wait for editor to load
|
||||||
|
|||||||
14
vendor/assets/javascripts/activeadmin_quill_editor.js
поставляемый
14
vendor/assets/javascripts/activeadmin_quill_editor.js
поставляемый
@@ -190,10 +190,16 @@
|
|||||||
document.addEventListener('turbolinks:load', initQuillEditors);
|
document.addEventListener('turbolinks:load', initQuillEditors);
|
||||||
|
|
||||||
// Support for ActiveAdmin has_many fields
|
// Support for ActiveAdmin has_many fields
|
||||||
document.addEventListener('has_many_add:after', function(event) {
|
// ActiveAdmin 4 uses .has-many-add button click
|
||||||
const newFields = event.target.querySelectorAll('[data-aa-quill-editor]');
|
document.addEventListener('click', function(event) {
|
||||||
newFields.forEach(initQuillEditor);
|
if (event.target.closest('.has-many-add')) {
|
||||||
setupFormSubmission();
|
// Wait for DOM to be updated with new fields
|
||||||
|
setTimeout(function() {
|
||||||
|
const newEditors = document.querySelectorAll('[data-aa-quill-editor]:not(.quill-editor--active)');
|
||||||
|
newEditors.forEach(initQuillEditor);
|
||||||
|
setupFormSubmission();
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user