id覆蓋檔案匯入
This commit is contained in:
parent
b1d9692b82
commit
e9375e6449
0
app/assets/javascripts/mind_map/jsmind/plugins/jsmind.draggable-node.js
Normal file → Executable file
0
app/assets/javascripts/mind_map/jsmind/plugins/jsmind.draggable-node.js
Normal file → Executable file
|
|
@ -136,109 +136,129 @@ end
|
|||
end
|
||||
|
||||
def import_data_from_excel
|
||||
site_in_use_locales = @site_in_use_locales.sort
|
||||
workbook = RubyXL::Parser.parse(params["import_data"].tempfile)
|
||||
response = {}
|
||||
current_locale = I18n.locale
|
||||
table = UTable.find(params["universal_table_id"]) rescue nil
|
||||
if !table.nil?
|
||||
if table.nil?
|
||||
render json: { success: false, msg: "Table not found." }.to_json and return
|
||||
end
|
||||
|
||||
sheet = workbook[0]
|
||||
if sheet.count <= 503
|
||||
columns = sheet[1].cells.collect.with_index{|c,i|
|
||||
c.value.blank? ? table.table_columns.where(:title => sheet[0].cells[i].value.to_s.split("-").first.strip).first : table.table_columns.where(:key => c.value.to_s).first
|
||||
}
|
||||
languages = sheet[2].cells.collect{|c|
|
||||
c.value.split("-").last rescue nil
|
||||
}
|
||||
if sheet.count > 503
|
||||
render json: { success: false, msg: "More than 500 entries. Please split the entries in different files." }.to_json and return
|
||||
end
|
||||
|
||||
# 前三列是欄位名、key、格式描述
|
||||
column_titles = sheet[0].cells.map { |c| c&.value.to_s.strip }
|
||||
column_keys = sheet[1].cells.map { |c| c&.value.to_s.strip }
|
||||
column_types = sheet[2].cells.map { |c| c&.value.to_s.strip }
|
||||
|
||||
# 準備欄位對應
|
||||
columns = column_keys.uniq.map.with_index do |key, i|
|
||||
tc = table.table_columns.where(key: key).first
|
||||
[i, tc]
|
||||
end.to_h
|
||||
|
||||
sheet.each_with_index do |row, i|
|
||||
next if i < 3
|
||||
te = TableEntry.new
|
||||
next if i < 3 || row.cells.compact.map { |c| c.value.to_s.strip }.all?(&:blank?)
|
||||
uid_val = row[0]&.value.to_s.strip rescue nil
|
||||
te = uid_val.present? ?
|
||||
TableEntry.where(uid: uid_val, u_table_id: table.id).first_or_initialize :
|
||||
TableEntry.new
|
||||
te.u_table = table
|
||||
skip = 0
|
||||
row.cells.each_with_index do |cell,index|
|
||||
if skip > 1
|
||||
skip = skip - 1
|
||||
next
|
||||
end
|
||||
skip = 0
|
||||
val = cell.value rescue nil
|
||||
tc = columns[index]
|
||||
if !tc.nil?
|
||||
ce = ColumnEntry.new
|
||||
|
||||
tc_idx = 0
|
||||
|
||||
row.cells.each_with_index do |cell, col_idx|
|
||||
next if skip > 0 && (skip -= 1) >= 0
|
||||
|
||||
val = cell&.value
|
||||
tc = columns[tc_idx]
|
||||
tc_idx += 1
|
||||
next if tc.nil?
|
||||
|
||||
ce = te.column_entries.where(table_column_id: tc.id).first
|
||||
ce = ColumnEntry.new(table_column_id: tc.id) if ce.nil?
|
||||
case tc.type
|
||||
when "text"
|
||||
when "text", "editor"
|
||||
v = {}
|
||||
@site_in_use_locales.sort.each_with_index do |locale,x|
|
||||
v[locale.to_s] = row.cells[index + x].value rescue nil
|
||||
skip = skip + 1
|
||||
site_in_use_locales.each_with_index do |locale, offset|
|
||||
v[locale.to_s] = row[col_idx + offset]&.value.to_s rescue ""
|
||||
end
|
||||
skip = site_in_use_locales.size - 1
|
||||
if tc.type == "text"
|
||||
ce.text_translations = v
|
||||
when "integer"
|
||||
ce.number = (val.blank? ? nil : val)
|
||||
when "image"
|
||||
ce.remote_image_url = val
|
||||
when "file"
|
||||
if !val.nil?
|
||||
val.split("\;").each do |remote_file|
|
||||
file = ColumnEntryFile.new
|
||||
file.remote_file_url = remote_file
|
||||
filename = {}
|
||||
file.choose_lang.reject(&:empty?).each do |lang|
|
||||
filename[lang] = file.file.file.filename
|
||||
else
|
||||
ce.content_translations = v
|
||||
end
|
||||
file.file_title_translations = filename
|
||||
# file.column_entry_id = ce.id
|
||||
file.save
|
||||
|
||||
when "integer"
|
||||
ce.number = val.present? ? val.to_i : nil
|
||||
|
||||
when "image"
|
||||
ce.remote_image_url = val if val.present?
|
||||
when "file"
|
||||
file_urls = val.to_s.split(";").map(&:strip)
|
||||
file_titles = row[col_idx + 1]&.value.to_s.split(";").map(&:strip)
|
||||
skip = 1
|
||||
|
||||
ce.column_entry_files.destroy_all
|
||||
ce.column_entry_files = []
|
||||
|
||||
file_urls.each_with_index do |remote_url, file_idx|
|
||||
next if remote_url.blank?
|
||||
file = ColumnEntryFile.new
|
||||
file.remote_file_url = remote_url
|
||||
|
||||
# 處理多語言標題
|
||||
titles = {}
|
||||
site_in_use_locales.each do |locale|
|
||||
titles[locale.to_s] = file_titles[file_idx] rescue file.file.file.filename
|
||||
end
|
||||
file.file_title_translations = titles
|
||||
file.save!
|
||||
ce.column_entry_files << file
|
||||
end
|
||||
end
|
||||
when "editor"
|
||||
v = {}
|
||||
@site_in_use_locales.sort.each_with_index do |locale,x|
|
||||
v[locale.to_s] = row.cells[index + x].value rescue nil
|
||||
skip = skip + 1
|
||||
end
|
||||
ce.content_translations = v
|
||||
when "date"
|
||||
ce.date = val
|
||||
|
||||
when "period"
|
||||
if tc.date_format == "yyyy" && !val.nil?
|
||||
val = val.to_s + "/01/01"
|
||||
end
|
||||
skip = 2
|
||||
skip = 1
|
||||
ce.period_from = val
|
||||
val = row.cells[index + 1].value rescue nil
|
||||
if tc.date_format == "yyyy" && !val.nil?
|
||||
val = val.to_s + "/01/01"
|
||||
ce.period_to = row[col_idx + 1]&.value rescue nil
|
||||
end
|
||||
ce.period_to = val
|
||||
end
|
||||
ce.table_column_id = tc.id
|
||||
ce.save
|
||||
|
||||
ce.save!
|
||||
te.column_entries << ce
|
||||
else
|
||||
if index == (columns.count - 2)
|
||||
create_get_table_tags(te, val.split("\;"))
|
||||
end
|
||||
if index == (columns.count - 1)
|
||||
te.related_entries = TableEntry.where(:uid.in => val.to_s.split("\;")).pluck(:id).join(",")
|
||||
|
||||
# hashtags (倒數第2欄)
|
||||
if row.cells.count >= 2
|
||||
tags_text = row.cells[-2]&.value.to_s rescue ""
|
||||
create_get_table_tags(te, tags_text.split(";"))
|
||||
end
|
||||
|
||||
# related_entries (倒數第1欄)
|
||||
if row.cells.count >= 1
|
||||
related_uids = row.cells[-1]&.value.to_s.split(";").map(&:strip)
|
||||
related_ids = TableEntry.where(:uid.in => related_uids).pluck(:id)
|
||||
te.related_entries = related_ids.join(",")
|
||||
end
|
||||
end
|
||||
te.save
|
||||
|
||||
te.save!
|
||||
te.fix_have_data
|
||||
te.uid = uid_val if uid_val.present?
|
||||
te.save!
|
||||
end
|
||||
response["success"] = true
|
||||
response["count"] = table.table_entries.count
|
||||
response["id"] = table.id.to_s
|
||||
else
|
||||
response["success"] = false
|
||||
response["msg"] = "More than 500 entries. Please split the entries in different files."
|
||||
end
|
||||
else
|
||||
response["success"] = false
|
||||
response["msg"] = "Table not found."
|
||||
end
|
||||
render :json => response.to_json
|
||||
|
||||
render json: {
|
||||
success: true,
|
||||
count: table.table_entries.count,
|
||||
id: table.id.to_s
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def new_entry
|
||||
|
|
|
|||
|
|
@ -13,64 +13,111 @@ class UniversalTablesController < ApplicationController
|
|||
def export_filtered
|
||||
table = UTable.where(:category_id => params[:cat]).first rescue nil
|
||||
page = Page.where(:page_id => params[:page_id]).first
|
||||
if !table.nil?
|
||||
return unless table
|
||||
|
||||
host_url = Site.first.root_url
|
||||
if host_url == "http://"
|
||||
host_url = request.protocol + request.host_with_port
|
||||
end
|
||||
host_url = request.protocol + request.host_with_port if host_url == "http://"
|
||||
|
||||
@rows = []
|
||||
@tablecolumns = table.table_columns.where(:display_in_index => true).asc(:order)
|
||||
@tablecolumns = []
|
||||
|
||||
# 處理 file 欄位雙欄輸出(連結與註解)
|
||||
table.table_columns.where(display_in_index: true).asc(:order).each do |column|
|
||||
if column.type == "file"
|
||||
@tablecolumns << column
|
||||
@tablecolumns << column.dup.tap { |c| c.define_singleton_method(:_file_title_column?) { true } }
|
||||
else
|
||||
@tablecolumns << column
|
||||
end
|
||||
end
|
||||
|
||||
entries = get_entries(params, table, page, false)
|
||||
|
||||
entries.each do |te|
|
||||
cols = []
|
||||
sort_value = ""
|
||||
|
||||
@tablecolumns.each do |column|
|
||||
ce = te.column_entries.where(:table_column_id => column.id).first rescue nil
|
||||
if !ce.nil?
|
||||
text = ""
|
||||
case ce.type
|
||||
# 跳過副註解欄(由主 file 欄處理)
|
||||
if column.respond_to?(:_file_title_column?) && column._file_title_column?
|
||||
next
|
||||
end
|
||||
|
||||
ce = te.column_entries.where(table_column_id: column.id).first rescue nil
|
||||
|
||||
if ce.present?
|
||||
case column.type
|
||||
when "text"
|
||||
text = ce.text
|
||||
cols << { "text" => ce.text.to_s }
|
||||
|
||||
when "integer"
|
||||
text = ce.number
|
||||
cols << { "text" => ce.number.to_s }
|
||||
|
||||
when "editor"
|
||||
text = ce.content
|
||||
cols << { "text" => ce.content.to_s }
|
||||
|
||||
when "date"
|
||||
text = format_date(ce.date, column.date_format)
|
||||
cols << { "text" => format_date(ce.date, column.date_format).to_s }
|
||||
|
||||
when "period"
|
||||
text = format_date(ce.period_from, column.date_format) + " ~ " + format_date(ce.period_to, column.date_format)
|
||||
text = "" if text.starts_with?(" ~")
|
||||
from = format_date(ce.period_from, column.date_format)
|
||||
to = format_date(ce.period_to, column.date_format)
|
||||
text = from.blank? && to.present? ? to : "#{from} ~ #{to}"
|
||||
cols << { "text" => text.to_s }
|
||||
|
||||
when "image"
|
||||
text = host_url + ce.image.thumb.url
|
||||
text = ce.image&.thumb&.url ? (host_url + ce.image.thumb.url) : ""
|
||||
cols << { "text" => text }
|
||||
|
||||
when "file"
|
||||
file_links = []
|
||||
file_titles = []
|
||||
locale = I18n.locale.to_s
|
||||
|
||||
ce.column_entry_files.desc(:sort_number).each do |entry_file|
|
||||
next unless entry_file.choose_lang_display(locale)
|
||||
|
||||
file_links << (host_url + entry_file.get_link)
|
||||
|
||||
title = if entry_file.respond_to?(:file_title_translations) && entry_file.file_title_translations.is_a?(Hash)
|
||||
entry_file.file_title_translations[locale]
|
||||
elsif entry_file.file_title.is_a?(Hash)
|
||||
entry_file.file_title[locale]
|
||||
else
|
||||
entry_file.file_title
|
||||
end
|
||||
text = file_links.join("\r\n")
|
||||
|
||||
title = entry_file.file.filename.to_s if title.blank?
|
||||
file_titles << title
|
||||
end
|
||||
cols << {"text" => text}
|
||||
|
||||
cols << { "text" => file_links.join("\r\n") }
|
||||
cols << { "text" => file_titles.join("\r\n") }
|
||||
|
||||
else
|
||||
cols << { "text" => "" }
|
||||
end
|
||||
else
|
||||
if column.type == "file"
|
||||
cols << { "text" => "" }
|
||||
cols << { "text" => "" }
|
||||
else
|
||||
cols << { "text" => "" }
|
||||
end
|
||||
end
|
||||
@rows << {
|
||||
"columns" => cols
|
||||
}
|
||||
end
|
||||
excel_name = table.title + ".xlsx"
|
||||
|
||||
@rows << { "columns" => cols }
|
||||
end
|
||||
|
||||
excel_name = "#{table.title}.xlsx"
|
||||
excel_name = 'attachment; filename="' + excel_name + '"'
|
||||
|
||||
end
|
||||
respond_to do |format|
|
||||
format.xlsx {
|
||||
response.headers['Content-Disposition'] = excel_name
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def get_query(params)
|
||||
if params["column"].present?
|
||||
q = {params["column"] => params["q"]}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class ColumnEntryFile
|
|||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
field :file_title, localize: true
|
||||
field :file_title, type: String, localize: true
|
||||
# field :description
|
||||
field :download_count, type: Integer, default: 0
|
||||
field :choose_lang, :type => Array, :default => I18n.available_locales.map{|l| l.to_s}
|
||||
|
|
|
|||
|
|
@ -3,53 +3,62 @@
|
|||
wb = xlsx_package.workbook
|
||||
|
||||
wb.add_worksheet(name: "Structure") do |sheet|
|
||||
heading = sheet.styles.add_style(:b => true, :locked => true)
|
||||
type = sheet.styles.add_style(:i => true)
|
||||
heading = sheet.styles.add_style(b: true, locked: true)
|
||||
type = sheet.styles.add_style(i: true)
|
||||
|
||||
row = []
|
||||
row1 = []
|
||||
row2 = []
|
||||
row = ['UID']
|
||||
row1 = ['uid']
|
||||
row2 = ['Use to update existing entries. Leave blank to create new.']
|
||||
|
||||
@table.table_columns.asc(:order).each do |column|
|
||||
case column.type
|
||||
when "text"
|
||||
when "text", "editor"
|
||||
@site_in_use_locales.sort.each do |locale|
|
||||
row << column.title + " - " + t(locale.to_s)
|
||||
row << "#{column.title} - #{t(locale.to_s)}"
|
||||
row1 << column.key
|
||||
row2 << column.type + "-#{locale}"
|
||||
row2 << "#{column.type}-#{locale}"
|
||||
end
|
||||
|
||||
when "integer"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
row2 << column.type
|
||||
when "editor"
|
||||
@site_in_use_locales.sort.each do |locale|
|
||||
row << column.title + " - " + t(locale.to_s)
|
||||
row1 << column.key
|
||||
row2 << column.type + "-#{locale}"
|
||||
end
|
||||
row2 << "integer"
|
||||
|
||||
when "image"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
row2 << "Public URL"
|
||||
|
||||
when "date"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
row2 << column.type + " : " + column.date_format.upcase
|
||||
row2 << "date : #{column.date_format.upcase}"
|
||||
|
||||
when "period"
|
||||
row << column.title + "-From"
|
||||
row << "#{column.title}-From"
|
||||
row1 << column.key
|
||||
row2 << column.type + " : " + column.date_format.upcase + "-period_from"
|
||||
row << column.title + "-To"
|
||||
row2 << "period : #{column.date_format.upcase}-period_from"
|
||||
|
||||
row << "#{column.title}-To"
|
||||
row1 << column.key
|
||||
row2 << column.type + " : " + column.date_format.upcase + "-period_to"
|
||||
row2 << "period : #{column.date_format.upcase}-period_to"
|
||||
|
||||
when "file"
|
||||
row << column.title
|
||||
# 多語系 file_title 欄位
|
||||
@site_in_use_locales.sort.each do |locale|
|
||||
row << "#{column.title} - #{t(locale.to_s)}"
|
||||
row1 << column.key
|
||||
row2 << "Separate the files by ;"
|
||||
end
|
||||
row2 << "Separate the files by"
|
||||
end
|
||||
|
||||
# URL 欄位
|
||||
row << "#{column.title} (註解)"
|
||||
row1 << column.key
|
||||
row2 << "file_title - #{locale} ;"
|
||||
end # <-- 正確結束 case 區塊
|
||||
end
|
||||
|
||||
# 加入 hashtags 與 related_entries 欄位
|
||||
row << t("universal_table.hashtags")
|
||||
row1 << "table_tags"
|
||||
row2 << "Separate tags by ;"
|
||||
|
|
@ -58,8 +67,7 @@ wb.add_worksheet(name: "Structure") do |sheet|
|
|||
row1 << "related_entries"
|
||||
row2 << "Separate UIDs with ;"
|
||||
|
||||
sheet.add_row row, :style => heading
|
||||
sheet.add_row row, style: heading
|
||||
sheet.add_row row1
|
||||
sheet.add_row row2, :style => type
|
||||
|
||||
sheet.add_row row2, style: type
|
||||
end
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
wb = xlsx_package.workbook
|
||||
|
||||
wb.add_worksheet(name: "Structure") do |sheet|
|
||||
heading = sheet.styles.add_style(:b => true, :locked => true)
|
||||
type = sheet.styles.add_style(:i => true)
|
||||
heading = sheet.styles.add_style(b: true, locked: true)
|
||||
type = sheet.styles.add_style(i: true)
|
||||
wrap = sheet.styles.add_style alignment: { wrap_text: true }
|
||||
|
||||
row = []
|
||||
|
|
@ -17,22 +17,16 @@ wb.add_worksheet(name: "Structure") do |sheet|
|
|||
|
||||
table.table_columns.asc(:order).each do |column|
|
||||
case column.type
|
||||
when "text"
|
||||
when "text", "editor"
|
||||
site_in_use_locales.sort.each do |locale|
|
||||
row << column.title + " - " + t(locale.to_s)
|
||||
row << "#{column.title} - #{t(locale.to_s)}"
|
||||
row1 << column.key
|
||||
row2 << column.type + "-#{locale}"
|
||||
row2 << "#{column.type}-#{locale}"
|
||||
end
|
||||
when "integer"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
row2 << column.type
|
||||
when "editor"
|
||||
site_in_use_locales.sort.each do |locale|
|
||||
row << column.title + " - " + t(locale.to_s)
|
||||
row1 << column.key
|
||||
row2 << column.type + "-#{locale}"
|
||||
end
|
||||
when "image"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
|
|
@ -40,15 +34,19 @@ wb.add_worksheet(name: "Structure") do |sheet|
|
|||
when "date"
|
||||
row << column.title
|
||||
row1 << column.key
|
||||
row2 << column.type + " : " + column.date_format.upcase
|
||||
row2 << "#{column.type} : #{column.date_format.upcase}"
|
||||
when "period"
|
||||
row << column.title + "-From ~ To"
|
||||
row << "#{column.title} - From ~ To"
|
||||
row1 << column.key
|
||||
row2 << column.type + " : " + column.date_format.upcase + "-period_from ~ period_to"
|
||||
row2 << "#{column.type} : #{column.date_format.upcase}-period_from ~ period_to"
|
||||
when "file"
|
||||
row << column.title
|
||||
row << "#{column.title} (Link)"
|
||||
row1 << column.key
|
||||
row2 << "Separate the files by ;"
|
||||
|
||||
row << "#{column.title} 註解"
|
||||
row1 << column.key
|
||||
row2 << "file_title-#{locale}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -60,15 +58,17 @@ wb.add_worksheet(name: "Structure") do |sheet|
|
|||
row1 << "related_entries"
|
||||
row2 << "Separate UIDs with ;"
|
||||
|
||||
sheet.add_row row, :style => heading
|
||||
sheet.add_row row, style: heading
|
||||
sheet.add_row row1
|
||||
sheet.add_row row2, :style => type
|
||||
sheet.add_row row2, style: type
|
||||
|
||||
table.table_entries.asc(:created_at).each do |entry|
|
||||
row = []
|
||||
row << entry.uid
|
||||
|
||||
table.table_columns.asc(:order).each do |col|
|
||||
column = entry.column_entries.where(:table_column_id => col.id).first
|
||||
column = entry.column_entries.where(table_column_id: col.id).first
|
||||
|
||||
case col.type
|
||||
when "text"
|
||||
site_in_use_locales.sort.each do |locale|
|
||||
|
|
@ -81,49 +81,54 @@ wb.add_worksheet(name: "Structure") do |sheet|
|
|||
row << (column.content_translations[locale.to_s] rescue "")
|
||||
end
|
||||
when "image"
|
||||
if !column.image.url.nil?
|
||||
row << url + column.image.url
|
||||
else
|
||||
row << ""
|
||||
end
|
||||
row << (column&.image&.url.present? ? (url + column.image.url) : "")
|
||||
when "date"
|
||||
case col.date_format
|
||||
when "yyyy/MM/dd hh:mm"
|
||||
row << (column.date.strftime("%Y/%m/%d %H:%M") rescue "")
|
||||
when "yyyy/MM/dd"
|
||||
row << (column.date.strftime("%Y/%m/%d") rescue "")
|
||||
when "yyyy/MM"
|
||||
row << (column.date.strftime("%Y/%m/") rescue "")
|
||||
when "yyyy"
|
||||
row << (column.date.strftime("%Y") rescue "")
|
||||
format_str = case col.date_format
|
||||
when "yyyy/MM/dd hh:mm" then "%Y/%m/%d %H:%M"
|
||||
when "yyyy/MM/dd" then "%Y/%m/%d"
|
||||
when "yyyy/MM" then "%Y/%m"
|
||||
when "yyyy" then "%Y"
|
||||
end
|
||||
row << (column.date.strftime(format_str) rescue "")
|
||||
when "period"
|
||||
case col.date_format
|
||||
when "yyyy/MM/dd hh:mm"
|
||||
row << (column.period_from.strftime("%Y/%m/%d %H:%M")rescue "") + " ~ " + (column.period_to.strftime("%Y/%m/%d %H:%M") rescue "")
|
||||
when "yyyy/MM/dd"
|
||||
row << (column.period_from.strftime("%Y/%m/%d")rescue "") + " ~ " + (column.period_to.strftime("%Y/%m/%d") rescue "")
|
||||
when "yyyy/MM"
|
||||
row << (column.period_from.strftime("%Y/%m")rescue "") + " ~ " + (column.period_to.strftime("%Y/%m") rescue "")
|
||||
when "yyyy"
|
||||
row << (column.period_from.strftime("%Y")rescue "") + " ~ " + (column.period_to.strftime("%Y") rescue "")
|
||||
format_str = case col.date_format
|
||||
when "yyyy/MM/dd hh:mm" then "%Y/%m/%d %H:%M"
|
||||
when "yyyy/MM/dd" then "%Y/%m/%d"
|
||||
when "yyyy/MM" then "%Y/%m"
|
||||
when "yyyy" then "%Y"
|
||||
end
|
||||
from = (column.period_from.strftime(format_str) rescue "")
|
||||
to = (column.period_to.strftime(format_str) rescue "")
|
||||
row << "#{from} ~ #{to}"
|
||||
when "file"
|
||||
file_links = []
|
||||
locale = I18n.locale.to_s
|
||||
if !column.nil?
|
||||
file_titles = []
|
||||
locale = "zh_tw"
|
||||
if column
|
||||
column.column_entry_files.desc(:sort_number).each do |entry_file|
|
||||
next unless entry_file.choose_lang_display(locale)
|
||||
file_links << (url + entry_file.get_link)
|
||||
|
||||
title = if entry_file.respond_to?(:file_title_translations) && entry_file.file_title_translations.is_a?(Hash)
|
||||
entry_file.file_title_translations[locale]
|
||||
elsif entry_file.file_title.is_a?(Hash)
|
||||
entry_file.file_title[locale]
|
||||
else
|
||||
entry_file.file_title
|
||||
end
|
||||
|
||||
title = entry_file.file.filename.to_s if title.blank?
|
||||
file_titles << title
|
||||
end
|
||||
end
|
||||
row << file_links.join(";")
|
||||
row << file_titles.join(";")
|
||||
end
|
||||
end
|
||||
row << entry.table_tags.pluck("title").map { |t| "#{t}" }.join("; ")
|
||||
|
||||
row << entry.table_tags.pluck("title").join("; ")
|
||||
row << entry.get_related_entries_uid
|
||||
|
||||
sheet.add_row row, style: wrap
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue