From 77e39ccdaaaaaef0302f4081ed247bd74c8a5cfb Mon Sep 17 00:00:00 2001 From: Eric Tsai Date: Thu, 2 Jan 2020 12:37:18 +0800 Subject: [PATCH] add link to member's front page for both index and show views --- app/controllers/personal_researches_controller.rb | 6 ++++-- app/models/research.rb | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/personal_researches_controller.rb b/app/controllers/personal_researches_controller.rb index 55ef69e..8fa4b38 100644 --- a/app/controllers/personal_researches_controller.rb +++ b/app/controllers/personal_researches_controller.rb @@ -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" => "#{member.name}", "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 \ No newline at end of file +end diff --git a/app/models/research.rb b/app/models/research.rb index 032920c..46b083a 100644 --- a/app/models/research.rb +++ b/app/models/research.rb @@ -110,6 +110,9 @@ class Research files << "
  • #{title}
  • " end value = files.join("") + when "authors" + path = OrbitHelper.url_to_plugin_show(self.member_profile.to_param, 'member') rescue '#' + value = "#{self.member_profile.name}" else value = self.send(field) rescue "" end @@ -133,4 +136,4 @@ class Research end end -end \ No newline at end of file +end