add widget count
This commit is contained in:
parent
09ae60a172
commit
481f345382
|
@ -36,6 +36,7 @@ class GalleriesController < ApplicationController
|
||||||
def widget
|
def widget
|
||||||
albums = Album.filter_by_widget_categories
|
albums = Album.filter_by_widget_categories
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
|
counts = OrbitHelper.widget_data_count
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
total_images = 0
|
total_images = 0
|
||||||
|
@ -43,8 +44,8 @@ class GalleriesController < ApplicationController
|
||||||
albums.each do |album|
|
albums.each do |album|
|
||||||
total_images = total_images + album.album_images.count
|
total_images = total_images + album.album_images.count
|
||||||
end
|
end
|
||||||
total_images = total_images > 9 ? 9 : total_images
|
total_images = counts > 9 ? 9 : counts
|
||||||
while images.count < total_images and images.count < AlbumImage.count
|
while images.count < counts and images.count < AlbumImage.count
|
||||||
albums.each do |album|
|
albums.each do |album|
|
||||||
img = album.album_images.sample
|
img = album.album_images.sample
|
||||||
if !images.include?(img) && img != nil
|
if !images.include?(img) && img != nil
|
||||||
|
|
|
@ -5,7 +5,8 @@ module Gallery
|
||||||
module_label "gallery.gallery"
|
module_label "gallery.gallery"
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
widget_methods ["widget"]
|
widget_methods ["widget"]
|
||||||
widget_settings []
|
# widget_settings []
|
||||||
|
widget_settings [{"data_count"=>10}]
|
||||||
categorizable
|
categorizable
|
||||||
authorizable
|
authorizable
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
|
|
Loading…
Reference in New Issue