Merge remote-tracking branch 'origin/feature/photos-1457' into feature/photos-1457

This commit is contained in:
Brenda Wallace
2017-12-17 08:55:41 +13:00
7 changed files with 11 additions and 9 deletions

View File

@@ -6,5 +6,5 @@ haml:
config_file: .haml-lint.yml
scss:
config_file: .scss-lint.yml
# eslint:
# config_file: .eslintrc
eslint:
config_file: .eslintrc

View File

@@ -58,7 +58,7 @@ GEM
public_suffix (>= 2.0.2, < 4.0)
arel (6.0.4)
ast (2.3.0)
autoprefixer-rails (7.2.2)
autoprefixer-rails (7.2.3)
execjs
bcrypt (3.1.11)
better_errors (2.2.0)
@@ -353,8 +353,8 @@ GEM
omniauth-oauth (1.1.0)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth-oauth2 (1.5.0)
oauth2 (~> 1.1)
omniauth (~> 1.2)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
@@ -376,7 +376,7 @@ GEM
moneta (~> 0.8.1)
plupload-rails (1.2.1)
rails (>= 3.1)
poltergeist (1.16.0)
poltergeist (1.17.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)

View File

@@ -26,6 +26,7 @@ class Planting < ActiveRecord::Base
scope :finished, -> { where(finished: true) }
scope :current, -> { where(finished: false) }
scope :interesting, -> { has_photos.one_per_owner }
scope :recent, -> { order(created_at: :desc) }
scope :one_per_owner, lambda {
joins("JOIN members m ON (m.id=plantings.owner_id)
LEFT OUTER JOIN plantings p2

View File

@@ -43,7 +43,7 @@ class Post < ActiveRecord::Base
# return posts sorted by recent activity
def self.recently_active
Post.all.sort do |a, b|
Post.order(created_at: :desc).sort do |a, b|
b.recent_activity <=> a.recent_activity
end
end

View File

@@ -14,7 +14,7 @@
.col-md-4.hidden-xs
- cache cache_key_for(Planting) do
%h2= t('.recently_planted')
= render partial: 'plantings/list', locals: { plantings: Planting.includes(:owner, :photos).interesting.first(6) }
= render 'plantings/list', plantings: Planting.includes(:owner, :photos).interesting.recent.first(6)
.row
.col-md-12

View File

@@ -2,7 +2,7 @@
- posts = Post.limit(6)
- if posts
= render partial: "posts/summary", locals: { posts: posts, howmany: 6 }
= render "posts/summary", posts: posts, howmany: 6
- cache cache_key_for(Forum) do
- forums = Forum.all.order(:name)

View File

@@ -5,6 +5,7 @@ describe "seeds/show" do
controller.stub(:current_user) { nil }
@seed = FactoryBot.create(:seed)
assign(:seed, @seed)
assign(:photos, @seed.photos)
end
it "renders attributes in <p>" do