module Admin::CustomGalleriesHelper
def back_end_breadcrumb
if params[:controller] == "admin/custom_galleries"
res = ''
divider = "/"
res << "
#{t(:dashboard_)}#{divider}"
if params[:custom_module]
trans_name = I18n.t("module_name.#{params[:custom_module]}")
if trans_name.include?("translation missing")
trans_name = params[:custom_module]
end
res << "#{trans_name}#{divider}"
end
if params[:action] != "index"
if params[:custom_module]
extra_url = "/#{params[:custom_module]}#{params[:bind_uid].present? ? ('-'+params[:bind_uid]) : ''}"
end
res << "#{t('module_name.'+@module_app.key)}#{divider}"
res << "#{t(params[:action], scope: 'restful_actions')}"
else
res << "#{t('module_name.'+@module_app.key)}"
end
res.html_safe
else
super
end
end
def import_this_image(row,custom_album)
value = {}
image = CustomAlbumImage.new
image.custom_album = custom_album
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.save
end
end