Added Plantings modal form

This commit is contained in:
Brenda Wallace
2020-02-29 10:23:00 +13:00
parent 68d157b048
commit 6c94337047
2 changed files with 25 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
- cache harvest do
.card
= link_to harvest do
= link_to harvest_path(slug: harvest.slug) do
= image_tag harvest.thumbnail_url ? harvest.thumbnail_url : placeholder_image, alt: harvest.crop_name, class: 'img-card'
.card-body
%h5
@@ -10,4 +10,4 @@
.float-right
%span.chip.member-chip
= link_to member_path(slug: harvest.owner_slug) do
= harvest.owner_login_name
= harvest.owner_login_name

View File

@@ -0,0 +1,23 @@
#modelPlantingForm.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "planting-button", role: "dialog", tabindex: "-1"}
.modal-dialog{role: "document"}
.modal-content
.modal-header.text-center
%h4.modal-title.w-100.font-weight-bold Record #{planting.crop.name} planting
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"}
%span{"aria-hidden" => "true"} ×
.modal-body
%p Which garden is the planting in?
%ul.list-group
- planting.owner.gardens.order(:name).each do |garden|
%li.list-group-item
= link_to plantings_path(planting: {crop_id: planting.crop_id, garden_id: garden.id}), method: :post do
.md-v-line
.d-flex.justify-content-between
= image_tag garden_image_path(garden), class: 'img', height: 50
= garden.name
%a.btn{"data-target" => "#modelPlantingForm", "data-toggle" => "modal", href: "", id: 'planting-button'}
= planting_icon
Plant #{planting.crop.name}