Update journal_papers_helper.rb

add get_member_show method
This commit is contained in:
chiu 2019-11-13 13:11:47 +08:00
parent 4a64893c59
commit c752928e49
1 changed files with 4 additions and 1 deletions

View File

@ -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 "") (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(journal).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('/') : (journal.authors.to_s) rescue "") (journal.authors.to_s.blank? ? get_member_show(journal) : (journal.authors.to_s) rescue "")
end end
def get_member(journal) def get_member(journal)
Array(MemberProfile.find(Array(journal).collect(&:member_profile_id))) Array(MemberProfile.find(Array(journal).collect(&:member_profile_id)))
end end
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('/')
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
end end