add link to member's front page for both index and show views

This commit is contained in:
EricTYL 2020-01-02 12:37:18 +08:00
parent cb715732e7
commit 77e39ccdaa
2 changed files with 8 additions and 3 deletions

View File

@ -2,8 +2,10 @@ class PersonalResearchesController < ApplicationController
def index
researchs = Research.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
research_list = researchs.collect do |research|
member = research.member_profile
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
{
"member" => (research.member_profile.name rescue ""),
"member" => "<a href='#{path}'>#{member.name}</a>",
"year" => research.year,
"publication_date" => (research.publish_date.strftime("%Y.%m") rescue ""),
"research_title" => research.research_title,
@ -78,4 +80,4 @@ class PersonalResearchesController < ApplicationController
# }
# }
end
end
end

View File

@ -110,6 +110,9 @@ class Research
files << "<li><a href='#{url}' target='_blank'>#{title}</li>"
end
value = files.join("")
when "authors"
path = OrbitHelper.url_to_plugin_show(self.member_profile.to_param, 'member') rescue '#'
value = "<a href='#{path}'>#{self.member_profile.name}</a>"
else
value = self.send(field) rescue ""
end
@ -133,4 +136,4 @@ class Research
end
end
end
end