mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-09-30 09:54:28 -04:00
Paginate garden photos and limit plantings in garden views (#4830)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Brenda Wallace <brenda@wallace.net.nz>
This commit is contained in:
3 files changed
+7
-5
No files matched your search
@@ -39,6 +39,7 @@ class GardensController < DataController
|
||||
@suggested_companions = Crop.approved.where(
|
||||
id: CropCompanion.where(crop_a_id: @current_plantings.select(:crop_id)).select(:crop_b_id)
|
||||
).order(:name)
|
||||
@photos = @garden.photos.includes(:owner).order(created_at: :desc, id: :desc).paginate(page: params[:page])
|
||||
respond_with(@garden)
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
%section
|
||||
- if active_plantings.perennial.any?
|
||||
%strong Perennials:
|
||||
- active_plantings.perennial.each do |planting|
|
||||
- active_plantings.perennial.limit(10).each do |planting|
|
||||
= link_to planting do
|
||||
= crop_icon planting.crop
|
||||
= planting.crop
|
||||
@@ -32,6 +32,6 @@
|
||||
|
||||
%section
|
||||
- if active_plantings.annual.any?
|
||||
= render 'plantings/progress_list', plantings: garden.plantings.active.annual
|
||||
= render 'plantings/progress_list', plantings: active_plantings.annual.limit(5)
|
||||
- else
|
||||
%p No annual plantings
|
||||
@@ -49,7 +49,7 @@
|
||||
%section.card
|
||||
%h2 Garden progress
|
||||
.card-body
|
||||
= render 'plantings/progress_list', plantings: @garden.plantings.active
|
||||
= render 'plantings/progress_list', plantings: @garden.plantings.active.limit(10)
|
||||
|
||||
%section
|
||||
%h2 Current plantings in garden
|
||||
@@ -177,9 +177,10 @@
|
||||
%%p
|
||||
= add_photo_button(@garden)
|
||||
|
||||
- if @garden.photos.size.positive?
|
||||
- if @photos.present? && @photos.any?
|
||||
%section.photos
|
||||
%h2= localize_plural(@garden.photos, Photo)
|
||||
.index-cards
|
||||
- @garden.photos.includes(:owner).each do |photo|
|
||||
- @photos.each do |photo|
|
||||
= render 'photos/thumbnail', photo: photo
|
||||
= will_paginate @photos
|
||||
Reference in new issue
Block a user