Skip to content

Conversation

@CloCkWeRX
Copy link
Collaborator

@CloCkWeRX CloCkWeRX commented Nov 30, 2025

  • Schema.org detail on crop pages
  • Encourage users to contribute
  • Add revert tools for wranglers
  • Wikidata on scientific names CRUD

CloCkWeRX and others added 24 commits November 29, 2025 19:53
This commit introduces a series of changes to encourage user contributions for missing crop data.

On the crop show page, it adds links for logged-in users to:
- Add a description if one is not present.
- Add a YouTube video if one is not present.
- Add more attributes in the predictions section if any are missing.

On the crop edit page, the form now conditionally displays fields. For standard users, it only shows fields for attributes that are currently empty. For privileged users (wranglers), it displays all fields, allowing them to edit existing data.
Adds schema.org markup to the crop pages using the BioChemEntity type. The taxonomicRange attribute is used to list the scientific names of the crop, which will improve SEO.
Add Contribution Links and Conditional Edit Form
This commit introduces the ability to store and display the Wikidata ID for scientific names.

Changes include:
- A database migration to add the `wikidata_id` column to the `scientific_names` table.
- An update to the `scientific_names_controller` to permit the `wikidata_id` parameter.
- An update to the scientific name form to include a field for the Wikidata ID.
- An update to the crop show page to display a link to the Wikidata page for a scientific name.
Allow Wikidata ID to be set when editing a scientific name
…ps-page

Add schema.org markup to crop pages
* 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>
* 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>
@CloCkWeRX CloCkWeRX merged commit 8ddc717 into mainline Nov 30, 2025
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants