fix error
This commit is contained in:
parent
ec834f143b
commit
8cd0c0774a
|
@ -64,7 +64,7 @@ class GalleriesController < ApplicationController
|
||||||
galleries = albums.collect do |a|
|
galleries = albums.collect do |a|
|
||||||
doc = Nokogiri::HTML(a.description.to_s)
|
doc = Nokogiri::HTML(a.description.to_s)
|
||||||
alt_text = doc.text.empty? ? 'gallery image' : doc.text
|
alt_text = doc.text.empty? ? 'gallery image' : doc.text
|
||||||
colors = album_color_map[a.id]
|
colors = album_color_map[a.id] || []
|
||||||
{
|
{
|
||||||
"album-name" => a.name,
|
"album-name" => a.name,
|
||||||
"album-description" => a.description,
|
"album-description" => a.description,
|
||||||
|
@ -86,7 +86,7 @@ class GalleriesController < ApplicationController
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
album = Album.find_by_param(params[:uid])
|
album = Album.find_by_param(params[:uid])
|
||||||
flag = show_desc?
|
flag = show_desc?
|
||||||
colors = AlbumColor.where(:album_id=> album.id).pluck(:color,:album_card_background_color,:album_card_text_color)[0] rescue []
|
colors = (AlbumColor.where(:album_id=> album.id).pluck(:color,:album_card_background_color,:album_card_text_color)[0])||[] rescue []
|
||||||
images = album.album_images.asc(:order).collect do |a|
|
images = album.album_images.asc(:order).collect do |a|
|
||||||
alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description.to_s).text())
|
alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description.to_s).text())
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ class GalleriesController < ApplicationController
|
||||||
galleries = albums.collect.with_index do |a,i|
|
galleries = albums.collect.with_index do |a,i|
|
||||||
doc = Nokogiri::HTML(a.description.to_s)
|
doc = Nokogiri::HTML(a.description.to_s)
|
||||||
alt_text = doc.text.empty? ? 'gallery image' : doc.text.strip
|
alt_text = doc.text.empty? ? 'gallery image' : doc.text.strip
|
||||||
colors = album_color_map[a.id]
|
colors = album_color_map[a.id] || []
|
||||||
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
|
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
|
||||||
cover_image = AlbumImage.find(a.cover) rescue a.album_images.first
|
cover_image = AlbumImage.find(a.cover) rescue a.album_images.first
|
||||||
image_description = a.description
|
image_description = a.description
|
||||||
|
@ -193,7 +193,7 @@ class GalleriesController < ApplicationController
|
||||||
counts = OrbitHelper.widget_data_count
|
counts = OrbitHelper.widget_data_count
|
||||||
images = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts)
|
images = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts)
|
||||||
images = images.each_with_index.collect do |a,i|
|
images = images.each_with_index.collect do |a,i|
|
||||||
colors = album_color_map[a.album_id]
|
colors = album_color_map[a.album_id] || []
|
||||||
alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description).text().strip)
|
alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description).text().strip)
|
||||||
f = a.file
|
f = a.file
|
||||||
ab = albums_map[a.album_id]
|
ab = albums_map[a.album_id]
|
||||||
|
|
Loading…
Reference in New Issue