From 8888c3e98c350066a474bf33b3fba6e79f429d31 Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 3 Jan 2022 22:58:47 +0800 Subject: [PATCH] Fix link bug. --- app/models/honor.rb | 4 +++- app/views/plugin/personal_honor/_profile.html.erb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/honor.rb b/app/models/honor.rb index 536f1f7..4cf93c6 100644 --- a/app/models/honor.rb +++ b/app/models/honor.rb @@ -75,7 +75,9 @@ class Honor pd_data = [] fields_to_show.collect do |t| if t == "award_name" - pd_data << { "data_title" => "#{p.send(t)}" } + link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_honor') + link = (link == "#" ? p.send(t) : "#{p.send(t)}") + pd_data << { "data_title" => link } elsif t == "honor_type" pd_data << {"data_title" => (p.honor_type.title rescue "")} elsif t == "award_date" diff --git a/app/views/plugin/personal_honor/_profile.html.erb b/app/views/plugin/personal_honor/_profile.html.erb index 41c9d9c..b8e2c7e 100644 --- a/app/views/plugin/personal_honor/_profile.html.erb +++ b/app/views/plugin/personal_honor/_profile.html.erb @@ -44,7 +44,8 @@ <% end %> <%= honor.year %> - <%= link_to honor.award_name, OrbitHelper.url_to_plugin_show(honor.to_param,'personal_honor'), target: "blank"%> + <% link = OrbitHelper.url_to_plugin_show(honor.to_param,'personal_honor') %> + <%= (link = (link == "#") ? honor.award_name : link_to(honor.award_name, link, target: "blank"))%>