Skip to content

Commit fac24c5

Browse files
authored
Merge pull request #1423 from Growstuff/dev
Release 31
2 parents 494dd1d + fa600be commit fac24c5

File tree

178 files changed

+2587
-1084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2587
-1084
lines changed

.rubocop.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ Style/FileName:
1919
Style/StringLiterals:
2020
Enabled: false
2121

22+
# Stop hound and codeclimate fighting
23+
Style/PercentLiteralDelimiters:
24+
PreferredDelimiters:
25+
default: ()
26+
'%i': ()
27+
'%w': ()
28+
2229
Style/MultilineMethodCallIndentation:
2330
EnforcedStyle: indented
2431

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ submit the change with your pull request.
8181
- Arun Kumar / [arun1595](https://github.com/arun1595)
8282
- Harry Brodsky / [hbrodsk1](https://github.com/hbrodsk1)
8383
- Jeff Kingswood / [ancyentmariner](https://github.com/ancyentmariner)
84+
- Logan Gingerich / [logangingerich](https://github.com/logangingerich)
8485

8586
## Bots
8687

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ group :development, :test do
124124
gem 'capybara-screenshot' # for test debugging
125125
gem 'coveralls', require: false # coverage analysis
126126
gem 'database_cleaner'
127-
gem 'factory_girl_rails' # for creating test data
127+
gem 'factory_bot_rails' # for creating test data
128128
gem 'haml-i18n-extractor'
129129
gem 'haml-rails' # HTML templating language
130130
gem 'haml_lint' # Checks haml files for goodness

Gemfile.lock

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ GEM
3131
activejob (4.2.10)
3232
activesupport (= 4.2.10)
3333
globalid (>= 0.3.0)
34-
activemerchant (1.73.0)
34+
activemerchant (1.74.0)
3535
activesupport (>= 3.2.14, < 6.x)
3636
builder (>= 2.1.2, < 4.0.0)
3737
i18n (>= 0.6.9)
@@ -143,7 +143,7 @@ GEM
143143
d3-rails (3.5.17)
144144
railties (>= 3.1)
145145
dalli (2.7.6)
146-
database_cleaner (1.6.1)
146+
database_cleaner (1.6.2)
147147
debug_inspector (0.0.3)
148148
devise (4.3.0)
149149
bcrypt (~> 3.0)
@@ -173,10 +173,10 @@ GEM
173173
erubis (2.7.0)
174174
excon (0.59.0)
175175
execjs (2.7.0)
176-
factory_girl (4.8.1)
176+
factory_bot (4.8.2)
177177
activesupport (>= 3.0.0)
178-
factory_girl_rails (4.8.0)
179-
factory_girl (~> 4.8.0)
178+
factory_bot_rails (4.8.2)
179+
factory_bot (~> 4.8.2)
180180
railties (>= 3.0.0)
181181
faraday (0.12.2)
182182
multipart-post (>= 1.2, < 3)
@@ -193,7 +193,7 @@ GEM
193193
gibbon (1.2.1)
194194
httparty
195195
multi_json (>= 1.9.0)
196-
globalid (0.4.0)
196+
globalid (0.4.1)
197197
activesupport (>= 4.2.0)
198198
gravatar-ultimate (2.0.0)
199199
activesupport (>= 2.3.14)
@@ -417,7 +417,7 @@ GEM
417417
thor (>= 0.18.1, < 2.0)
418418
rainbow (2.1.0)
419419
raindrops (0.19.0)
420-
rake (12.1.0)
420+
rake (12.2.1)
421421
rb-fsevent (0.10.2)
422422
rb-inotify (0.9.10)
423423
ffi (>= 0.5.0, < 2)
@@ -462,7 +462,7 @@ GEM
462462
ruby_parser (3.10.1)
463463
sexp_processor (~> 4.9)
464464
rubyzip (1.2.1)
465-
sass (3.5.2)
465+
sass (3.5.3)
466466
sass-listen (~> 4.0.0)
467467
sass-listen (4.0.0)
468468
rb-fsevent (~> 0.9, >= 0.9.4)
@@ -510,7 +510,7 @@ GEM
510510
timecop (0.9.1)
511511
tins (1.15.0)
512512
trollop (1.16.2)
513-
tzinfo (1.2.3)
513+
tzinfo (1.2.4)
514514
thread_safe (~> 0.1)
515515
uglifier (3.2.0)
516516
execjs (>= 0.3.0, < 3)
@@ -567,7 +567,7 @@ DEPENDENCIES
567567
elasticsearch-api (~> 2.0.0)
568568
elasticsearch-model
569569
elasticsearch-rails
570-
factory_girl_rails
570+
factory_bot_rails
571571
figaro
572572
flickraw
573573
font-awesome-sass
@@ -622,7 +622,6 @@ DEPENDENCIES
622622
will_paginate
623623
xmlrpc
624624

625-
626625
RUBY VERSION
627626
ruby 2.4.1p111
628627

app/controllers/photos_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ class PhotosController < ApplicationController
66
responders :flash
77

88
def index
9-
@photos = Photo.paginate(page: params[:page])
9+
if params[:crop_id]
10+
@crop = Crop.find params[:crop_id]
11+
@photos = @crop.photos
12+
else
13+
@photos = Photo.all
14+
end
15+
@photos = @photos.includes(:owner).order(:created_at).paginate(page: params[:page])
1016
respond_with(@photos)
1117
end
1218

app/models/crop.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ class Crop < ActiveRecord::Base
106106
end
107107
end
108108

109+
def harvest_photos
110+
Photo.joins(:harvests).where("harvests.crop_id": id)
111+
end
112+
109113
def as_indexed_json(_options = {})
110114
as_json(
111115
only: [:id, :name, :approval_status],

app/models/garden.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Garden < ActiveRecord::Base
2323

2424
validates :name,
2525
format: {
26-
with: /\A\w+[\w ]+\z/
26+
with: /\A\w+[\w ()]+\z/
2727
},
2828
length: { maximum: 255 }
2929

app/models/member.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Member < ActiveRecord::Base
9191

9292
# and an account record (for paid accounts etc)
9393
# we use find_or_create to avoid accidentally creating a second one,
94-
# which can happen sometimes especially with FactoryGirl associations
94+
# which can happen sometimes especially with FactoryBot associations
9595
after_create { |member| Account.find_or_create_by(member_id: member.id) }
9696

9797
after_save :update_newsletter_subscription

app/views/crops/_photos.html.haml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
%h2 Photos of #{crop.name} harvests
2+
.row
3+
- unless crop.harvest_photos.empty?
4+
- crop.harvest_photos.includes(:owner).first(3).each do |p|
5+
.col-md-4
6+
= render "photos/thumbnail", photo: p
7+
8+
%h2 Photos of #{crop.name} plants
19
.row
210
- unless crop.photos.empty?
3-
- crop.photos.first(3).each do |p|
11+
- crop.photos.includes(:owner).first(3).each do |p|
412
.col-md-4
5-
= render partial: "photos/thumbnail", locals: { photo: p }
13+
= render "photos/thumbnail", photo: p
14+
.row
15+
= link_to "more photos", crop_photos_path(crop_id: crop.id)

app/views/photos/index.html.haml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
- content_for :title, "Photos"
22

3+
- if @crop
4+
%h2= @crop.name
5+
36
%p Most recent photos added to #{ENV['GROWSTUFF_SITE_NAME']}.
47

58
.pagination
69
= page_entries_info @photos
710
= will_paginate @photos
811

12+
913
.row
1014
- @photos.each do |p|
1115
.col-md-2.six-across
@@ -19,5 +23,3 @@
1923
.pagination
2024
= page_entries_info @photos
2125
= will_paginate @photos
22-
23-

0 commit comments

Comments
 (0)