mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-06-06 07:07:33 -04:00
crops show sidebar tidy up harvests and plantings
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
%h3 #{crop.name.capitalize} harvests
|
||||
- if crop.harvests.empty?
|
||||
%p
|
||||
Nobody has harvested this crop yet.
|
||||
- else
|
||||
%ul.list-group.list-group-flush
|
||||
- crop.harvests.order(harvested_at: :desc).limit(3).each do |harvest|
|
||||
%li.list-group-item
|
||||
= link_to "#{harvest.owner} harvested #{display_quantity(harvest)}.", harvest_path(harvest)
|
||||
= render 'members/location', member: harvest.owner
|
||||
%small
|
||||
= distance_of_time_in_words(harvest.harvested_at, Time.zone.now)
|
||||
ago.
|
||||
%p
|
||||
= 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), class: 'btn'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} harvests" }
|
||||
.card
|
||||
.card-body
|
||||
%h3 #{crop.name.capitalize} harvests
|
||||
- if crop.harvests.empty?
|
||||
%p Nobody has harvested this crop yet.
|
||||
- unless crop.harvests.empty?
|
||||
%ul.list-group.list-group-flush
|
||||
- crop.harvests.order(harvested_at: :desc).limit(3).each do |harvest|
|
||||
%li.list-group-item
|
||||
= harvest_icon
|
||||
= link_to "#{harvest.owner} harvested #{display_quantity(harvest)}.", harvest_path(harvest)
|
||||
.float-right= render 'members/location', member: harvest.owner
|
||||
.harvest-timeago
|
||||
%small #{distance_of_time_in_words(harvest.harvested_at, Time.zone.now)} ago.
|
||||
.card-footer
|
||||
%p= 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), class: 'btn'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} harvests" }
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
%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
|
||||
.card
|
||||
.card-body
|
||||
%h3 See who's planted #{crop.name.pluralize}
|
||||
- unless crop.plantings.empty?
|
||||
%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, planting
|
||||
.float-right= render 'members/location', member: planting.owner
|
||||
.card-footer
|
||||
- if crop.approved?
|
||||
- if current_member
|
||||
%p= link_to "Plant #{crop.name}", new_planting_path(crop_id: crop.id), class: 'btn'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} plantings" }
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
- if can?(:edit, crop) || can?(:destroy, crop)
|
||||
%h4 Crop wrangling
|
||||
%p
|
||||
You are a
|
||||
= succeed "." do
|
||||
%strong CROP WRANGLER
|
||||
.dropdown.crop-actions
|
||||
%button#crop-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-button"}
|
||||
= link_to edit_crop_path(crop), class: 'dropdown-item' do
|
||||
= edit_icon
|
||||
= t('.edit')
|
||||
.alert.alert-success{role: "alert"}
|
||||
%h4 Crop wrangling
|
||||
%p
|
||||
You are a
|
||||
= succeed "." do
|
||||
%strong CROP WRANGLER
|
||||
.dropdown.crop-actions
|
||||
%button#crop-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-button"}
|
||||
= link_to edit_crop_path(crop), class: 'dropdown-item' do
|
||||
= edit_icon
|
||||
= t('.edit')
|
||||
|
||||
- if can? :destroy, crop
|
||||
.dropdown-divider
|
||||
= link_to crop, method: :delete, class: 'dropdown-item text-danger' do
|
||||
= delete_icon
|
||||
Delete
|
||||
- if can? :destroy, crop
|
||||
.dropdown-divider
|
||||
= link_to crop, method: :delete, class: 'dropdown-item text-danger' do
|
||||
= delete_icon
|
||||
Delete
|
||||
|
||||
@@ -106,9 +106,9 @@
|
||||
.card-body
|
||||
= render 'scientific_names', crop: @crop
|
||||
= render 'alternate_names', crop: @crop
|
||||
= render 'plantings', crop: @crop
|
||||
= render 'harvests', crop: @crop
|
||||
|
||||
= render 'plantings', crop: @crop
|
||||
= render 'harvests', crop: @crop
|
||||
= render 'find_seeds', crop: @crop
|
||||
|
||||
.card
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
-content_for(:buttonbar) do
|
||||
= render 'harvests/actions', harvest: @harvest
|
||||
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
%h1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.member-location
|
||||
%span.badge.badge-light.member-location
|
||||
- if member.location.blank?
|
||||
unknown location
|
||||
- else
|
||||
|
||||
2
app/views/members/_tiny.haml
Normal file
2
app/views/members/_tiny.haml
Normal file
@@ -0,0 +1,2 @@
|
||||
= link_to member do
|
||||
= image_tag(avatar_uri(member, 50), alt: '', class: 'img img-responsive avatar rounded')
|
||||
@@ -40,6 +40,4 @@
|
||||
%span.badge.badge-pill.badge-secondary Will trade #{seed.tradable_to}
|
||||
.card-footer
|
||||
%span.badge.badge-pill.badge-secondary=seed.owner.location
|
||||
%p.float-right
|
||||
= link_to seed.owner do
|
||||
= image_tag(avatar_uri(seed.owner, 50), alt: '', class: 'img img-responsive avatar rounded')
|
||||
%p.float-right= render 'members/tiny', member: seed.owner
|
||||
Reference in New Issue
Block a user