From 63af7eca9f1f75c2498bb8b2e4c7511814091153 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 10:58:52 +1300 Subject: [PATCH 01/26] Fix wrapping of admin menu, and put profile link (with image) last --- app/views/layouts/_menu.haml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/layouts/_menu.haml b/app/views/layouts/_menu.haml index 3703f969b..fba2e4aea 100644 --- a/app/views/layouts/_menu.haml +++ b/app/views/layouts/_menu.haml @@ -49,13 +49,21 @@ = link_to t('.forums'), forums_path, class: 'dropdown-item' - if member_signed_in? + - if current_member.role?(:crop_wrangler) || current_member.role?(:admin) + %li.nav-item.dropdown + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}= t('.admin') + .dropdown-menu{"aria-labelledby" => "navbarDropdown"} + - if current_member.role?(:crop_wrangler) + = link_to t('.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item' + - if current_member.role?(:admin) + = link_to t('.admin'), admin_path, class: 'dropdown-item' + %li.nav-item.dropdown %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"} + = image_tag(avatar_uri(current_member, 50), alt: '', height: 25, width: 25) + = current_member.login_name - if current_member.unread_count.positive? - = t('.your_stuff') %span.badge.badge-info= current_member.unread_count - - else - = current_member.login_name .dropdown-menu{"aria-labelledby" => "navbarDropdown"} = link_to member_path(current_member), class: 'dropdown-item' do = t('.profile') @@ -80,14 +88,6 @@ .dropdown-divider = link_to t('.sign_out'), destroy_member_session_path, method: :delete, class: 'dropdown-item' - - if current_member.role?(:crop_wrangler) || current_member.role?(:admin) - %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}= t('.admin') - .dropdown-menu{"aria-labelledby" => "navbarDropdown"} - - if current_member.role?(:crop_wrangler) - = link_to t('.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item' - - if current_member.role?(:admin) - = link_to t('.admin'), admin_path, class: 'dropdown-item' - else %li.nav-item= link_to t('.sign_in'), new_member_session_path, id: 'navbar-signin', class: 'btn btn-signin' %li.nav-item= link_to t('.sign_up'), new_member_registration_path, id: 'navbar-signup', class: 'btn btn-signup' From 76a3dcfc9335b01ccc03cd8706538277e13670cc Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 11:09:19 +1300 Subject: [PATCH 02/26] Added breadcrumbs to members --- app/views/members/show.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 693a61d2a..62f2e0978 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -10,6 +10,10 @@ - content_for :member_rss_login_name, @member.login_name - content_for :member_rss_slug, @member.slug +- content_for :breadcrumbs do + %li.breadcrumb-item= link_to 'Members', members_path + %li.breadcrumb-item.active= link_to @member.login_name, member_path(@member) + .row .col-md-2 .card From 155f2ed548d19d239c5dc156db98fe4a5e588123 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 12:34:08 +1300 Subject: [PATCH 03/26] Fix menu link label in spec --- spec/features/conversations/index_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/conversations/index_spec.rb b/spec/features/conversations/index_spec.rb index 9df3b584e..519ef144d 100644 --- a/spec/features/conversations/index_spec.rb +++ b/spec/features/conversations/index_spec.rb @@ -14,7 +14,7 @@ describe "Conversations", :js do describe "Read conversations list" do before do visit root_path - click_link 'Your Stuff' + click_link recipient.login_name click_link 'Inbox' end it { expect(page).to have_content 'something i want to say' } @@ -48,7 +48,7 @@ describe "Conversations", :js do sender.send_message(recipient, 'this is another message', 'follow up message') visit root_path - click_link 'Your Stuff' + click_link recipient.login_name click_link 'Inbox' all('input[type=checkbox]').each(&:click) @@ -63,7 +63,7 @@ describe "Conversations", :js do sender.send_message(recipient, 'this is another message', 'follow up message') visit root_path - click_link 'Your Stuff' + click_link recipient.login_name click_link 'Inbox' expect(page).to have_selector('.sent') From e8c7a9e1f5c01b53287ce0e62f333b9a3601a0d2 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 12:57:48 +1300 Subject: [PATCH 04/26] Fixed menu link label in another spec --- spec/features/conversations/show_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/conversations/show_spec.rb b/spec/features/conversations/show_spec.rb index 1bcfb8873..d72828c46 100644 --- a/spec/features/conversations/show_spec.rb +++ b/spec/features/conversations/show_spec.rb @@ -14,7 +14,7 @@ describe "Conversations", :js do describe 'view conversation thread' do before do visit root_path - click_link 'Your Stuff' + click_link member.login_name click_link 'Inbox' click_link 'something i want to say' end From 07a9891ec4d9c537665fceff1aa42d3bfc83a5fe Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 14:35:32 +1300 Subject: [PATCH 05/26] Fix spec --- spec/features/conversations/show_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/conversations/show_spec.rb b/spec/features/conversations/show_spec.rb index d72828c46..c2a7ae25a 100644 --- a/spec/features/conversations/show_spec.rb +++ b/spec/features/conversations/show_spec.rb @@ -14,7 +14,7 @@ describe "Conversations", :js do describe 'view conversation thread' do before do visit root_path - click_link member.login_name + click_link recipient.login_name click_link 'Inbox' click_link 'something i want to say' end From 325729751a1c9bedd7d59e017e515b28b056ef6b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 20 Feb 2020 16:04:09 +1300 Subject: [PATCH 06/26] Move search bar to middle, hide sitename on small screens --- app/views/layouts/_header.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 414dac23e..86e2110f9 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -2,9 +2,10 @@ .nav %a.navbar-brand{ href: root_path } = image_tag("pear.png", class: 'logo', alt: 'Growstuff brand logo (drawing of a pear)') - %span.site-name Growstuff + .d-none.d-md-block + %span.site-name Growstuff + .nav= render 'crops/search_bar' .nav %button.navbar-toggler{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarSupportedContent", "data-toggle" => "collapse", type: "button" } %i.fas.fa-ellipsis-v.navbar-toggler-icon = render 'layouts/menu' - = render 'crops/search_bar' \ No newline at end of file From d3cdaea2185a3d0c9e19f87ae070326bcc488c95 Mon Sep 17 00:00:00 2001 From: Brenda Date: Thu, 20 Feb 2020 22:49:33 +1300 Subject: [PATCH 07/26] Show member plantings summary on member page --- app/controllers/members_controller.rb | 22 +++++++++--- app/views/members/_full_summary.html.haml | 42 +++++++++++++++++++++++ app/views/members/show.html.haml | 6 ++-- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 app/views/members/_full_summary.html.haml diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 9f83044b0..c63172709 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -23,10 +23,24 @@ class MembersController < ApplicationController @activity = TimelineService.member_query(@member).limit(30) - # The garden form partial is called from the "New Garden" tab; - # it requires a garden to be passed in @garden. - # The new garden is not persisted unless Garden#save is called. - @garden = Garden.new + @late = [] + @super_late = [] + @harvesting = [] + @others = [] + + @member.plantings.active.annual.each do |planting| + if planting.finish_is_predicatable? + if planting.super_late? + @super_late << planting + elsif planting.late? + @late << planting + elsif planting.harvest_time? + @harvesting << planting + else + @others << planting + end + end + end respond_to do |format| format.html # show.html.haml diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml new file mode 100644 index 000000000..1098a4874 --- /dev/null +++ b/app/views/members/_full_summary.html.haml @@ -0,0 +1,42 @@ +- if current_member.plantings.active.empty? + %p + #{@sitename} lets you track what food you're growing + in your garden and see what other people near you are planting too. + %p + #{link_to "Get started now", new_planting_url} by planting your first crop. + +- else + - if @harvesting.size.positive? + %section.harvests + %h2 Ready to harvest + .index-cards + - @harvesting.each do |planting| + = render 'plantings/thumbnail', planting: planting + - if @others.size.positive? + %section.planting-progress + %h2 Progress report + %p Still growing + - @others.each do |planting| + .row + .col-2= render 'plantings/tiny', planting: planting + .col-10= render 'plantings/progress', planting: planting + - if @late.size.positive? + %section.late + %h2 Late + %p + These plantings are at the end of their lifecycle. + - if member_signed_in? && @member == current_member + When you have removed the planting from your garden, mark the planting as finished in Growstuff. + .index-cards + - @late.each do |planting| + = render 'plantings/thumbnail', planting: planting + - if @super_late.size.positive? + %section.superlate + %h2 Super late + %p + We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. + %ul + - @super_late.each do |planting| + %li + = link_to planting.crop_name, planting_url(slug: planting.slug) + planted on #{planting.planted_at.to_date} diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 62f2e0978..cdfc9ab93 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -18,8 +18,9 @@ .col-md-2 .card .card-body - = render "avatar", member: @member - = render "bio", member: @member + .row + .col= render "bio", member: @member + .col= render "avatar", member: @member %p - @member.roles.each do |role| %span.badge.badge-info= role.name.titleize @@ -61,6 +62,7 @@ .col-md-10 %section= render "map", member: @member + = render 'members/full_summary', member: @member %section.activity %h2 Activity .list-group From b72e866362d91afd7db18e33ee84697ea25513bd Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 21 Feb 2020 14:40:53 +1300 Subject: [PATCH 08/26] Remove reference to current member --- app/views/members/_full_summary.html.haml | 76 ++++++++++------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 1098a4874..9d35457c1 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -1,42 +1,34 @@ -- if current_member.plantings.active.empty? - %p - #{@sitename} lets you track what food you're growing - in your garden and see what other people near you are planting too. - %p - #{link_to "Get started now", new_planting_url} by planting your first crop. - -- else - - if @harvesting.size.positive? - %section.harvests - %h2 Ready to harvest - .index-cards - - @harvesting.each do |planting| - = render 'plantings/thumbnail', planting: planting - - if @others.size.positive? - %section.planting-progress - %h2 Progress report - %p Still growing - - @others.each do |planting| - .row - .col-2= render 'plantings/tiny', planting: planting - .col-10= render 'plantings/progress', planting: planting - - if @late.size.positive? - %section.late - %h2 Late - %p - These plantings are at the end of their lifecycle. - - if member_signed_in? && @member == current_member - When you have removed the planting from your garden, mark the planting as finished in Growstuff. - .index-cards - - @late.each do |planting| - = render 'plantings/thumbnail', planting: planting - - if @super_late.size.positive? - %section.superlate - %h2 Super late - %p - We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. - %ul - - @super_late.each do |planting| - %li - = link_to planting.crop_name, planting_url(slug: planting.slug) - planted on #{planting.planted_at.to_date} +- if @harvesting.size.positive? + %section.harvests + %h2 Ready to harvest + .index-cards + - @harvesting.each do |planting| + = render 'plantings/thumbnail', planting: planting +- if @others.size.positive? + %section.planting-progress + %h2 Progress report + %p Still growing + - @others.each do |planting| + .row + .col-2= render 'plantings/tiny', planting: planting + .col-10= render 'plantings/progress', planting: planting +- if @late.size.positive? + %section.late + %h2 Late + %p + These plantings are at the end of their lifecycle. + - if member_signed_in? && @member == current_member + When you have removed the planting from your garden, mark the planting as finished in Growstuff. + .index-cards + - @late.each do |planting| + = render 'plantings/thumbnail', planting: planting +- if @super_late.size.positive? + %section.superlate + %h2 Super late + %p + We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. + %ul + - @super_late.each do |planting| + %li + = link_to planting.crop_name, planting_url(slug: planting.slug) + planted on #{planting.planted_at.to_date} From e3594eee02391d541e9ebe078ee4a6f193eddf1f Mon Sep 17 00:00:00 2001 From: Brenda Date: Thu, 20 Feb 2020 22:49:33 +1300 Subject: [PATCH 09/26] Show member plantings summary on member page --- app/controllers/members_controller.rb | 22 +++++++++--- app/views/members/_full_summary.html.haml | 42 +++++++++++++++++++++++ app/views/members/show.html.haml | 6 ++-- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 app/views/members/_full_summary.html.haml diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 9f83044b0..c63172709 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -23,10 +23,24 @@ class MembersController < ApplicationController @activity = TimelineService.member_query(@member).limit(30) - # The garden form partial is called from the "New Garden" tab; - # it requires a garden to be passed in @garden. - # The new garden is not persisted unless Garden#save is called. - @garden = Garden.new + @late = [] + @super_late = [] + @harvesting = [] + @others = [] + + @member.plantings.active.annual.each do |planting| + if planting.finish_is_predicatable? + if planting.super_late? + @super_late << planting + elsif planting.late? + @late << planting + elsif planting.harvest_time? + @harvesting << planting + else + @others << planting + end + end + end respond_to do |format| format.html # show.html.haml diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml new file mode 100644 index 000000000..1098a4874 --- /dev/null +++ b/app/views/members/_full_summary.html.haml @@ -0,0 +1,42 @@ +- if current_member.plantings.active.empty? + %p + #{@sitename} lets you track what food you're growing + in your garden and see what other people near you are planting too. + %p + #{link_to "Get started now", new_planting_url} by planting your first crop. + +- else + - if @harvesting.size.positive? + %section.harvests + %h2 Ready to harvest + .index-cards + - @harvesting.each do |planting| + = render 'plantings/thumbnail', planting: planting + - if @others.size.positive? + %section.planting-progress + %h2 Progress report + %p Still growing + - @others.each do |planting| + .row + .col-2= render 'plantings/tiny', planting: planting + .col-10= render 'plantings/progress', planting: planting + - if @late.size.positive? + %section.late + %h2 Late + %p + These plantings are at the end of their lifecycle. + - if member_signed_in? && @member == current_member + When you have removed the planting from your garden, mark the planting as finished in Growstuff. + .index-cards + - @late.each do |planting| + = render 'plantings/thumbnail', planting: planting + - if @super_late.size.positive? + %section.superlate + %h2 Super late + %p + We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. + %ul + - @super_late.each do |planting| + %li + = link_to planting.crop_name, planting_url(slug: planting.slug) + planted on #{planting.planted_at.to_date} diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 62f2e0978..cdfc9ab93 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -18,8 +18,9 @@ .col-md-2 .card .card-body - = render "avatar", member: @member - = render "bio", member: @member + .row + .col= render "bio", member: @member + .col= render "avatar", member: @member %p - @member.roles.each do |role| %span.badge.badge-info= role.name.titleize @@ -61,6 +62,7 @@ .col-md-10 %section= render "map", member: @member + = render 'members/full_summary', member: @member %section.activity %h2 Activity .list-group From c71e9b01de0035acbd97d0989f09f31a07bb3f6a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 21 Feb 2020 14:40:53 +1300 Subject: [PATCH 10/26] Remove reference to current member --- app/views/members/_full_summary.html.haml | 76 ++++++++++------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 1098a4874..9d35457c1 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -1,42 +1,34 @@ -- if current_member.plantings.active.empty? - %p - #{@sitename} lets you track what food you're growing - in your garden and see what other people near you are planting too. - %p - #{link_to "Get started now", new_planting_url} by planting your first crop. - -- else - - if @harvesting.size.positive? - %section.harvests - %h2 Ready to harvest - .index-cards - - @harvesting.each do |planting| - = render 'plantings/thumbnail', planting: planting - - if @others.size.positive? - %section.planting-progress - %h2 Progress report - %p Still growing - - @others.each do |planting| - .row - .col-2= render 'plantings/tiny', planting: planting - .col-10= render 'plantings/progress', planting: planting - - if @late.size.positive? - %section.late - %h2 Late - %p - These plantings are at the end of their lifecycle. - - if member_signed_in? && @member == current_member - When you have removed the planting from your garden, mark the planting as finished in Growstuff. - .index-cards - - @late.each do |planting| - = render 'plantings/thumbnail', planting: planting - - if @super_late.size.positive? - %section.superlate - %h2 Super late - %p - We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. - %ul - - @super_late.each do |planting| - %li - = link_to planting.crop_name, planting_url(slug: planting.slug) - planted on #{planting.planted_at.to_date} +- if @harvesting.size.positive? + %section.harvests + %h2 Ready to harvest + .index-cards + - @harvesting.each do |planting| + = render 'plantings/thumbnail', planting: planting +- if @others.size.positive? + %section.planting-progress + %h2 Progress report + %p Still growing + - @others.each do |planting| + .row + .col-2= render 'plantings/tiny', planting: planting + .col-10= render 'plantings/progress', planting: planting +- if @late.size.positive? + %section.late + %h2 Late + %p + These plantings are at the end of their lifecycle. + - if member_signed_in? && @member == current_member + When you have removed the planting from your garden, mark the planting as finished in Growstuff. + .index-cards + - @late.each do |planting| + = render 'plantings/thumbnail', planting: planting +- if @super_late.size.positive? + %section.superlate + %h2 Super late + %p + We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. + %ul + - @super_late.each do |planting| + %li + = link_to planting.crop_name, planting_url(slug: planting.slug) + planted on #{planting.planted_at.to_date} From 878ae9073c4897059eb449fbf8a80432ce09e22d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 22 Feb 2020 07:49:56 +1300 Subject: [PATCH 11/26] Tidy up member planting progress section --- app/views/members/_full_summary.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 9d35457c1..3ed78bd3b 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -8,10 +8,11 @@ %section.planting-progress %h2 Progress report %p Still growing - - @others.each do |planting| - .row - .col-2= render 'plantings/tiny', planting: planting - .col-10= render 'plantings/progress', planting: planting + .list-group + - @others.each do |planting| + .list-group-item + %span= render 'plantings/tiny', planting: planting + %span= render 'plantings/progress', planting: planting - if @late.size.positive? %section.late %h2 Late From 0177b872db7d6e420be7f76efbfa31c752e58a4b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 22 Feb 2020 12:29:02 +1300 Subject: [PATCH 12/26] Member planting progress (#2437) * Show member plantings summary on member page * Remove reference to current member * Tidy up member planting progress section --- app/views/members/_full_summary.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 9d35457c1..3ed78bd3b 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -8,10 +8,11 @@ %section.planting-progress %h2 Progress report %p Still growing - - @others.each do |planting| - .row - .col-2= render 'plantings/tiny', planting: planting - .col-10= render 'plantings/progress', planting: planting + .list-group + - @others.each do |planting| + .list-group-item + %span= render 'plantings/tiny', planting: planting + %span= render 'plantings/progress', planting: planting - if @late.size.positive? %section.late %h2 Late From c85abe0bd100343073d3954bad0765bb9a3b2372 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 22 Feb 2020 12:29:02 +1300 Subject: [PATCH 13/26] Member planting progress (#2437) * Show member plantings summary on member page * Remove reference to current member * Tidy up member planting progress section --- app/views/members/_full_summary.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 9d35457c1..3ed78bd3b 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -8,10 +8,11 @@ %section.planting-progress %h2 Progress report %p Still growing - - @others.each do |planting| - .row - .col-2= render 'plantings/tiny', planting: planting - .col-10= render 'plantings/progress', planting: planting + .list-group + - @others.each do |planting| + .list-group-item + %span= render 'plantings/tiny', planting: planting + %span= render 'plantings/progress', planting: planting - if @late.size.positive? %section.late %h2 Late From cf440b444caa32c0ed7cc4a0039518f3c4d9bc5f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2020 07:57:03 +0000 Subject: [PATCH 14/26] Bump searchkick from 4.2.1 to 4.3.0 Bumps [searchkick](https://github.com/ankane/searchkick) from 4.2.1 to 4.3.0. - [Release notes](https://github.com/ankane/searchkick/releases) - [Changelog](https://github.com/ankane/searchkick/blob/master/CHANGELOG.md) - [Commits](https://github.com/ankane/searchkick/compare/v4.2.1...v4.3.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 55207bcd2..dbcf53236 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -491,7 +491,7 @@ GEM tilt scout_apm (2.6.6) parser - searchkick (4.2.1) + searchkick (4.3.0) activemodel (>= 5) elasticsearch (>= 6) hashie From bb13bbf27ec2deafde23181dc9c1b44686f8762e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2020 00:15:34 +0000 Subject: [PATCH 15/26] Bump rubocop from 0.79.0 to 0.80.0 Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.79.0 to 0.80.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.79.0...v0.80.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index dbcf53236..c9d1bbc59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -413,6 +413,7 @@ GEM responders (3.0.0) actionpack (>= 5.0) railties (>= 5.0) + rexml (3.2.4) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -453,11 +454,12 @@ GEM rswag-ui (2.2.0) actionpack (>= 3.1, < 6.1) railties (>= 3.1, < 6.1) - rubocop (0.79.0) + rubocop (0.80.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) rubocop-rails (2.4.2) From 36bad1cda0fd3ae44ea73a66f02408aa9cec4340 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 23 Feb 2020 11:42:07 +1300 Subject: [PATCH 16/26] Fix mobile display of member profiles --- app/assets/stylesheets/_harvests.scss | 18 ++++++--- app/assets/stylesheets/_plantings.scss | 7 ---- app/assets/stylesheets/mobile.scss | 2 +- app/controllers/members_controller.rb | 7 ++++ app/views/harvests/_thumbnail.html.haml | 17 ++++---- app/views/members/_full_summary.html.haml | 20 ++++++++-- app/views/plantings/_badges.html.haml | 1 - app/views/plantings/_thumbnail.html.haml | 9 +++-- spec/features/members/profile_spec.rb | 48 +++++++++++++++++++++++ 9 files changed, 99 insertions(+), 30 deletions(-) diff --git a/app/assets/stylesheets/_harvests.scss b/app/assets/stylesheets/_harvests.scss index 560983965..b8c317ea5 100644 --- a/app/assets/stylesheets/_harvests.scss +++ b/app/assets/stylesheets/_harvests.scss @@ -2,21 +2,29 @@ .text { color: $white; margin: 0; - opacity: .9; + opacity: .8; position: absolute; text-align: center; - top: 50%; + top: 30%; width: 100%; + color: $white; + + h3, + h4, + h5 { + margin: 0 + } h3 { background-color: $green; - font-size: 1em; + } + + h4 { + background-color: $black; } h5 { background-color: $brown; - color: $white; - font-size: .7em; } a { diff --git a/app/assets/stylesheets/_plantings.scss b/app/assets/stylesheets/_plantings.scss index 52e204082..a65aeb75c 100755 --- a/app/assets/stylesheets/_plantings.scss +++ b/app/assets/stylesheets/_plantings.scss @@ -1,5 +1,4 @@ .planting { - .planting-badges { font-size: 1em; position: absolute; @@ -23,12 +22,6 @@ } } - .planting-full-badges { - .badge { - font-size: 200%; - } - } - .planting-name { position: relative; text-align: center; diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss index c62904e37..95a1a568d 100644 --- a/app/assets/stylesheets/mobile.scss +++ b/app/assets/stylesheets/mobile.scss @@ -1,6 +1,6 @@ // Overrides applying only to mobile view. This must be at the end of the overrides file. // Extra small devices (portrait phones, less than 576px) -@include media-breakpoint-down(xs) { +@include media-breakpoint-down(md) { #maincontainer { width: 100%; diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index c63172709..51ca424cc 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -42,6 +42,13 @@ class MembersController < ApplicationController end end + @harvests = Harvest.search( + where: {owner_id: @member.id}, + boost_by: [:created_at], + limit: 16, + load: false + ) + respond_to do |format| format.html # show.html.haml format.json { render json: @member.to_json(only: member_json_fields) } diff --git a/app/views/harvests/_thumbnail.html.haml b/app/views/harvests/_thumbnail.html.haml index 5dfe125c3..016d40650 100644 --- a/app/views/harvests/_thumbnail.html.haml +++ b/app/views/harvests/_thumbnail.html.haml @@ -1,10 +1,11 @@ - cache harvest do - .card.harvest-thumbnail - = link_to image_tag(harvest_image_path(harvest), - alt: harvest, - class: 'img img-card'), - harvest + = link_to harvest_path(slug: harvest.slug) do + .card.harvest-thumbnail + = image_tag(harvest.thumbnail_url ? harvest.thumbnail_url : placeholder_image, + alt: harvest.crop_name, + class: 'img img-card') - .text - %h3.harvest-plant-part= link_to harvest.plant_part, harvest - %h5.harvest-crop= harvest.crop + .text + %h3.harvest-crop #{harvest.crop_name} harvest + %h4.harvest-plant-part= harvest.plant_part_name + %h5.harvest-date= harvest.harvested_at diff --git a/app/views/members/_full_summary.html.haml b/app/views/members/_full_summary.html.haml index 3ed78bd3b..d855d74cb 100644 --- a/app/views/members/_full_summary.html.haml +++ b/app/views/members/_full_summary.html.haml @@ -4,10 +4,18 @@ .index-cards - @harvesting.each do |planting| = render 'plantings/thumbnail', planting: planting + +- if @harvests.any? + %section.havests + %h2 Recent Harvests + .index-cards + - @harvests.each do |harvest| + = render 'harvests/thumbnail', harvest: harvest + - if @others.size.positive? %section.planting-progress %h2 Progress report - %p Still growing + %p Still growing and not ready for harvesting. .list-group - @others.each do |planting| .list-group-item @@ -19,17 +27,21 @@ %p These plantings are at the end of their lifecycle. - if member_signed_in? && @member == current_member - When you have removed the planting from your garden, mark the planting as finished in Growstuff. + %strong When you have removed the planting from your garden, mark the planting as finished in Growstuff. .index-cards - @late.each do |planting| = render 'plantings/thumbnail', planting: planting -- if @super_late.size.positive? +- if @super_late.any? %section.superlate %h2 Super late %p - We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking. + We suspect the following plantings finished long ago and no longer need tracking. + - if member_signed_in? && current_member == @member + %strong You can mark these plantings as finished to stop tracking. %ul - @super_late.each do |planting| %li = link_to planting.crop_name, planting_url(slug: planting.slug) planted on #{planting.planted_at.to_date} + + diff --git a/app/views/plantings/_badges.html.haml b/app/views/plantings/_badges.html.haml index 8402aaf36..e01d72d5f 100644 --- a/app/views/plantings/_badges.html.haml +++ b/app/views/plantings/_badges.html.haml @@ -4,7 +4,6 @@ - if planting.finish_is_predicatable? - if planting.super_late? %span.badge.badge-info.badge-super-late= t('.super_late') - = planting_finish_button(planting) - elsif planting.late? %span.badge.badge-info.badge-late= t('.late_finishing') diff --git a/app/views/plantings/_thumbnail.html.haml b/app/views/plantings/_thumbnail.html.haml index 60bf071cf..3e105961b 100644 --- a/app/views/plantings/_thumbnail.html.haml +++ b/app/views/plantings/_thumbnail.html.haml @@ -1,11 +1,12 @@ -.card.thumbnail +.card.planting.thumbnail .planting-thumbnail-image = link_to image_tag(planting_image_path(planting), alt: planting.crop, class: 'img-card'), planting .card-body - %h5.card-title + %h4 = crop_icon(planting.crop) = link_to planting.crop, planting - %h6.card-subtitle.text-muted=planting.finished_at - = render 'plantings/badges', planting: planting + planting + - if planting.finished_at.present? + %h6.card-subtitle.text-muted=planting.finished_at diff --git a/spec/features/members/profile_spec.rb b/spec/features/members/profile_spec.rb index 08438efda..e668f28cc 100644 --- a/spec/features/members/profile_spec.rb +++ b/spec/features/members/profile_spec.rb @@ -150,6 +150,54 @@ describe "member profile", js: true do it { expect(page).to have_link href: photo_path(photo) } it { expect(page).to have_link href: planting_path(planting) } end + + context 'plantings' do + let(:crop) { FactoryBot.create :crop } + before do + # time to harvest = 50 day + # time to finished = 90 days + FactoryBot.create(:harvest, + harvested_at: 50.days.ago, + crop: crop, + planting: FactoryBot.create(:planting, + crop: crop, + planted_at: 100.days.ago, + finished_at: 10.days.ago)) + crop.plantings.each(&:update_harvest_days!) + crop.update_lifespan_medians + crop.update_harvest_medians + + growing_planting + harvesting_planting + super_late_planting + + visit member_path(member) + end + + let(:growing_planting) do + FactoryBot.create :planting, + crop: crop, + owner: member, + planted_at: Time.zone.today + end + + let(:harvesting_planting) do + FactoryBot.create :planting, + crop: crop, + owner: member, + planted_at: 51.days.ago + end + + let(:super_late_planting) do + FactoryBot.create :planting, + crop: crop, owner: member, + planted_at: 260.days.ago + end + + it { expect(page).to have_link(href: planting_path(growing_planting)) } + it { expect(page).to have_link(href: planting_path(harvesting_planting)) } + it { expect(page).to have_link(href: planting_path(super_late_planting)) } + end end context "not signed in" do From 71ccd52c598e16f92eae865473442d29fe637adb Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 23 Feb 2020 12:03:14 +1300 Subject: [PATCH 17/26] Fix harvest thumbnails --- app/assets/stylesheets/mobile.scss | 5 +++++ app/views/harvests/_thumbnail.html.haml | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss index 95a1a568d..760e5eaa7 100644 --- a/app/assets/stylesheets/mobile.scss +++ b/app/assets/stylesheets/mobile.scss @@ -2,6 +2,11 @@ // Extra small devices (portrait phones, less than 576px) @include media-breakpoint-down(md) { + .container { + margin: 2px; + padding: 0; + } + #maincontainer { width: 100%; } diff --git a/app/views/harvests/_thumbnail.html.haml b/app/views/harvests/_thumbnail.html.haml index 016d40650..a6ff1c477 100644 --- a/app/views/harvests/_thumbnail.html.haml +++ b/app/views/harvests/_thumbnail.html.haml @@ -1,11 +1,14 @@ - cache harvest do - = link_to harvest_path(slug: harvest.slug) do - .card.harvest-thumbnail + .card.harvest-thumbnail + = link_to harvest_path(slug: harvest.slug) do = image_tag(harvest.thumbnail_url ? harvest.thumbnail_url : placeholder_image, alt: harvest.crop_name, class: 'img img-card') - .text - %h3.harvest-crop #{harvest.crop_name} harvest - %h4.harvest-plant-part= harvest.plant_part_name - %h5.harvest-date= harvest.harvested_at + .card-body + %h3.harvest-crop.card-title + = link_to harvest.crop_name harvest_path(slug: harvest.slug) + harvest + %h4.harvest-plant-part + = harvest.plant_part_name + %small.text-muted= harvest.harvested_at From 28ff0583665cd35031f43391f4a5c40925627eae Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sat, 22 Feb 2020 23:04:59 +0000 Subject: [PATCH 18/26] [CodeFactor] Apply fixes --- app/controllers/members_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 51ca424cc..021460c99 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -43,11 +43,11 @@ class MembersController < ApplicationController end @harvests = Harvest.search( - where: {owner_id: @member.id}, + where: { owner_id: @member.id }, boost_by: [:created_at], - limit: 16, - load: false - ) + limit: 16, + load: false + ) respond_to do |format| format.html # show.html.haml From 435c164e15cd4df0b98b8082bcf184ce1fe4b342 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 23 Feb 2020 15:47:23 +1300 Subject: [PATCH 19/26] Fixed typo error in view --- app/views/harvests/_thumbnail.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/harvests/_thumbnail.html.haml b/app/views/harvests/_thumbnail.html.haml index a6ff1c477..3c6dca5e4 100644 --- a/app/views/harvests/_thumbnail.html.haml +++ b/app/views/harvests/_thumbnail.html.haml @@ -7,7 +7,7 @@ .card-body %h3.harvest-crop.card-title - = link_to harvest.crop_name harvest_path(slug: harvest.slug) + = link_to harvest.crop_name, harvest_path(slug: harvest.slug) harvest %h4.harvest-plant-part = harvest.plant_part_name From 5bd97902da2a1eb9206867fdf7737036d5243e80 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2020 04:05:47 +0000 Subject: [PATCH 20/26] Bump database_cleaner from 1.8.2 to 1.8.3 Bumps [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) from 1.8.2 to 1.8.3. - [Release notes](https://github.com/DatabaseCleaner/database_cleaner/releases) - [Changelog](https://github.com/DatabaseCleaner/database_cleaner/blob/v1.8.3/History.rdoc) - [Commits](https://github.com/DatabaseCleaner/database_cleaner/compare/v1.8.2...v1.8.3) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index dbcf53236..18ee1c243 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -149,7 +149,7 @@ GEM csv_shaper (1.3.1) activesupport (>= 3.0.0) dalli (2.7.10) - database_cleaner (1.8.2) + database_cleaner (1.8.3) devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) From e54330a4d7102989ef0f81eb9c00cdfea628a085 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 19:47:44 +0000 Subject: [PATCH 21/26] [Security] Bump nokogiri from 1.10.7 to 1.10.8 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.7 to 1.10.8. **This update includes a security fix.** - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.7...v1.10.8) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7d06591dd..6535d64e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,7 +316,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.2) - nokogiri (1.10.7) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) oauth (0.5.4) oauth2 (1.4.2) From a5c770c2b566c05c86b4053171acf81a2db5bcbb Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 27 Feb 2020 09:42:09 +1300 Subject: [PATCH 22/26] Update app/views/crops/_thumbnail.html.haml Co-Authored-By: Martina <922964+simicic@users.noreply.github.com> --- app/views/crops/_thumbnail.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/crops/_thumbnail.html.haml b/app/views/crops/_thumbnail.html.haml index 0338ebfb4..6500d913d 100644 --- a/app/views/crops/_thumbnail.html.haml +++ b/app/views/crops/_thumbnail.html.haml @@ -1,7 +1,7 @@ - cache crop do .card.crop-thumbnail = link_to crop_path(slug: crop.slug) do - = image_tag(crop.thumbnail_url ? crop.thumbnail_url : placeholder_image, + = image_tag(crop.thumbnail_url.presence || placeholder_image, alt: crop.name, class: 'img img-card') From 1c57e5266f5aeca871d3f428e17c48d5793b1b7d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 08:08:52 +0000 Subject: [PATCH 23/26] Bump better_errors from 2.5.1 to 2.6.0 Bumps [better_errors](https://github.com/BetterErrors/better_errors) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/BetterErrors/better_errors/releases) - [Commits](https://github.com/BetterErrors/better_errors/compare/v2.5.1...v2.6.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6535d64e5..297a57b16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,7 +68,7 @@ GEM autoprefixer-rails (9.7.3) execjs bcrypt (3.1.13) - better_errors (2.5.1) + better_errors (2.6.0) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) From 236caa0d3237f5e1a60af610fadc115bfdb8be08 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2020 18:18:34 +0000 Subject: [PATCH 24/26] Bump will_paginate from 3.2.1 to 3.3.0 Bumps [will_paginate](https://github.com/mislav/will_paginate) from 3.2.1 to 3.3.0. - [Release notes](https://github.com/mislav/will_paginate/releases) - [Commits](https://github.com/mislav/will_paginate/compare/v3.2.1...v3.3.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 297a57b16..822fd6abd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -563,7 +563,7 @@ GEM websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) - will_paginate (3.2.1) + will_paginate (3.3.0) will_paginate-bootstrap4 (0.2.2) will_paginate (~> 3.0, >= 3.0.0) xmlrpc (0.3.0) From 011ce39edb8953adb0c6822d571c0985aae2eb96 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 28 Feb 2020 08:07:56 +0000 Subject: [PATCH 25/26] Bump puma from 4.3.1 to 4.3.2 Bumps [puma](https://github.com/puma/puma) from 4.3.1 to 4.3.2. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v4.3.1...v4.3.2) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 822fd6abd..38dd193b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -355,7 +355,7 @@ GEM popper_js (1.14.5) procto (0.0.3) public_suffix (4.0.3) - puma (4.3.1) + puma (4.3.2) nio4r (~> 2.0) query_diet (0.6.2) rack (2.2.2) From b2ff247a313b868bc2f838c5246575272594a2b8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 29 Feb 2020 09:36:05 +1300 Subject: [PATCH 26/26] Apply suggestions from code review Co-Authored-By: Martina <922964+simicic@users.noreply.github.com> --- app/helpers/icons_helper.rb | 2 +- app/views/harvests/_modal.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 25e6b8403..fda3a9c80 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -91,7 +91,7 @@ module IconsHelper icon('fas', 'heart') end - def plantpart_icon(name) + def plant_part_icon(name) image_icon "plant_parts/#{name}" end diff --git a/app/views/harvests/_modal.html.haml b/app/views/harvests/_modal.html.haml index 86e1fea3f..f8dd3e0ee 100644 --- a/app/views/harvests/_modal.html.haml +++ b/app/views/harvests/_modal.html.haml @@ -15,7 +15,7 @@ .card = link_to harvests_path(harvest: {crop_id: @crop.id, plant_part_id: plant_part.id}), method: :post, class: 'dropdown-item' do .card-title.text-center - %h3= plantpart_icon(plant_part.name) + %h3= plant_part_icon(plant_part.name) %h3= plant_part.name %hr/ @@ -23,7 +23,7 @@ %nav - PlantPart.all.order(:name).each do |plant_part| = link_to harvests_path(harvest: {crop_id: @crop.id, plant_part_id: plant_part.id}), method: :post, class: 'nav-link' do - = plantpart_icon(plant_part.name) + = plant_part_icon(plant_part.name) = plant_part %a.btn{"data-target" => "#modelHarvestForm", "data-toggle" => "modal", href: ""}