fix the problem that when upload failed if will lead to not upload
success furthor more and let show description tag can also work for image
This commit is contained in:
parent
b84c4af63a
commit
d82207aa68
|
@ -473,11 +473,11 @@ class Admin::GalleriesController < OrbitAdminController
|
||||||
|
|
||||||
def upload_process
|
def upload_process
|
||||||
if AlbumUnprocess.first.upload_success
|
if AlbumUnprocess.first.upload_success
|
||||||
album_unprocess = AlbumUnprocess.all
|
album_unprocess = Array(AlbumUnprocess.all)
|
||||||
count = album_unprocess.count
|
count = album_unprocess.count
|
||||||
Thread.new do
|
Thread.new do
|
||||||
begin
|
|
||||||
album_unprocess.each_with_index do |un_image,i|
|
album_unprocess.each_with_index do |un_image,i|
|
||||||
|
begin
|
||||||
album = AlbumImage.all.select{|value| value.id.to_s == un_image.image_id.to_s}[0]
|
album = AlbumImage.all.select{|value| value.id.to_s == un_image.image_id.to_s}[0]
|
||||||
album.file = un_image.save_var
|
album.file = un_image.save_var
|
||||||
album.save!
|
album.save!
|
||||||
|
@ -489,9 +489,10 @@ class Admin::GalleriesController < OrbitAdminController
|
||||||
variable.progress_filename = album[:file]
|
variable.progress_filename = album[:file]
|
||||||
variable.progress_percent = ((i+1)*100.0/count).floor.to_s + '%'
|
variable.progress_percent = ((i+1)*100.0/count).floor.to_s + '%'
|
||||||
variable.save!
|
variable.save!
|
||||||
end
|
|
||||||
rescue => e
|
rescue => e
|
||||||
puts ['err',e.inspect]
|
puts ['err',un_image.inspect,e.inspect]
|
||||||
|
un_image.destroy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
variable = AlbumVariable.first
|
variable = AlbumVariable.first
|
||||||
variable.finish = true
|
variable.finish = true
|
||||||
|
|
|
@ -63,7 +63,7 @@ class GalleriesController < ApplicationController
|
||||||
images = album.album_images.asc(:order).collect do |a|
|
images = album.album_images.asc(:order).collect do |a|
|
||||||
alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description)
|
alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description)
|
||||||
{
|
{
|
||||||
"image-description" => a.description,
|
"image-description" => (flag ? a.description : ''),
|
||||||
"alt_title" => alt_text,
|
"alt_title" => alt_text,
|
||||||
"link_to_show" => "/xhr/galleries/theater/" + a.id.to_s,
|
"link_to_show" => "/xhr/galleries/theater/" + a.id.to_s,
|
||||||
"thumb-src" => a.file.thumb.url
|
"thumb-src" => a.file.thumb.url
|
||||||
|
|
Loading…
Reference in New Issue