Files
growstuff/app/views/home/dashboard/_this_week.html.haml
T
Brenda WallaceandDaniel O'Connor 75595350bc Easier recording of harvests from the front page (#5077)
* Implement AddSeedsPicker component and enhance planting selection UI; update styles and serializers for better seed management

* Enhance PlantingPicker component: add hints and titles for harvest and seed actions; update test to reflect changes in seed saving behavior

* Enhance harvest recording: allow harvesting from crops without plantings; update forms and modals for better user experience

* Refactor code structure for improved readability and maintainability

* Remove AddSeedsPicker component and its associated tests

* Add planting picker functionality for harvesting and seed saving

- Introduced PlantingPickersController to handle JSON responses for member's plantings.
- Updated HomeHelper to include crop ID in planting picker properties.
- Refactored PlantPicker and PlantSomethingModal components to support multiple gardens.
- Created PlantingFlow component to manage planting actions (harvest and save seeds).
- Implemented RecordDialog component to handle server-rendered links for harvesting and seed saving.
- Updated various views to include data attributes for triggering the record dialog.
- Added routes for planting picker and corresponding request specs for testing.
- Adjusted styles in _plantings.scss for better layout and spacing.

* Add job management features including job creation and wishlist functionality

* Remove WishlistJobsController and associated views and tests

* Add suggestion links rendering and fix routes formatting

* Refactor AddJobModal and JobPicker components to simplify props and enhance user experience

* Update seed addition test to check dialog presence and current path

* Apply suggestion from @CloCkWeRX

---------

Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2026-10-26 21:38:12 +10:30

31 lines
1.8 KiB
Plaintext

-# One thing worth doing this week: pick what is ready, or else sow something
-# gardeners at this latitude are sowing now.
- ready = dashboard.ready
- suggestion = dashboard.suggested_crop if ready.empty?
- if ready.any? || suggestion
.home-this-week
- lead = ready.any? ? ready.first : nil
= image_tag((lead&.thumbnail_url || suggestion&.default_photo&.thumbnail_url || placeholder_image), alt: '', class: 'home-this-week-photo')
.home-this-week-text
%small= t('home.dashboard.this_week')
- if ready.any?
%b= t('home.dashboard.ready_title', count: ready.size)
%span
= ready.first(5).map(&:crop_name).uniq.to_sentence
= link_to t('home.dashboard.see_which'), '#growing-now'
- else
%b= t('home.dashboard.sow_title', crop: suggestion.name, month: current_month_name)
%span= t('home.dashboard.sow_body')
- if suggestion.median_days_to_first_harvest
%span= t('home.dashboard.sow_harvest', date: l(Time.zone.today + suggestion.median_days_to_first_harvest, format: '%-d %B'))
= render 'home/dashboard/suggestion_links'
- if ready.any?
= react_component('PlantingPicker', { action: 'harvest', label: t('home.dashboard.record_harvests'), buttonClass: 'btn btn-warning', plantings: planting_picker_props(dashboard) })
- else
.home-this-week-actions
= plant_picker(dashboard, crop: suggestion, label: t('home.dashboard.plant_crop', crop: suggestion.name), button_class: 'btn btn-success')
= render 'home/dashboard/not_for_me', crop: suggestion, button_class: 'btn btn-link home-dismiss'
-# Only the way back from switching suggestions off; the crops they hid stay hidden.
- if ready.empty? && !dashboard.suggestions_enabled?
= render 'home/dashboard/hidden_suggestions', dashboard: