fix for frontend

This commit is contained in:
Harry Bomrah 2016-01-11 20:35:44 +08:00
parent 3091fc2aa2
commit 6c151f981f
2 changed files with 33 additions and 2 deletions

View File

@ -87,7 +87,7 @@ module Admin::JournalPapersHelper
end
when 14
jpts = JournalPaperType.asc(:created_at).all.to_a
jp.journal_paper_type = jpts[val.to_i] if val.is_i? && val.to_s.to_i < jpts.count
jp.journal_paper_type = jpts[val.to_i] if val.to_s.is_i? && val.to_i < jpts.count
when 15
jpas = JournalPaperAuthorType.asc(:created_at).all.to_a
ts = val.to_s.split(",")

View File

@ -64,11 +64,42 @@ class JournalPaper
# pd = self.publication_date.strftime("%Y-%m-%d").split('-')
# title << pd[0]
# end
title << self.year
# title << self.year
title.delete(nil)
title.join(', ').gsub(', ,',',')
end
def self.get_plugin_datas_to_member(datas)
fields_to_show = [
"year",
"paper_title"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_journal.#{t}")
}
end
plugin_datas = datas.sort_for_frontend.collect do |p|
pd_data = []
fields_to_show.collect do |t|
if t == "paper_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_journal')}' target='_blank'>#{p.create_link}</a>" }
else
pd_data << { "data_title" => p.send(t) }
end
end
{
"pd_datas" => pd_data
}
end
return [pd_title,plugin_datas]
end
# def self.member_data
# members = MemberProfile.all
# member_data = []