Add display author text fields in the frontend authors field.

This commit is contained in:
BoHung Chiu 2020-08-14 11:07:30 +08:00
parent dac27a8edf
commit 942e7af4d5
2 changed files with 4 additions and 3 deletions

View File

@ -3,13 +3,14 @@ module Admin::JournalPapersHelper
(journal.authors.to_s.blank? ? get_member(journal).collect(&:name).join('/') : Nokogiri::HTML(journal.authors.to_s).text rescue "") (journal.authors.to_s.blank? ? get_member(journal).collect(&:name).join('/') : Nokogiri::HTML(journal.authors.to_s).text rescue "")
end end
def get_authors_show(journal) def get_authors_show(journal)
(journal.authors.to_s.blank? ? get_member_show(journal) : (journal.authors.to_s) rescue "") member_names = get_member_show(journal)
(journal.authors.to_s.blank? ? get_member_show(journal) : (member_names.blank? ? journal.authors.to_s : (member_names + "" + journal.authors.to_s.gsub("","").gsub(",","")) ) rescue "")
end end
def get_member(journal) def get_member(journal)
Array(MemberProfile.find(Array(journal).collect(&:member_profile_id))) rescue [] Array(MemberProfile.find(Array(journal).collect(&:member_profile_id))) rescue []
end end
def get_member_show(journal) def get_member_show(journal)
get_member(journal).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('/') get_member(journal).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('')
end end
def get_level_type(journal) def get_level_type(journal)
!journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil !journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil

View File

@ -218,7 +218,7 @@ class JournalPaper
when "url" when "url"
value = self.url.to_s.blank? ? "" : "<a href='#{self.url}'>#{self.url}</a>" value = self.url.to_s.blank? ? "" : "<a href='#{self.url}'>#{self.url}</a>"
when "authors" when "authors"
value = get_member_show(self) rescue "" value = get_authors_show(self) rescue ""
else else
value = self.send(field) rescue "" value = self.send(field) rescue ""
end end