From 08dc2a0513555a82343d649f7ad3447777632eae Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 9 Dec 2017 22:24:51 +1300 Subject: [PATCH 1/4] Show photos of a planting's harvests --- app/views/harvests/_card.html.haml | 29 +++++++++++++++++++ app/views/harvests/_thumbnail.html.haml | 38 ++++++------------------- app/views/harvests/index.html.haml | 2 +- app/views/plantings/_actions.html.haml | 2 +- app/views/plantings/_harvests.html.haml | 20 +++++++------ app/views/plantings/_progress.html.haml | 7 ++--- app/views/plantings/show.html.haml | 16 ++++++----- 7 files changed, 64 insertions(+), 50 deletions(-) create mode 100644 app/views/harvests/_card.html.haml diff --git a/app/views/harvests/_card.html.haml b/app/views/harvests/_card.html.haml new file mode 100644 index 000000000..e82d53725 --- /dev/null +++ b/app/views/harvests/_card.html.haml @@ -0,0 +1,29 @@ +.panel.panel-success + .panel-heading + %h3.panel-title + = link_to "#{harvest.owner.login_name}'s #{harvest.crop.name} harvest", harvest + - if can? :edit, harvest + %a.pull-right{ href: edit_harvest_path(harvest), role: "button", id: "edit_harvest_glyphicon" } + %span.glyphicon.glyphicon-pencil{ title: "Edit" } + .panel-body + .row + .col-md-4 + = link_to image_tag((harvest.default_photo ? harvest.default_photo.thumbnail_url : 'placeholder_150.png'), + alt: harvest.crop.name, class: 'img'), + harvest + .col-md-8 + %dl.dl-horizontal + %dt Crop : + %dd= link_to harvest.crop.name, harvest.crop + %dt Plant part : + %dd= link_to harvest.plant_part, harvest.plant_part + %dt Quantity : + %dd= display_quantity(harvest) + %dt Harvest date : + %dd= harvest.harvested_at + .panel-footer + %dt Description + %dd.truncate + = display_harvest_description(harvest) + = if harvest.description.present? + - link_to "Read more", harvest_path(harvest) diff --git a/app/views/harvests/_thumbnail.html.haml b/app/views/harvests/_thumbnail.html.haml index e82d53725..9a9beac0c 100644 --- a/app/views/harvests/_thumbnail.html.haml +++ b/app/views/harvests/_thumbnail.html.haml @@ -1,29 +1,9 @@ -.panel.panel-success - .panel-heading - %h3.panel-title - = link_to "#{harvest.owner.login_name}'s #{harvest.crop.name} harvest", harvest - - if can? :edit, harvest - %a.pull-right{ href: edit_harvest_path(harvest), role: "button", id: "edit_harvest_glyphicon" } - %span.glyphicon.glyphicon-pencil{ title: "Edit" } - .panel-body - .row - .col-md-4 - = link_to image_tag((harvest.default_photo ? harvest.default_photo.thumbnail_url : 'placeholder_150.png'), - alt: harvest.crop.name, class: 'img'), - harvest - .col-md-8 - %dl.dl-horizontal - %dt Crop : - %dd= link_to harvest.crop.name, harvest.crop - %dt Plant part : - %dd= link_to harvest.plant_part, harvest.plant_part - %dt Quantity : - %dd= display_quantity(harvest) - %dt Harvest date : - %dd= harvest.harvested_at - .panel-footer - %dt Description - %dd.truncate - = display_harvest_description(harvest) - = if harvest.description.present? - - link_to "Read more", harvest_path(harvest) +.thumbnail + .harvest-thumbnail + - if harvest + = link_to image_tag((harvest.default_photo ? harvest.default_photo.thumbnail_url : 'placeholder_150.png'), + alt: harvest.crop.name, class: 'img'), + harvest + .harvestinfo + .harvest-name + = link_to harvest, harvest diff --git a/app/views/harvests/index.html.haml b/app/views/harvests/index.html.haml index fa0be4ed3..f743f8ad3 100644 --- a/app/views/harvests/index.html.haml +++ b/app/views/harvests/index.html.haml @@ -15,7 +15,7 @@ - unless @harvests.empty? - @harvests.each do |harvest| .col-md-6 - = render partial: 'harvests/thumbnail', locals: { harvest: harvest } + = render 'harvests/card', harvest: harvest .pagination = page_entries_info @harvests diff --git a/app/views/plantings/_actions.html.haml b/app/views/plantings/_actions.html.haml index d72f6243b..b2c2d5f98 100644 --- a/app/views/plantings/_actions.html.haml +++ b/app/views/plantings/_actions.html.haml @@ -16,7 +16,7 @@ %span.glyphicon.glyphicon-ok{ title: "Finished" } Mark as finished - - if can?(:create, Harvest) + - if can? :edit, planting = link_to new_planting_harvest_path(planting), class: 'btn btn-default btn-xs' do %span.glyphicon.glyphicon-leaf{ title: "Harvest" } Harvest diff --git a/app/views/plantings/_harvests.html.haml b/app/views/plantings/_harvests.html.haml index 99535b6be..5edf14a3d 100644 --- a/app/views/plantings/_harvests.html.haml +++ b/app/views/plantings/_harvests.html.haml @@ -1,8 +1,12 @@ -- unless planting.harvests.empty? - Harvests: - %ul - - planting.harvests.includes(:crop).each do |harvest| - %li - = harvest.harvested_at ? harvest.harvested_at : "undated" - = link_to harvest, harvest_path(harvest) - = link_to "more harvests from this planting", planting_harvests_path(planting) +- if planting.harvests.empty? + %p no harvests yet +- else + .row + - planting.harvests.order(created_at: :desc).includes(:crop).each do |harvest| + .col-xs-6.col-md-2 + = render 'harvests/thumbnail', harvest: harvest + - if can? :edit, planting + .col-xs-6.col-md-2 + = link_to new_planting_harvest_path(planting), class: 'btn btn-primary' do + %span.glyphicon.glyphicon-leaf{ title: "Harvest" } + Harvest diff --git a/app/views/plantings/_progress.html.haml b/app/views/plantings/_progress.html.haml index 876259b85..a594de75d 100644 --- a/app/views/plantings/_progress.html.haml +++ b/app/views/plantings/_progress.html.haml @@ -1,15 +1,14 @@ - if planting.crop.perennial %p Perennial - elsif !planting.planted? - - if show_explanation == true - Progress: 0% - not planted yet + - if show_explanation + %p Progress: 0% - not planted yet = render "plantings/progress_bar", status: "not planted", progress: 0 - elsif planting.finished? = render "plantings/progress_bar", status: 'finished', progress: 100 - elsif planting.finish_predicted_at.nil? - if show_explanation == true - Progress: Not enough data + %p Progress: Not enough data = render "plantings/progress_bar", status: "unknown", progress: nil - - else = render "plantings/progress_bar", status: 'growing', progress: planting.percentage_grown diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index 099571218..7c197b7bd 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -9,6 +9,7 @@ = tag("meta", property: "og:url", content: request.original_url) = tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME']) +%p= render 'plantings/actions', planting: @planting .row.planting .col-md-6 %dl.dl-horizontal.planting-attributes @@ -45,11 +46,11 @@ %dd - if @planting.finish_predicted_at.present? = @planting.finish_predicted_at - - else + - elsif @planting.planted_at.blank? %strong Set planted date to get predictions - %dt Finished: - %dd= display_finished(@planting) - + - if @planting.finished? + %dt Finished: + %dd= display_finished(@planting) - if @planting.crop.median_lifespan.present? %dt Expected Lifespan: %dd #{@planting.crop.median_lifespan} days @@ -63,10 +64,11 @@ %dt Last Harvest: %dd #{@planting.days_to_last_harvest} days after planting - %p= render 'plantings/harvests', planting: @planting - %p= render 'plantings/progress', planting: @planting, show_explanation: true - = render 'plantings/actions', planting: @planting + %h2 Progress + %p= render 'plantings/progress', planting: @planting, show_explanation: true + %h2 Harvests + %p= render 'plantings/harvests', planting: @planting .col-md-6 = render partial: "crops/index_card", locals: { crop: @planting.crop } From bafe2b7fd1c82cb9c552b30e17948627baddba29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 12 Dec 2017 11:00:57 +0000 Subject: [PATCH 2/4] Bump coffeelint from 1.16.0 to 2.0.7 Bumps [coffeelint](https://github.com/clutchski/coffeelint) from 1.16.0 to 2.0.7. - [Commits](https://github.com/clutchski/coffeelint/commits) --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index fc703767c..013886a6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -195,19 +195,13 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, - "coffee-script": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.11.1.tgz", - "integrity": "sha1-vxxHrWREOg2V0S3ysUfMCk2q1uk=", - "dev": true - }, "coffeelint": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/coffeelint/-/coffeelint-1.16.0.tgz", - "integrity": "sha1-g9jtHa/eOmd95E57ihi+YHdh5tg=", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/coffeelint/-/coffeelint-2.0.7.tgz", + "integrity": "sha1-lg/VuXVrhFGU6fl6R1bmKGEha3Q=", "dev": true, "requires": { - "coffee-script": "1.11.1", + "coffeescript": "2.0.3", "glob": "7.1.2", "ignore": "3.3.7", "optimist": "0.6.1", @@ -215,6 +209,12 @@ "strip-json-comments": "1.0.4" } }, + "coffeescript": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.0.3.tgz", + "integrity": "sha512-iIfUN+71IyI2FQABXh1luzZeQgqwUPeWh6lDovJatQQs+30bvyGnBY0r4BnD0hoMAasNuZVHlL1U09Oy1ZfSeg==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", diff --git a/package.json b/package.json index a46ef1516..f41b67b64 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "dependencies": {}, "devDependencies": { - "coffeelint": "^1.16.0", + "coffeelint": "^2.0.7", "csslint": "^1.0.5", "eslint": "^3.17.1", "jshint": "^2.9.4" From 72f52230a19c148b6ac6a308edb3def86b17dc64 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 13 Dec 2017 22:15:11 +1300 Subject: [PATCH 3/4] Fix Growstuff::OauthSignupAction not found error when connecting flickr account --- app/controllers/authentications_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index 311cf7a9b..fc18ff4d7 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -1,3 +1,4 @@ +require './lib/actions/oauth_signup_action' class AuthenticationsController < ApplicationController before_action :authenticate_member! load_and_authorize_resource From 1f66df074377c14f7c701a825007e1a555613804 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 13 Dec 2017 22:23:22 +1300 Subject: [PATCH 4/4] Fixed link to associated flickr, twitter, facebook accountss fixes #1479 --- app/views/devise/registrations/_edit_apps.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/devise/registrations/_edit_apps.html.haml b/app/views/devise/registrations/_edit_apps.html.haml index d0482e015..924a0db8a 100644 --- a/app/views/devise/registrations/_edit_apps.html.haml +++ b/app/views/devise/registrations/_edit_apps.html.haml @@ -16,7 +16,7 @@ confirm: "Are you sure you want to remove this connection?", method: :delete, class: "remove" - else - = link_to 'Connect to Twitter', '/auth/twitter' + = link_to 'Connect to Twitter', '/members/auth/twitter' .row .col-md-12 @@ -30,7 +30,7 @@ confirm: "Are you sure you want to remove this connection?", method: :delete, class: "remove" - else - = link_to 'Connect to Flickr', '/auth/flickr' + = link_to 'Connect to Flickr', '/members/auth/flickr' .row .col-md-12 @@ -44,4 +44,4 @@ confirm: "Are you sure you want to remove this connection?", method: :delete, class: "remove" - else - = link_to 'Connect to Facebook', '/auth/facebook' + = link_to 'Connect to Facebook', '/members/auth/facebook'