Merge branch 'dev' into feature/photos-1457

This commit is contained in:
Shiny
2017-12-14 08:44:31 +13:00
committed by GitHub
11 changed files with 79 additions and 64 deletions

View File

@@ -1,3 +1,4 @@
require './lib/actions/oauth_signup_action'
class AuthenticationsController < ApplicationController
before_action :authenticate_member!
load_and_authorize_resource

View File

@@ -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'

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 }

20
package-lock.json generated
View File

@@ -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",

View File

@@ -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"