loop fixed for gallery widget
This commit is contained in:
parent
6624156d57
commit
52278526e8
|
@ -36,9 +36,13 @@ class GalleriesController < ApplicationController
|
|||
params = OrbitHelper.params
|
||||
|
||||
images = []
|
||||
|
||||
total_images = 0
|
||||
if !albums.blank?
|
||||
while images.count < 9 and images.count < AlbumImage.count
|
||||
albums.each do |album|
|
||||
total_images = total_images + album.album_images.count
|
||||
end
|
||||
total_images = total_images > 9 ? 9 : total_images
|
||||
while images.count < total_images and images.count < AlbumImage.count
|
||||
albums.each do |album|
|
||||
img = album.album_images.sample
|
||||
if !images.include?(img) && img != nil
|
||||
|
|
Loading…
Reference in New Issue