Commit Graph

260 Commits

Author SHA1 Message Date
google-labs-jules[bot]
c45b75a967 feat: Add nutritional data partial to crops and harvests
This commit introduces a new partial to display nutritional data from the Australian Food Composition Database.

Key changes:
- Adds a database index to the `public_food_key` on the `crops` table.
- Establishes a `has_one` relationship between `Crop` and `AustralianFoodClassificationData`.
- Creates a `_nutritional_data.html.haml` partial to display a summary of key nutritional information.
- Renders the partial on the `show` pages for both crops and harvests.
2025-12-01 12:53:03 +00:00
google-labs-jules[bot]
13a8276313 Add version tracking to crops model (#4343)
* 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>
2025-11-30 14:47:46 +10:30
Daniel O'Connor
cef23b8212 More recursive companions 2025-11-29 08:55:29 +00:00
Daniel O'Connor
ba9117db4d I have added the before_destroy callback to the Crop model to destroy all CropCompanion records where the crop is crop_b. (#4266)
I have added a new test to `spec/models/crop_spec.rb` to verify that deleting a crop also destroys the associated `CropCompanion` records.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-11-29 15:32:47 +10:30
google-labs-jules[bot]
684768ba5c feat: Add YouTube video to crop page
This commit introduces the following changes:

- Adds an `en_youtube_url` attribute to the `Crop` model to store a URL for an English language YouTube video.
- If a `en_youtube_url` is present for a crop, the video is embedded on the crop's show page.
- A link is added to the "Learn more" section of the crop's show page to search YouTube for "growing [crop name]".
- A helper method is added to extract the video ID from various YouTube URL formats.
- A validation is added to the `Crop` model to ensure that the `en_youtube_url` is a valid YouTube URL.
2025-11-29 03:40:59 +00:00
google-labs-jules[bot]
449ab1f6c0 Add ability to create companion plantings
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.
2025-09-21 00:49:11 +00:00
Daniel O'Connor
a098328e4e Rubocop 2025-09-20 10:16:16 +00:00
Daniel O'Connor
1f0cfa9b6c Add GBIF to our scientific names, so that our crops can associate creative commons photos (#3559)
* Add GBIF cient

* Add lookup

* Add autocomplete for GBIF lookup

* Add extra detail to scientific names

* Autocomplete

* Add routes

* Rmeove mapping

* Add autocomplete

* Update GBIF data on save

* db/schema

* Style

* Extract service

* Add concern

* Add concern

* Save photos

* Initial coverage

* Coverage

* Add coverage

* Shut up, codeclimate

* Shut up, codeclimate

* Unused

* Shut up, codeclimate

* Apply suggestions from code review

* Remove localhost

* Fix rubocop

* Fix rubocop

* Add UI links

* Add rake

* Indent

* Update Gemfile.lock

* Update lib/tasks/gbif.rake

* Update app/views/crops/_scientific_names.html.haml

* Rubocop

* Expand edit photo form

* Fix error

* Add model validations

* Skip photos without backlinks

* Fix tests

* Add photo words

* Allow blank

* Rubocop and handle invalid legacy data

* Apply suggestions from code review

* Update lib/tasks/gbif.rake
2024-01-21 13:22:25 +10:30
Daniel O'Connor
5722bfec59 Validate uniquness of name in the pending queue 2023-03-13 07:58:11 +00:00
Brenda Wallace
9dbf8b7c8f New robocops 2020-08-26 12:36:58 +12:00
codefactor-io
4ff95fbac9 [CodeFactor] Apply fixes 2020-01-21 22:26:08 +13:00
codefactor-io
7e30b6b6e0 [CodeFactor] Apply fixes 2020-01-03 11:28:51 +00:00
Brenda Wallace
ff883db279 Revert "displays photos without hitting the database"
This reverts commit 139574c9c0.
2020-01-02 20:23:13 +13:00
Brenda Wallace
139574c9c0 displays photos without hitting the database 2020-01-01 14:15:04 +13:00
Brenda Wallace
676345815c tests for photos searching 2019-12-31 21:02:38 +13:00
Brenda Wallace
39d208dec1 Rename the search concens 2019-12-25 14:26:50 +13:00
codefactor-io
e8760f9c38 [CodeFactor] Apply fixes 2019-12-20 03:33:23 +00:00
Brenda Wallace
04fd1a343a Rubocop update (#2334)
* Update rubocop config

* Rubocop update - for rubocop 0.77

* [CodeFactor] Apply fixes

* rubocop fixes

* [CodeFactor] Apply fixes to commit 2826c2e
2019-12-16 22:35:33 +13:00
Brenda Wallace
7c38f7eca6 Pull homepage data directly from elasticsearch (#2316)
* Pull homepage data directly from elasticsearch

* Removing non-elasticsearch options

* [CodeFactor] Apply fixes to commit c46b2e7
2019-12-09 10:03:48 +13:00
Brenda
56cb291508 Little bit less queries to look up sci name 2019-12-04 21:02:33 +13:00
Brenda Wallace
b0c8b11246 📝 Inline editing and display tidy ups (#2200)
* Inline editing and display tidy ups
2019-10-08 11:06:53 +13:00
Brenda Wallace
7b5698f977 👩‍🌾 Import openfarm data (#2177)
* Pull in openfarm icons, photos, info
* Truncating member location
* tidying up harvest display, and reducing duplication in css styles
* Tiny crop chip
* only show crop charts if there is data to show
* Make the styles more Growstuff
* Fixed links to openfarm
* Updating specs to cope with new photo sources
fix broken garden timeline on some pages
* Update homepage blurb
* Import crop companions
* More fluid page
* use thumbnail unless the source is flickr
* Messing with homepage
* Added crop growing_degree_days
* expect full size url on photos helper spec
* formatted dates from seeds#show
* tidy up places#show
* Move progress bar
* Quicker buttons for approve/reject crops
* Remove kaminari gem
* use crop cards on hierarchy page
* more crops on crops#index
* Wrap photo creation in transaction
* Wrap crop companions in a transaction
2019-09-28 17:23:25 +12:00
Brenda Wallace
6a4158ae04 👭 Crop companions (#2176)
* Crop companions
* Use a nil license to mean no licence
* dependent for crop->crop_companions relationship
* Fix crop detail spec
2019-09-28 10:38:01 +12:00
Brenda Wallace
9c0c0eeb18 Merge branch 'dev' into post-comments 2019-09-27 08:13:33 +12:00
Brenda Wallace
99e2ca4920 If a crop is deleted, delete association (gerund) records too 2019-09-27 08:13:07 +12:00
Brenda Wallace
fab9560c46 Apply suggestions from code review 2019-09-22 13:22:02 +12:00
Brenda Wallace
90035e79b8 Crop to post relationship made more rails standard 2019-09-22 10:07:50 +12:00
Brenda Wallace
5d7ef7e861 rubocop lint 2019-08-10 17:30:41 +12:00
Brenda Wallace
d4644ccdf8 Added join to members to fix error caused by discard gem 2019-08-10 11:37:52 +12:00
Brenda Wallace
5226eadfd8 fix crop join to members 2019-08-10 11:07:12 +12:00
Brenda Wallace
548bbf5e57 Merge remote-tracking branch 'upstream/dev' into renamed-photographings-associations
Conflicts:
	db/schema.rb
2019-07-16 12:12:16 +12:00
Brenda Wallace
e5e54d651b Remove duplicate and unused photo methods 2019-07-15 11:58:46 +00:00
Brenda Wallace
acf58fc5e2 Choose crop photos by most liked 2019-07-15 11:58:46 +00:00
Brenda Wallace
e0e10c29dc Renaming photographings to photo associations
now it matches the name of its controller, and it is clearer to understand
2019-07-13 16:13:37 +12:00
Brenda Wallace
474732f909 Fix sql warning in logs 2019-06-26 09:05:14 +12:00
Brenda Wallace
ef91e26d28 rubocop lint fixes 2019-06-16 10:31:03 +12:00
Brenda Wallace
9e1d531de9 nil for perennial doesn't mean annual 2019-06-07 20:44:30 +12:00
Brenda Wallace
e029425785 Lint 2019-05-13 07:58:05 +12:00
Brenda Wallace
302e19776f code style fix up 2019-04-08 21:39:20 +12:00
Brenda Wallace
77d1fc7347 Move crop searching specs from the crop model to the crop search service 2019-04-08 21:39:20 +12:00
Brenda Wallace
ca743e421d Add matching ES methods for when no elastic search configured 2019-04-08 21:39:20 +12:00
Brenda Wallace
370747390a Add default pagination to crop search service 2019-04-08 21:39:20 +12:00
Brenda Wallace
61e0c2eb1d Swap elasticssearch for searchkick 2019-04-08 21:39:20 +12:00
Brenda Wallace
6a1954b1e7 added dependent: destroy 2019-02-04 21:22:19 +13:00
Brenda Wallace
f1ad9cc3c7 Rubocop fix up 2019-02-04 20:55:04 +13:00
Brenda Wallace
a9ca12c1c5 Method to find planting photos only 2019-02-04 19:39:44 +13:00
Brenda Wallace
e3a0de081e Merge branch 'dev' into photos/seeds 2019-01-30 16:46:42 +13:00
Brenda Wallace
1660629cf9 DRY crop.interesting? 2019-01-06 08:45:42 +13:00
Brenda Wallace
1e266a92f6 Members slug used in rotes 2019-01-06 08:45:42 +13:00
Brenda Wallace
b13ddf9c92 Add photos of seeds 2019-01-04 22:21:48 +13:00