This commit configures the sitemap generation process to upload the sitemap to an S3 bucket instead of the local filesystem.
It introduces the `aws-sdk-s3` gem to handle the S3 communication. A new configuration file, `config/sitemap.rb`, has been added to define the S3 adapter and specify the models to be included in the sitemap. The S3 bucket, access keys, and region are configured via environment variables.
* feat: Add data improvement page to crops controller
This commit introduces a new data improvement page to the crops controller. The page displays tabbed lists of crops with missing data, allowing users to easily identify areas for data quality improvement.
The following data quality categories are included:
- Crops without photos
- Crops without descriptions
- Crops without a youtube video
- Crops without alternate names
- Crops without a scientific name with a wikidata id
- Crops without row spacing
- Crops without sun requirements
- Crops without height
All lists are sorted by planting count in descending order.
* refactor: Optimize data improvement page to load tab data on demand
This commit refactors the data improvement page to load data for each tab on demand, rather than loading all queries at once. This improves the performance of the page by only executing the query for the currently active tab.
The controller action now uses a `case` statement based on a `tab` URL parameter to execute the appropriate query. The view has been updated to pass this parameter when a tab is clicked.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.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>
* 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.
* 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>
This commit adds instructions for mobile users on how to install the Growstuff website as a Progressive Web App (PWA).
The changes include:
- A new section on the homepage with instructions for both iOS and Android devices. This section is only visible to logged-out users.
- New translations for the instructions in the `en.yml` locale file.
- Basic styling for the new section.
- Updated feature tests to verify the new section's visibility.
This change removes the twitter authentication feature from the application.
It removes the `omniauth-twitter` gem and all related code from controllers, views, and tests. It also removes the twitter icon and environment variable settings.
* 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?
* 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
* Register mime type
* Add rough first pass
* Index predictions, and add links
* Trailing space
* Fix implementation
* Fix names, make public
* Fix names, make public
* Fix
* Fix tyyos
* Add date
* If there are no predictions, keep growing
* Add a todo
* Fix factories
* Specs
* For now, drop mapbox for OSM tiles
* For now, drop mapbox for OSM tiles
* Use OSM tiles
* Remove mapbox secrets for now. If we bring back mapbox; we should re-enstate
* Only show up to 200 plantings
* Update app/assets/javascripts/members.js.erb
* [CodeFactor] Apply fixes
* Update production.rb
---------
Co-authored-by: codefactor-io <support@codefactor.io>
* Add missing migration for #3247
* [CodeFactor] Apply fixes
* Update 20230313015323_create_active_storage_tables.active_storage.rb
* Rubocop
* Permit a number of safe classes to serialise as YAML
---------
Co-authored-by: codefactor-io <support@codefactor.io>
* For now, drop mapbox for OSM tiles
* For now, drop mapbox for OSM tiles
* Use OSM tiles
* Remove mapbox secrets for now. If we bring back mapbox; we should re-enstate
* Update members.js.erb
* Change placeholder