Commit Graph

4468 Commits

Author SHA1 Message Date
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
474f09e110 Merge pull request #4332 from Growstuff/crops-controller
Add coverage for crops
2025-11-29 15:32:08 +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
Daniel O'Connor
e0aaa9e44f Rearrange 2025-11-29 14:26:15 +10:30
google-labs-jules[bot]
73c7158454 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.
- The `en_youtube_url` is now an editable field in the crop form.
- 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:45:23 +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
d9851231f2 Merge pull request #4274 from Growstuff/CloCkWeRX-patch-3
API > Render activities links under member
2025-09-29 01:11:24 +09:30
Daniel O'Connor
81b80d9bb7 Update activity_resource.rb 2025-09-29 00:12:51 +09:30
Daniel O'Connor
f080a8a566 Update crop_resource.rb 2025-09-29 00:12:39 +09:30
Daniel O'Connor
5a436f9d7f Update garden_resource.rb 2025-09-29 00:12:32 +09:30
Daniel O'Connor
a4fd1c4a8e Update harvest_resource.rb 2025-09-29 00:12:27 +09:30
Daniel O'Connor
7277cb3523 Update seed_resource.rb 2025-09-29 00:12:07 +09:30
Daniel O'Connor
522d10e053 Update photo_resource.rb 2025-09-29 00:11:41 +09:30
Daniel O'Connor
f3a9b26c8e Update planting_resource.rb 2025-09-29 00:10:05 +09:30
google-labs-jules[bot]
d8f5580ef9 Extend planting API to render garden id in relationships 2025-09-28 14:39:33 +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]
e99c90adc4 Add recurring activities feature without database persistence (#4261)
* This change introduces a new feature that allows users to create recurring activities.

A user can now specify that an activity should be repeated "X" times, every "Y" weeks. When an activity is created with these options, the application will create the initial activity and then "X" additional copies, with each copy's due date offset by "Y" weeks from the previous one.

The repeat information is not stored in the database. It is only used at the time of creation to generate the recurring activities.

The following changes were made:
- Updated the new activity form to include fields for "repeat times" and "repeat weeks".
- Modified the `ActivitiesController#create` action to handle the creation of recurring activities.
- Added feature tests to ensure the new functionality works as expected.

* Remove not very useful 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-09-21 13:53:45 +09:30
google-labs-jules[bot]
41412b8443 Merge pull request #4262 from Growstuff/feature/github-releases-widget
feat: Add cached GitHub releases widget to homepage
2025-09-21 13:37:57 +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]
5db6a86607 Add ability to copy/duplicate an activity 2025-09-20 08:54:12 +00:00
Daniel O'Connor
ce7ce70d5f Merge pull request #4222 from Growstuff/feature/add-activity-prompts
feat: Add prompts for new activities
2025-09-20 17:49:47 +09:30
Daniel O'Connor
e5bf9d98e6 Rubocop (#4241) 2025-09-10 19:56:12 +09:30
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
e322871740 Fix UX 2025-09-09 12:49:17 +00:00
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]
e5c71f1dc4 Merge pull request #4230 from Growstuff/feature/add-more-filters
feat: Add more filters to API resources
2025-09-09 21:34:49 +09:30
Daniel O'Connor
a21a9e7a09 Update garden_resource to filter by owner 2025-09-08 17:38:03 +09:30
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
12f6b76dca Merge pull request #4223 from Growstuff/show-history
Render history of activities on gardens, plantings
2025-09-07 19:40:18 +09:30
Daniel O'Connor
798eb1132f Rubocop 2025-09-07 08:10:41 +00:00
Daniel O'Connor
42036a3d3f Fix logic 2025-09-07 08:07:21 +00:00
Daniel O'Connor
47da5f18c9 Merge branch 'dev' into deep-link 2025-09-07 17:35:57 +09:30
Daniel O'Connor
d22555ee42 Deep link to content when rating 2025-09-07 08:04:14 +00:00
Daniel O'Connor
d0f4911bf6 Merge pull request #4221 from Growstuff/CloCkWeRX-patch-3
Update _modal.html.haml to sort consistently
2025-09-07 17:30:17 +09:30
Daniel O'Connor
2bc164bd2e Render history 2025-09-07 07:59:51 +00:00
Daniel O'Connor
6f9fbfa3cd Merge pull request #4220 from Growstuff/CloCkWeRX-patch-2
Fix garden order on planting new
2025-09-07 17:19:05 +09:30
Daniel O'Connor
b0555ef89e Update _modal.html.haml to sort consistently 2025-09-07 17:12:14 +09:30
Daniel O'Connor
a5f9edea87 Merge pull request #4217 from Growstuff/skip-to-content
By default, skip to content when linking to garden(s)
2025-09-07 17:09:48 +09:30
Daniel O'Connor
3917f263b8 Fix garden order on planting new 2025-09-07 17:09:27 +09:30
Daniel O'Connor
3725957065 Only render if available 2025-09-07 05:34:49 +00:00
Daniel O'Connor
8fbc02caf3 Timeline 2025-09-07 05:20:35 +00:00
Daniel O'Connor
186f07109c Add skip link 2025-09-07 05:17:14 +00:00
Daniel O'Connor
b3c749566b More named anchors 2025-09-07 05:14:18 +00:00
Daniel O'Connor
1eb84b9765 By default, skip to content when linking to garden(s) 2025-09-07 05:11:30 +00:00