update for frontend

This commit is contained in:
Harry Bomrah 2016-01-11 20:34:30 +08:00
parent cca0c1218b
commit 3dfbff9dd7
1 changed files with 32 additions and 1 deletions

View File

@ -56,11 +56,42 @@ class Book
end
title << self.pages if self.pages.present?
title << self.year
# title << self.year
title.join(', ')
end
def self.get_plugin_datas_to_member(datas)
fields_to_show = [
"year",
"book_title"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_book.#{t}")
}
end
plugin_datas = datas.sort_for_frontend.collect do |p|
pd_data = []
fields_to_show.collect do |t|
if t == "book_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_book')}' 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)
plugin_datas = []
fields_to_show.each do |field|