From f0f7eeb9c2d91040da8dc9c9051a49cac5777f0f Mon Sep 17 00:00:00 2001 From: Eric Tsai Date: Thu, 2 Jan 2020 13:59:36 +0800 Subject: [PATCH] add link to member's front page for index and show views --- app/controllers/personal_labs_controller.rb | 7 +++++-- app/models/lab.rb | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/personal_labs_controller.rb b/app/controllers/personal_labs_controller.rb index 71e70de..4e7fd49 100644 --- a/app/controllers/personal_labs_controller.rb +++ b/app/controllers/personal_labs_controller.rb @@ -2,11 +2,13 @@ class PersonalLabsController < ApplicationController def index labs = Lab.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) lab_list = labs.collect do |lab| + member = lab.member_profile + path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#' { "year" => lab.year, "lab_title" => lab.lab_title, "location" => lab.location, - "member" => (lab.member_profile.name rescue ""), + "member" => "#{member.name}", "link_to_show" => OrbitHelper.url_to_show(lab.to_param) } end @@ -39,9 +41,10 @@ class PersonalLabsController < ApplicationController "extension_no", "url", "note", + #"owner", "file" ] {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} end -end \ No newline at end of file +end diff --git a/app/models/lab.rb b/app/models/lab.rb index d7b5db7..14d24dc 100644 --- a/app/models/lab.rb +++ b/app/models/lab.rb @@ -99,6 +99,9 @@ class Lab files << "
  • #{title}
  • " end value = files.join("") + when "owner" + 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 @@ -122,4 +125,4 @@ class Lab end end -end \ No newline at end of file +end