From 6c943370475ea4e50cbcbede67659918be2fbf5c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 29 Feb 2020 10:23:00 +1300 Subject: [PATCH] Added Plantings modal form --- app/views/harvests/_card.html.haml | 4 ++-- app/views/plantings/_modal.html.haml | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 app/views/plantings/_modal.html.haml diff --git a/app/views/harvests/_card.html.haml b/app/views/harvests/_card.html.haml index 7cfedccc8..f80768c5b 100644 --- a/app/views/harvests/_card.html.haml +++ b/app/views/harvests/_card.html.haml @@ -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 \ No newline at end of file + = harvest.owner_login_name diff --git a/app/views/plantings/_modal.html.haml b/app/views/plantings/_modal.html.haml new file mode 100644 index 000000000..ab190b2df --- /dev/null +++ b/app/views/plantings/_modal.html.haml @@ -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}