restore crops sidebar to match specs

This commit is contained in:
Brenda Wallace
2019-06-07 20:35:24 +12:00
parent b1b24f5e0a
commit ffeaa08ff7
3 changed files with 18 additions and 39 deletions

View File

@@ -1,11 +1,11 @@
%h4 #{crop.name.capitalize} harvests
%h3 #{crop.name.capitalize} harvests
- if crop.harvests.empty?
%p
Nobody has harvested this crop yet.
- else
%ul
%ul.list-group.list-group-flush
- crop.harvests.order(harvested_at: :desc).limit(3).each do |harvest|
%li
%li.list-group-item
= link_to "#{harvest.owner} harvested #{display_quantity(harvest)}.", harvest_path(harvest)
= render 'members/location', member: harvest.owner
%small
@@ -15,6 +15,6 @@
= link_to "View all #{crop.name} harvests", crop_harvests_path(crop)
- if crop.approved?
- if current_member
%p= link_to "Harvest #{crop.name}", new_harvest_path(crop_id: crop.id)
%p= link_to "Harvest #{crop.name}", new_harvest_path(crop_id: crop.id), class: 'btn'
- else
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} harvests" }

View File

@@ -1,20 +1,9 @@
%h4 See who's planted #{crop.name.pluralize}
- if crop.plantings.empty?
%p
Nobody has planted this crop yet.
- else
%ul
- crop.plantings.order(planted_at: :desc).limit(3).each do |planting|
%li
= link_to planting, planting_path(planting)
= render partial: 'members/location', locals: { member: planting.owner }
%small
= distance_of_time_in_words(planting.created_at, Time.zone.now)
ago.
%p
= link_to "View all #{crop.name} plantings", crop_plantings_path(crop)
- if crop.approved?
- if current_member
%p= link_to "Plant #{crop.name}", new_planting_path(crop_id: crop.id)
- else
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} plantings" }
%h3 See who's planted #{crop.name.pluralize}
%ul.list-group.list-group-flush
- crop.plantings.order(planted_at: :desc).limit(5).each do |planting|
%li.list-group-item
= planting_icon
= link_to planting do
= planting
- if planting.owner.location.present?
%small=planting.owner.location

View File

@@ -103,26 +103,16 @@
= link_to member_seeds_path(current_member, crop_slug: @crop.slug) do
= display_seed_availability(@current_member, @crop)
.card-body
= render 'scientific_names', crop: @crop
= render 'alternate_names', crop: @crop
.card-body
%h3 See who's planted #{@crop.name.pluralize}
%ul.list-group.list-group-flush
- @crop.plantings.order(planted_at: :desc).limit(5).each do |planting|
%li.list-group-item
= link_to planting do
= planting_icon
= planting
- if planting.owner.location.present?
%small=planting.owner.location
.card-body
= render 'scientific_names', crop: @crop
= render 'alternate_names', crop: @crop
= render 'plantings', crop: @crop
= render 'harvests', crop: @crop
%hr/
= render 'find_seeds', crop: @crop
%hr/
.card
.card-body
%h5.card-title Learn more about #{@crop.name.pluralize}