mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-19 14:26:14 -04:00
Show member plantings summary on member page
This commit is contained in:
@@ -23,10 +23,24 @@ class MembersController < ApplicationController
|
||||
|
||||
@activity = TimelineService.member_query(@member).limit(30)
|
||||
|
||||
# The garden form partial is called from the "New Garden" tab;
|
||||
# it requires a garden to be passed in @garden.
|
||||
# The new garden is not persisted unless Garden#save is called.
|
||||
@garden = Garden.new
|
||||
@late = []
|
||||
@super_late = []
|
||||
@harvesting = []
|
||||
@others = []
|
||||
|
||||
@member.plantings.active.annual.each do |planting|
|
||||
if planting.finish_is_predicatable?
|
||||
if planting.super_late?
|
||||
@super_late << planting
|
||||
elsif planting.late?
|
||||
@late << planting
|
||||
elsif planting.harvest_time?
|
||||
@harvesting << planting
|
||||
else
|
||||
@others << planting
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
|
||||
42
app/views/members/_full_summary.html.haml
Normal file
42
app/views/members/_full_summary.html.haml
Normal file
@@ -0,0 +1,42 @@
|
||||
- if current_member.plantings.active.empty?
|
||||
%p
|
||||
#{@sitename} lets you track what food you're growing
|
||||
in your garden and see what other people near you are planting too.
|
||||
%p
|
||||
#{link_to "Get started now", new_planting_url} by planting your first crop.
|
||||
|
||||
- else
|
||||
- if @harvesting.size.positive?
|
||||
%section.harvests
|
||||
%h2 Ready to harvest
|
||||
.index-cards
|
||||
- @harvesting.each do |planting|
|
||||
= render 'plantings/thumbnail', planting: planting
|
||||
- if @others.size.positive?
|
||||
%section.planting-progress
|
||||
%h2 Progress report
|
||||
%p Still growing
|
||||
- @others.each do |planting|
|
||||
.row
|
||||
.col-2= render 'plantings/tiny', planting: planting
|
||||
.col-10= render 'plantings/progress', planting: planting
|
||||
- if @late.size.positive?
|
||||
%section.late
|
||||
%h2 Late
|
||||
%p
|
||||
These plantings are at the end of their lifecycle.
|
||||
- if member_signed_in? && @member == current_member
|
||||
When you have removed the planting from your garden, mark the planting as finished in Growstuff.
|
||||
.index-cards
|
||||
- @late.each do |planting|
|
||||
= render 'plantings/thumbnail', planting: planting
|
||||
- if @super_late.size.positive?
|
||||
%section.superlate
|
||||
%h2 Super late
|
||||
%p
|
||||
We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking.
|
||||
%ul
|
||||
- @super_late.each do |planting|
|
||||
%li
|
||||
= link_to planting.crop_name, planting_url(slug: planting.slug)
|
||||
planted on #{planting.planted_at.to_date}
|
||||
@@ -18,8 +18,9 @@
|
||||
.col-md-2
|
||||
.card
|
||||
.card-body
|
||||
= render "avatar", member: @member
|
||||
= render "bio", member: @member
|
||||
.row
|
||||
.col= render "bio", member: @member
|
||||
.col= render "avatar", member: @member
|
||||
%p
|
||||
- @member.roles.each do |role|
|
||||
%span.badge.badge-info= role.name.titleize
|
||||
@@ -61,6 +62,7 @@
|
||||
|
||||
.col-md-10
|
||||
%section= render "map", member: @member
|
||||
= render 'members/full_summary', member: @member
|
||||
%section.activity
|
||||
%h2 Activity
|
||||
.list-group
|
||||
|
||||
Reference in New Issue
Block a user