jemcode / rails_admin_history_rollback

History rollback for rails_admin with paper_trail
https://rubygems.org/gems/rails_admin_history_rollback
MIT License
41 stars 27 forks source link

Not working with fresh Rails 7 app? #29

Open edooley opened 2 years ago

edooley commented 2 years ago

Perhaps I'm missing something obvious. First time using rails_admin and paper_trail. Built a fresh new Rails 7 app out of the box (rails 7.0.3, ruby 3.1.2). Got rails_admin (3.0) and paper_trail (13.0) working great. Followed instructions to enable auditing with paper_trail and History tab is showing up / tracking changes just fine. However, adding this gem and following its instructions does not show any of the Rollback columns, etc (as seen in the sample screenshots). Any ideas? Thanks!

rikkipitt commented 2 years ago

Hey @edooley, thanks for the heads up. I'll take a look. I've only briefly used rails_admin v3 but had to quickly revert back to v2 for legacy build compatibility issues on an old project. I have a feeling there may be breaking changes in v3 that might be the cause of this. Do you happen to have a demo Rails app I could take a look at? If not, I'll try and spin one up and check it out.

rikkipitt commented 2 years ago

Oh, looks like there's a Rails 7 / RailsAdmin v3 pull request I didn't see... Check out #26 - does that help? If so, I'll merge it in and release a new version!

edooley commented 2 years ago

Good catch @rikkipitt ! I can now see the Rollback column and "View Changes" link in each row, but it isn't launching the popup. When I visit the path it is referencing I can see the <table> with the changes it would return. I also noticed the attribute is data-url instead of data-link that is found on other rails_admin inline popups. Changing the attribute name in the browser source did not seem to make a difference when clicking though. Thoughts? Thanks!

rikkipitt commented 2 years ago

Hey @edooley I've got a local testbed set up so I can figure out what's going on. v3 of RailsAdmin looks completely different and I think I'll need to match the new layout/styling as well as fixing the main issue.

At the moment, on the branch by @pondpaun7z, I can't see any of the paper_trail versions in the table.

The history tab shows up on individual records, but is missing from the main dashboard.

rikkipitt commented 2 years ago

Update: I was missing some config! I forgot to enable Devise and PaperTrail within RailsAdmin itself. I'm now at the same point as you @edooley, I can see changes, but the JS is failing to trigger the modal. I will review it now!

oloomoses commented 1 year ago

Hi @rikkipitt, I have created this PR and I believe it solves this issue. Kindly look into it and let me know your thoughts. Thanks