From ff652ae23484eb2d34ef4cc361bc621453ee613b Mon Sep 17 00:00:00 2001 From: deppbot Date: Thu, 14 Dec 2017 20:10:52 +0800 Subject: [PATCH 1/3] Bundle Update on 2017-12-14 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index de0b44b30..d18bb7ea6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) From 8697e56323badc51479ca759f141930233da66f3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 15 Dec 2017 13:26:48 +1300 Subject: [PATCH 2/3] Order the plantings on the front page --- app/models/planting.rb | 1 + app/views/home/_crops.html.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/planting.rb b/app/models/planting.rb index 85e5277c0..c51166264 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -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 diff --git a/app/views/home/_crops.html.haml b/app/views/home/_crops.html.haml index 274cd4957..6f881dc32 100644 --- a/app/views/home/_crops.html.haml +++ b/app/views/home/_crops.html.haml @@ -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 From 3d3a3b669e2d0d7971dd63c1a44532e7478695c6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 15 Dec 2017 13:28:41 +1300 Subject: [PATCH 3/3] Order posts by most recent --- app/models/post.rb | 2 +- app/views/home/_discuss.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 76dfcd5d8..43885e99d 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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 diff --git a/app/views/home/_discuss.html.haml b/app/views/home/_discuss.html.haml index 9ffc6b502..36cc1d0f9 100644 --- a/app/views/home/_discuss.html.haml +++ b/app/views/home/_discuss.html.haml @@ -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)