method added for frontend

This commit is contained in:
Harry Bomrah 2016-01-11 20:36:16 +08:00
parent 87d691de04
commit 46a0c1f697
1 changed files with 32 additions and 1 deletions

View File

@ -60,11 +60,42 @@ class WritingConference
# pd = self.publication_date.strftime("%Y-%m-%d").split('-') # pd = self.publication_date.strftime("%Y-%m-%d").split('-')
# title << pd[0] # title << pd[0]
# end # end
title << self.year # title << self.year
title.join(', ') title.join(', ')
end 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_conference.#{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_conference')}' 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 get_plugin_data(fields_to_show) def get_plugin_data(fields_to_show)
plugin_datas = [] plugin_datas = []
fields_to_show.each do |field| fields_to_show.each do |field|