From 1136e0ff7cbc9feb1f41d858c038d7768b91218e Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 3 Jan 2022 23:02:30 +0800 Subject: [PATCH] Fix link bug. --- app/models/course.rb | 4 +++- app/views/plugin/personal_course/_profile.html.erb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 33f7f22..7399de7 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -94,7 +94,9 @@ class Course pd_data = [] fields_to_show.collect do |t| if t == "title" - pd_data << { "data_title" => "#{p.send(t)}" } + link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_course') + link = (link == "#" ? p.send(t) : "#{p.send(t)}") + pd_data << { "data_title" => link } elsif t == "course_category" pd_data << {"data_title" => (p.course_category.title rescue "")} else diff --git a/app/views/plugin/personal_course/_profile.html.erb b/app/views/plugin/personal_course/_profile.html.erb index 44b6645..7bcc54f 100644 --- a/app/views/plugin/personal_course/_profile.html.erb +++ b/app/views/plugin/personal_course/_profile.html.erb @@ -44,7 +44,8 @@ <% end %> <%= course.year %> - <%= link_to course.title, OrbitHelper.url_to_plugin_show(course.to_param,'personal_course').to_s, target: "blank"%> + <% link = OrbitHelper.url_to_plugin_show(course.to_param,'personal_course') %> + <%= (link = (link == "#") ? course.title : link_to(course.title, link, target: "blank")) %>