mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-08 15:54:43 -04:00
Merge branch 'dev' into bw/readme-new-contributors
This commit is contained in:
11
Gemfile.lock
11
Gemfile.lock
@@ -20,8 +20,9 @@ GEM
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_link_to (1.0.3)
|
||||
active_link_to (1.0.4)
|
||||
actionpack
|
||||
addressable
|
||||
active_merchant-paypal-bogus-gateway (0.1.0)
|
||||
activemerchant
|
||||
active_utils (3.3.0)
|
||||
@@ -76,7 +77,7 @@ GEM
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
cancancan (1.16.0)
|
||||
capybara (2.12.1)
|
||||
capybara (2.13.0)
|
||||
addressable
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
@@ -296,7 +297,7 @@ GEM
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
nenv (0.3.0)
|
||||
newrelic_rpm (3.18.1.330)
|
||||
newrelic_rpm (4.0.0.332)
|
||||
nokogiri (1.7.0.1)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
notiffany (0.1.1)
|
||||
@@ -339,7 +340,7 @@ GEM
|
||||
phantomjs (2.1.1.0)
|
||||
plupload-rails (1.2.1)
|
||||
rails (>= 3.1)
|
||||
poltergeist (1.13.0)
|
||||
poltergeist (1.14.0)
|
||||
capybara (~> 2.1)
|
||||
cliver (~> 0.3.1)
|
||||
websocket-driver (>= 0.2.0)
|
||||
@@ -447,7 +448,7 @@ GEM
|
||||
websocket (~> 1.0)
|
||||
sexp_processor (4.8.0)
|
||||
shellany (0.0.1)
|
||||
sidekiq (4.2.9)
|
||||
sidekiq (4.2.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
connection_pool (~> 2.2, >= 2.2.0)
|
||||
rack-protection (>= 1.5.0)
|
||||
|
||||
@@ -9,6 +9,8 @@ class HarvestsController < ApplicationController
|
||||
def index
|
||||
@owner = Member.find_by(slug: params[:owner])
|
||||
@crop = Crop.find_by(slug: params[:crop])
|
||||
@planting = Planting.find_by(slug: params['planting_id'])
|
||||
|
||||
@harvests = harvests
|
||||
@filename = csv_filename
|
||||
respond_with(@harvests)
|
||||
@@ -79,6 +81,8 @@ class HarvestsController < ApplicationController
|
||||
@owner.harvests
|
||||
elsif @crop
|
||||
@crop.harvests
|
||||
elsif @planting_id
|
||||
@planting.harvests
|
||||
else
|
||||
Harvest
|
||||
end.includes(:owner, :crop).paginate(page: params[:page])
|
||||
|
||||
@@ -93,11 +93,13 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def title(type, owner, crop)
|
||||
def title(type, owner, crop, planting)
|
||||
if owner
|
||||
t(".title.owner_#{type}", owner: owner.login_name)
|
||||
elsif crop
|
||||
t(".title.crop_#{type}", crop: crop.name)
|
||||
elsif planting
|
||||
t(".title.planting_#{type}", planting: planting.to_s)
|
||||
else
|
||||
t(".title.default")
|
||||
end
|
||||
|
||||
15
app/views/harvests/_nav.haml
Normal file
15
app/views/harvests/_nav.haml
Normal file
@@ -0,0 +1,15 @@
|
||||
%p
|
||||
- if can? :create, Harvest
|
||||
- if @planting && @planting.owner == current_member
|
||||
= link_to 'Add harvest', new_planting_harvest_path(planting: @planting), class: 'btn btn-primary'
|
||||
- elsif @owner
|
||||
%p
|
||||
- if @owner == current_member
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
= link_to "View everyone's harvests", harvests_path, class: 'btn btn-default'
|
||||
- else # everyone's harvests
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
- if current_member
|
||||
= link_to 'View your harvests', harvests_by_owner_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: 'track your harvests' }
|
||||
@@ -1,4 +1,4 @@
|
||||
- content_for :title, title('harvests', @owner, @crop)
|
||||
- content_for :title, title('harvests', @owner, @crop, @planting)
|
||||
|
||||
- if @owner
|
||||
= link_to "View #{@owner}'s profile >>", member_path(@owner)
|
||||
@@ -7,20 +7,7 @@
|
||||
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
|
||||
harvesting from your home garden and see how productive it is.
|
||||
|
||||
%p
|
||||
- if can? :create, Harvest
|
||||
- if @owner
|
||||
%p
|
||||
- if @owner == current_member
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
= link_to "View everyone's harvests", harvests_path, class: 'btn btn-default'
|
||||
- else # everyone's harvests
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
- if current_member
|
||||
= link_to 'View your harvests', harvests_by_owner_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: 'track your harvests' }
|
||||
|
||||
= render "nav"
|
||||
.pagination
|
||||
= page_entries_info @harvests
|
||||
= will_paginate @harvests
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
Harvests:
|
||||
- if planting.harvests
|
||||
Harvests:
|
||||
%ul
|
||||
- planting.harvests.each do |harvest|
|
||||
%li
|
||||
= harvest.harvested_at ? harvest.harvested_at : "undated"
|
||||
= link_to harvest, harvest_path(harvest)
|
||||
- else
|
||||
none
|
||||
= link_to "more harvests from this planting", planting_harvests_path(planting)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- content_for :title, title('plantings', @owner, @crop)
|
||||
- content_for :title, title('plantings', @owner, @crop, @planting)
|
||||
|
||||
= render 'nav', owner: @owner, show_all: @show_all
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- content_for :title, title('seeds', @owner, @crop)
|
||||
- content_for :title, title('seeds', @owner, @crop, @planting)
|
||||
- if @owner
|
||||
= link_to "View #{@owner}'s profile >>", member_path(@owner)
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ en:
|
||||
index:
|
||||
title:
|
||||
crop_harvests: Everyone's %{crop} harvests
|
||||
planting_harvests: Harvests from %{planting}
|
||||
default: Everyone's harvests
|
||||
owner_harvests: "%{owner} harvests"
|
||||
updated: Harvest was successfully updated.
|
||||
|
||||
Reference in New Issue
Block a user