mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-31 03:09:06 -04:00
- Introduced crop suggestions functionality allowing users to receive tailored crop recommendations based on their location and preferences. - Implemented the ability for users to dismiss specific crop suggestions, preventing them from receiving recommendations for crops they are not interested in. - Added a location picker for users to set their gardening location, enhancing the accuracy of crop suggestions. - Enhanced the dashboard to display relevant statistics, including plantings and harvests, with comparisons to previous years. - Created new views and partials for displaying statistics, crop suggestions, and user interactions on the dashboard. - Updated routes to accommodate new features related to crop suggestions and member locations. - Added migrations for new database tables and columns to support crop dismissal and suggestion preferences. - Developed tests for the new features, ensuring functionality and user experience are maintained.
20 lines
620 B
Ruby
20 lines
620 B
Ruby
# frozen_string_literal: true
|
|
|
|
# "Not for me" on a suggested crop: the home page stops suggesting it, until
|
|
# they ask for their hidden suggestions back.
|
|
class CropDismissalsController < ApplicationController
|
|
skip_authorize_resource
|
|
before_action :authenticate_member!
|
|
|
|
def create
|
|
crop = Crop.approved.find(params.require(:crop_id))
|
|
current_member.crop_dismissals.find_or_create_by!(crop:)
|
|
redirect_back_or_to root_path, notice: t('.dismissed', crop: crop.name)
|
|
end
|
|
|
|
def destroy_all
|
|
current_member.crop_dismissals.destroy_all
|
|
redirect_back_or_to root_path, notice: t('.restored')
|
|
end
|
|
end
|