mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-10 16:54:38 -04:00
Merge pull request #4453 from Growstuff/add-mark-as-failed-to-crop-view-13853484652230549508
Add "mark as failed" action to crop view
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
- if crop.approved? && signed_in?
|
||||
- active_plantings = current_member.plantings.where(crop: crop).active
|
||||
|
||||
.btn-group.crop-actions{"aria-label" => "Crop Actions", role: "group"}
|
||||
= render 'plantings/modal', planting: Planting.new(crop: crop, owner: current_member)
|
||||
= render 'harvests/modal', harvest: Harvest.new(crop: @crop, owner: current_member)
|
||||
= render 'seeds/modal', seed: Seed.new(crop: @crop, owner: current_member)
|
||||
- if active_plantings.any?
|
||||
= render 'plantings/failed_modal', crop: crop, active_plantings: active_plantings
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
= link_to planting_path(planting), class: 'card-link' do
|
||||
= planting_icon
|
||||
= planting
|
||||
- if can?(:edit, planting)
|
||||
.float-right= render 'plantings/actions', planting: planting
|
||||
.float-right= render 'members/location', member: planting.owner
|
||||
.card-footer
|
||||
- if crop.approved?
|
||||
|
||||
26
app/views/plantings/_failed_modal.html.haml
Normal file
26
app/views/plantings/_failed_modal.html.haml
Normal file
@@ -0,0 +1,26 @@
|
||||
#modelFailedPlantingForm.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "failed-planting-button", role: "dialog", tabindex: "-1"}
|
||||
.modal-dialog{role: "document"}
|
||||
.modal-content
|
||||
.modal-header.text-center
|
||||
%h4.modal-title.w-100.font-weight-bold Mark #{crop.name} planting as failed
|
||||
%button.close{"aria-label" => "Close", "data-bs-dismiss" => "modal", type: "button"}
|
||||
%span{"aria-hidden" => "true"} ×
|
||||
.modal-body
|
||||
%p Which planting would you like to mark as failed?
|
||||
|
||||
%ul.list-group
|
||||
- active_plantings.each do |planting|
|
||||
%li.list-group-item
|
||||
= link_to planting_path(planting, planting: {failed: 1}), method: :put do
|
||||
.d-flex.justify-content-between
|
||||
%span
|
||||
%h4= planting.garden.name
|
||||
%p Planted #{planting.planted_at}
|
||||
%span
|
||||
= finished_icon
|
||||
.mt-3.text-right
|
||||
= link_to 'cancel', '', "data-bs-dismiss" => "modal", class: 'btn btn-secondary'
|
||||
|
||||
%a.btn#failed-planting-button{"data-bs-target" => "#modelFailedPlantingForm", "data-bs-toggle" => "modal", href: ""}
|
||||
= finished_icon
|
||||
Mark as failed
|
||||
Reference in New Issue
Block a user