Merge branch 'master' into 'master'

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

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

See merge request !1
This commit is contained in:
EricTYL 2020-01-02 17:14:04 +08:00
commit 0662c438db
2 changed files with 9 additions and 3 deletions

View File

@ -2,11 +2,13 @@ class PersonalLabsController < ApplicationController
def index def index
labs = Lab.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) 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| lab_list = labs.collect do |lab|
member = lab.member_profile
path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#'
{ {
"year" => lab.year, "year" => lab.year,
"lab_title" => lab.lab_title, "lab_title" => lab.lab_title,
"location" => lab.location, "location" => lab.location,
"member" => (lab.member_profile.name rescue ""), "member" => "<a href='#{path}'>#{member.name}</a>",
"link_to_show" => OrbitHelper.url_to_show(lab.to_param) "link_to_show" => OrbitHelper.url_to_show(lab.to_param)
} }
end end
@ -39,9 +41,10 @@ class PersonalLabsController < ApplicationController
"extension_no", "extension_no",
"url", "url",
"note", "note",
#"owner",
"file" "file"
] ]
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
end end
end end

View File

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