gallery/app/helpers/admin/galleries_helper.rb

22 lines
517 B
Ruby
Raw Normal View History

2014-05-01 07:06:48 +00:00
module Admin::GalleriesHelper
2016-12-20 11:43:54 +00:00
def import_this_image(row,album)
value = {}
image = AlbumImage.new
row.cells.each_with_index do |cell,index|
next if cell.nil?
val = cell.value
next if val.nil? || val == ""
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
2014-05-01 07:06:48 +00:00
end