21 lines
495 B
Ruby
21 lines
495 B
Ruby
module Admin::GalleriesHelper
|
|
def import_this_image(row,album)
|
|
value = {}
|
|
image = AlbumImage.new
|
|
row.cells.each_with_index do |cell,index|
|
|
val = cell.value rescue nil
|
|
next if val.blank?
|
|
case index
|
|
when 0
|
|
image.remote_file_url = val
|
|
when 1
|
|
value["zh_tw"] = val
|
|
value["en"] = (row.cells[index + 1].value rescue "")
|
|
image.description_translations = value
|
|
end
|
|
end
|
|
image.album = album
|
|
image.save
|
|
end
|
|
end
|