From 755d39590200f317e2ae8f716609e3abbf5a9ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 4 Mar 2023 12:14:45 +0800 Subject: [PATCH] fix error --- app/controllers/personal_journals_controller.rb | 6 ++++-- app/models/journal_paper.rb | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 0f41aa5..53c0e60 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -145,8 +145,10 @@ class PersonalJournalsController < ApplicationController def index_by_author(journal_papers) journal_papers_total_pages = journal_papers.total_pages journal_papers_list = journal_papers.group_by{|jp| jp.member_profile.name rescue jp.authors}.collect do |name, jps| - - {'name' => name, 'jps' => jps.collect{|jp| {'title' => jp.paper_title}}} + jps_data = jps.collect do |jp| + {'title' => jp.create_link_tag_for_title} + end + {'name' => name, 'jps' => jps_data} end { 'journal_papers' => journal_papers_list, diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 1c49805..0059b22 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -151,10 +151,7 @@ class JournalPaper end else if t == "paper_title" - link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_journal') - url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) - tmp_title = p.create_link - pd_data << { "data_title" => (url_to_plugin_show_blank ? tmp_title : "#{tmp_title}") } + pd_data << { "data_title" => p.create_link_tag_for_title} else pd_data << { "data_title" => p.send(t) } end @@ -169,6 +166,12 @@ class JournalPaper return [pd_title,plugin_datas] end + def create_link_tag_for_title + link = OrbitHelper.url_to_plugin_show(self.to_param,'personal_journal') + url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) + tmp_title = self.create_link + (url_to_plugin_show_blank ? tmp_title : "#{tmp_title}") + end # def self.member_data # members = MemberProfile.all # member_data = []