fix error
This commit is contained in:
parent
c40c552a1d
commit
c1a5e89d57
|
@ -381,8 +381,8 @@ class Admin::GalleriesController < OrbitAdminController
|
||||||
if sheet.count <= 203
|
if sheet.count <= 203
|
||||||
sheet.each_with_index do |row, i|
|
sheet.each_with_index do |row, i|
|
||||||
next if i < 3
|
next if i < 3
|
||||||
v = row.cells.first.value
|
v = row.cells.first.value rescue nil
|
||||||
next if v == "" || v.nil?
|
next if v.blank?
|
||||||
import_this_image(row, album)
|
import_this_image(row, album)
|
||||||
end
|
end
|
||||||
redirect_to admin_gallery_path(album.id)
|
redirect_to admin_gallery_path(album.id)
|
||||||
|
|
|
@ -3,15 +3,14 @@ module Admin::GalleriesHelper
|
||||||
value = {}
|
value = {}
|
||||||
image = AlbumImage.new
|
image = AlbumImage.new
|
||||||
row.cells.each_with_index do |cell,index|
|
row.cells.each_with_index do |cell,index|
|
||||||
next if cell.nil?
|
val = cell.value rescue nil
|
||||||
val = cell.value
|
next if val.blank?
|
||||||
next if val.nil? || val == ""
|
|
||||||
case index
|
case index
|
||||||
when 0
|
when 0
|
||||||
image.remote_file_url = val
|
image.remote_file_url = val
|
||||||
when 1
|
when 1
|
||||||
value["zh_tw"] = val
|
value["zh_tw"] = val
|
||||||
value["en"] = row.cells[index + 1].value rescue ""
|
value["en"] = (row.cells[index + 1].value rescue "")
|
||||||
image.description_translations = value
|
image.description_translations = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue