forked from saurabh/personal-journal
Add display author text fields in the frontend authors field.
This commit is contained in:
parent
dac27a8edf
commit
942e7af4d5
|
@ -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 "")
|
||||
end
|
||||
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
|
||||
def get_member(journal)
|
||||
Array(MemberProfile.find(Array(journal).collect(&:member_profile_id))) rescue []
|
||||
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('/')
|
||||
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)
|
||||
!journal.journal_levels.blank? ? "(#{journal.journal_levels.collect(&:title).join(', ')})" : nil
|
||||
|
|
|
@ -218,7 +218,7 @@ class JournalPaper
|
|||
when "url"
|
||||
value = self.url.to_s.blank? ? "" : "<a href='#{self.url}'>#{self.url}</a>"
|
||||
when "authors"
|
||||
value = get_member_show(self) rescue ""
|
||||
value = get_authors_show(self) rescue ""
|
||||
else
|
||||
value = self.send(field) rescue ""
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue