* feat(admin): add revert functionality to crops page
This change adds a "Revert" button to the admin crops page, allowing crop wranglers to revert changes to a previous version.
It introduces a new `Admin::VersionsController` with a `revert` action that uses `paper_trail`'s `reify` method to restore a previous version of a `Crop` object.
The view is updated to include a "Revert" button, which is guarded by a `can?(:wrangle, Crop)` check to ensure only authorized users can see it.
The controller also includes an authorization check to prevent unauthorized users from accessing the revert action directly.
A feature spec is added to test the new functionality, including the authorization logic.
* Consistent UX
* Specs
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
* feat: Add version tracking to Crop model
This commit introduces version tracking for the Crop model using the PaperTrail gem.
Key changes include:
- Integrating `has_paper_trail` into the `Crop` model.
- Adding a "History" section to the crop show page to display a timeline of changes for that specific crop.
- Creating a new admin page for users with the "crop_wrangler" role to view a log of all recent crop edits, creations, and deletions.
- Fixing several N+1 query performance issues by eager-loading associated `Member` records in both the `CropsController` and the new `Admin::CropsController`.
- Refactoring view logic into a shared partial to reduce code duplication.
* Add papertrail
* Admin UI
* Add papertrail DB
* Add papertrail DB
* Rearrange
* Fix permissions
* Fix permissions
* Fix UI
* Fix UI
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
This change adds the ability for crop wranglers to create and manage companion plantings for crops.
- Adds a `source_url` to the `CropCompanion` model to store an optional reference URL.
- Restricts the management of companion plantings to users with the `crop_wrangler` role.
- Creates a new admin interface for managing companion plantings for a specific crop.
- Updates the crop show page to display companions from both the crop and its parent crop.