From c752928e4976cc05087520f0a8000646c7ce1bdf Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 13 Nov 2019 13:11:47 +0800 Subject: [PATCH 1/2] Update journal_papers_helper.rb add get_member_show method --- app/helpers/admin/journal_papers_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/admin/journal_papers_helper.rb b/app/helpers/admin/journal_papers_helper.rb index f5fa870..b9bd3bd 100644 --- a/app/helpers/admin/journal_papers_helper.rb +++ b/app/helpers/admin/journal_papers_helper.rb @@ -3,11 +3,14 @@ module Admin::JournalPapersHelper (journal.authors.to_s.blank? ? get_member(journal).collect(&:name).join('/') : Nokogiri::HTML(journal.authors.to_s).text rescue "") end def get_authors_show(journal) - (journal.authors.to_s.blank? ? get_member(journal).collect{|member| "#{member.name}"}.join('/') : (journal.authors.to_s) rescue "") + (journal.authors.to_s.blank? ? get_member_show(journal) : (journal.authors.to_s) rescue "") end def get_member(journal) Array(MemberProfile.find(Array(journal).collect(&:member_profile_id))) end + def get_member_show(journal) + get_member(journal).collect{|member| "#{member.name}"}.join('/') + end def get_level_type(journal) !journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil end From 9cb1e1d7367a491d11b8c978ae0bc52c2e0040dc Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 13 Nov 2019 13:13:11 +0800 Subject: [PATCH 2/2] Update _writing_journal.html.erb fix showing author error --- app/views/admin/journal_papers/_writing_journal.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/journal_papers/_writing_journal.html.erb b/app/views/admin/journal_papers/_writing_journal.html.erb index 24acaac..7d75350 100644 --- a/app/views/admin/journal_papers/_writing_journal.html.erb +++ b/app/views/admin/journal_papers/_writing_journal.html.erb @@ -14,6 +14,6 @@ - <%= writing_journal.member_profile.name rescue "" %> + <%= get_member_show(writing_journal).html_safe %> <% end %> \ No newline at end of file