1185 Commits

Author SHA1 Message Date
Daniel O'Connor
d0ca944899 Relax the criteria as photos are uploaded less often 2025-12-13 01:15:02 +00:00
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]
620337fbac Merge pull request #4353 from Growstuff/feat/import-australian-food-data
Add Rake Task to Import Australian Food Data
2025-12-01 19:43:14 +10:30
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
Daniel O'Connor
0a89ac7e28 Merge pull request #4331 from Growstuff/feature/migrate-crop-description
feat: Migrate crop description to a dedicated column
2025-11-29 14:49:24 +10:30
google-labs-jules[bot]
8f6738eefa feat: Migrate crop description to a dedicated column
This change migrates the crop description from the `openfarm_data` JSONB field to a new, dedicated `description` text column in the `crops` table.

A data migration is included to move the existing description data to the new column. The `OpenFarmData` concern is updated to remove the now-redundant `description` method.
2025-11-29 04:07:25 +00:00
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
Daniel O'Connor
488e402a3a Adjust copy of activities and prompts (#4260)
* Adjust copy

* Adjust copy

* Move repeat prompt

* Improve prompts

* Clean up schema

* Fix spec
2025-09-21 14:58:13 +09:30
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
bd4dd3cc45 Rubocop 2025-09-20 10:18:24 +00:00
Daniel O'Connor
a098328e4e Rubocop 2025-09-20 10:16:16 +00:00
Daniel O'Connor
54acc369ab Rubocop 2025-09-20 09:43:22 +00:00
google-labs-jules[bot]
02db5b8130 Add API token generation, authentication, and CRUD for a number of the API resources (#4237)
* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* Mark as editable

* Refactor

* WIP - Authentication

* Implement more test coverage

* Split 401 and 403

* Before Create hooks

* Update harvest specs, defaulting to the first plant part - this may not be right

* Update coverage

* Update coverage

* Rubocop

* Rubocop

* Rubocop

* Fix coverage

* For now, mark photos immutable again

* Fix specs

* Fix specs

* Rubocop

* Fix 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>
2025-09-10 19:50:06 +09:30
Daniel O'Connor
b2e959aded Delegate 2025-09-09 12:44:40 +00:00
Daniel O'Connor
2f0b8e9d76 Add aliases 2025-09-09 12:40:06 +00:00
Daniel O'Connor
fb78bcb0b0 Add aliases 2025-09-09 12:36:22 +00:00
google-labs-jules[bot]
bc11a1b8db Merge pull request #4209 from Growstuff/extend-crop-model
Extend Crop Model and Migrate Data from OpenFarm
2025-09-07 20:03:18 +09:30
Daniel O'Connor
9b1699b061 Merge pull request #4215 from Growstuff/activities-detail
Surface more Activities detail
2025-09-07 14:39:13 +09:30
Daniel O'Connor
b3ba05d834 Fix crash on adding Flickr photo (#4198)
* Update photo.rb

* Update photo.rb

* Update app/models/photo.rb

* Update app/models/photo.rb
2025-09-02 02:17:28 +09:30
Daniel O'Connor
c189e3b01a Merge pull request #4062 from Growstuff/feature/planting-rating
Add overall_rating to Plantings
2025-09-01 23:56:13 +09:30
google-labs-jules[bot]
0f4803392d Add seed source to Seed model (#4186)
* Add seed source to Seed model

* Update _form.html.haml

* Add to schema

* Default option

* Default option

* Fix test

---------

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-09-01 21:47:31 +09:30
Daniel O'Connor
0289786891 Seeds for trade - avoid showing expired seeds on homepage. (#4176)
* Improve date visibility

* Ensure when seeding seeds, it's false

* Typo
2025-08-31 14:39:42 +09:30
Daniel O'Connor
7c081541eb Deal with age_in_days.nil? 2025-08-29 23:46:27 +09:30
Daniel O'Connor
8044640023 Merge branch 'dev' into remove-openfarm.cc 2025-08-29 19:56:09 +09:30
google-labs-jules[bot]
4d3c4ca10d Merge pull request #4154 from Growstuff/finish-expired-seeds-task
Add maintenance task to finish expired seeds
2025-08-28 00:16:16 +09:30
Daniel O'Connor
1657a527e9 Remove Openfarm data fetching 2025-08-27 14:20:22 +00:00
Daniel O'Connor
9ae90c1b7e Merge branch 'dev' into remove-openfarm.cc 2025-08-27 23:43:29 +09:30
google-labs-jules[bot]
ba6ec689c5 Merge pull request #4150 from Growstuff/feature/failed-plantings
Add failed status to plantings
2025-08-27 23:42:53 +09:30
Daniel O'Connor
fadf5154e4 Remove openfarm links (defunct) 2025-08-27 14:11:01 +00:00
Daniel O'Connor
948bb78656 Fix percentage grown 2025-08-27 13:44:44 +00:00
Daniel O'Connor
9c8ae50188 Fix https://github.com/Growstuff/growstuff/issues/3844 by avoiding future finished dates being considered past dates 2025-08-27 13:36:12 +00:00
google-labs-jules[bot]
a98990ccd2 Add transplant feature for plantings (#4133)
* Add ability to transplant a planting

* Fix view tests

* Transplantable gardens

* Add spec

---------

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-08-24 22:31:14 +09:30
google-labs-jules[bot]
ac1463e2cf Add international alternate names for crops (#4132)
* I will add the international alternate names for the crops.

* Mark required

* Update factory

* Add placeholder

* Fix seeds

* Add language, though hardcoded to EN in most places

---------

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-08-24 21:44:41 +09:30
google-labs-jules[bot]
8564ec7a7c Add comments to photos (#4130)
* Add comments to photos

Extend the photo show page to support comments by logged in users.

- Make the Comment model polymorphic.
- Update the Photo and Post models to have comments.
- Update the comments controller to handle the polymorphic association.
- Update the photo show page to display comments and a comment form.
- Create a reusable comments partial.

* Add migration

* Fix tests

* Fix tests

* Slightly fix tests

* Fix variables

* Add field

* Refactor slightly

* Refactor slightly

* Refactor slightly

* Refactor

* Photos respond to this as well

* Refactor to polymorphic_url

* Rename

* Wrong relationship

* Refactor and fix tests

* Fix relationships

* Fix rendering

* Fix tests

* Fix model tests

* Fix test

* Fix test

* Fix test

* Fix test

* Fix controller spec

* Fix view tests

---------

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-08-24 21:10:16 +09:30
google-labs-jules[bot]
76a6c1d849 Merge pull request #4131 from Growstuff/feature/add-social-media-links
feat: Add social media links to user profiles
2025-08-24 16:21:05 +09:30
Daniel O'Connor
2484bd39ed Render where a planting is in card view (#3882)
* Render where a planting is in card view

* Update app/assets/stylesheets/_plantings.scss
2024-10-13 14:25:46 +10:30
Daniel O'Connor
1c97ba1495 Garden collaboration (small part of community gardens) (#3862)
* Add collaboration model

* Permissions and garden show

* List by owner, or where I am a collaborator

* Add index

* Add permissions

* Typo

* Typo

* Add route

* Update schema

* Update schema

* Add CRUD

* Add CRUD

* Add CRUD

* Factory

* Add validations

* Rubocop

* Rubocop

* Rubocop

* Unique index

* Fix

* Make CI more fine grained for faster feedback

* Swap order

* Fix path, fail-fast

* Fix spec

* Remove 'significant drop in coverage' as not everything runs in one giant run

* Fix tests?
2024-09-29 18:28:52 +09:30
Daniel O'Connor
c28b2c0c38 Likes: Add capability to Activities, Plantings, Harvests (#3805)
* Ability to like activities

* Ability to like activities

* Add likeable everywhere

* Refactor

* Remove extra newline

* Typo

* Use classes, not IDs

* Explicitly wait for ajax

* Fix tests

* Move likes under owner

* Add separation

* Move harvest likes near actions

* Rearrange harvests

* Render likes under owner

* Make harvest consistent with other views

* Move planting detail into header

* Move detail into header

* Move detail into header

* Revert

* Fix header

* Move likes into jumotrons

* Fix name

* Change all actions to be after likes and a span

* Cleanup

* Cleanup

* Cleanup

* Cleanup

* i18n and accessibility

* Fix name

* Temporarily make ack into a div

* Update app/views/photos/_actions.html.haml
2024-07-24 17:07:56 +09:30
Daniel O'Connor
81060cccf7 Ruby 3.2: Rubocop - Lint/* and Style/* (#3786)
* Rubocop - Layout/*
* Rubocop - Lint and Style
2024-07-13 15:38:37 +09:30
Daniel O'Connor
4f5c47ba58 Ruby 3.2: Rubocop - Layout/* (#3785)
* Rubocop - Layout/*

* Regenerate
2024-07-13 15:19:09 +09:30
Daniel O'Connor
57f1fd34c9 Update garden.rb 2024-07-02 23:08:29 +09:30
Daniel O'Connor
067fb1671b Update predict_planting.rb 2024-07-02 23:07:48 +09:30
Daniel O'Connor
fa6df64221 Update garden.rb 2024-07-02 22:42:35 +09:30
Daniel O'Connor
3d524bb105 Update garden.rb 2024-07-02 17:37:17 +09:30
Daniel O'Connor
26189855cc Reduce visual impact of hover, and make snappier (#3712)
* Reduce visual impact of hover, and make snappier

* Better seed

* Improve seeding

* Fix codespaces login
2024-04-07 22:17:16 +09:30
Daniel O'Connor
725c146e2d Improve profile page on mobile (#3711)
* Avoid showing when there are 0 things

* Styling

* Styling

* Collapse stats by default on small screens

* Add ARIA skip links

* Refactoring out of partial, and use CSS to set order on mobile

* Remove partial

* Update expectations

* Fix visual appearance on Ban button on your own profile for admins

* Typo

* Stale expectation
2024-04-07 21:43:52 +09:30
Daniel O'Connor
5be0153c74 Activities (#3646)
* Implement activities

* Add activities to timeline

* Add factory

* Add coverage

* Fix misc issues

* Activities display

* Add activities to garden and plantings

* Add activities to garden and plantings

* Add planting

* Add to planting, harvest show

* More CRUD

* More CRUD

* index

* index

* Extract card view

* Permissions

* Add edit

* Remove workaround fro vs code

* Fix title

* CSV

* CSV

* Add RSS, ical

* Extend ical slightly

* Cleanup

* Rubocop

* Remove doubled form

* Change icon

* Fix short description

* Add menus

* Put homepage widget in

* Add activity icon - MIT licenced - https://www.svgrepo.com/svg/336823/plan

* Naming

* Missing files

* Revert VS Code lag induced change

* Update app/views/home/_harvests.html.haml

* Update activities_controller.rb

* Update activities_controller.rb

* Update app/controllers/activities_controller.rb

* Update index.html.haml

* Apply suggestions from code review

* Apply suggestions from code review

* Typo

* Translation

* Apply suggestions from code review

* Update app/views/plantings/index.ics.erb

* Update app/models/activity.rb

* Update plantings_spec.rb

* Update plantings_spec.rb

* We are now rendering an extra event, so check the next one for the old behaviour
2024-03-10 11:36:24 +10:30
Daniel O'Connor
cb670191d6 Merge pull request #3645 from Growstuff/planning
Planning future plantings - Minor UX changes
2024-03-01 06:27:32 +10:30