Fix author text bug.
This commit is contained in:
parent
37f1669e7b
commit
ef818416cd
|
@ -1,29 +1,44 @@
|
||||||
module Admin::PersonalConferencesHelper
|
module Admin::PersonalConferencesHelper
|
||||||
def get_authors_text(writing_conference)
|
def get_authors_text(writing_conference)
|
||||||
authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
|
authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
|
||||||
split_text = authors_text.match(/[、,,\/]/)
|
split_text = authors_text.match(/[、,,\/]/)
|
||||||
split_text = split_text.nil? ? '/' : split_text[0]
|
split_text = split_text.nil? ? '/' : split_text[0]
|
||||||
full_authors_names = get_member(writing_conference).collect(&:name)
|
|
||||||
if authors_text.present?
|
if authors_text.present?
|
||||||
authors_names = authors_text.split(split_text).select{|a| !(full_authors_names.include?(a.strip()))}
|
authors_names = authors_text.split(split_text)
|
||||||
full_authors_names += authors_names
|
else
|
||||||
|
authors_names = []
|
||||||
end
|
end
|
||||||
|
full_authors_names = get_member(writing_conference).collect do |member|
|
||||||
|
member_name = member.name
|
||||||
|
idx = authors_names.index{|a| a.chomp('*') == member_name}
|
||||||
|
if idx
|
||||||
|
member_name = authors_names[idx]
|
||||||
|
authors_names[idx] = nil
|
||||||
|
end
|
||||||
|
member_name
|
||||||
|
end
|
||||||
|
full_authors_names += authors_names.compact
|
||||||
full_authors_names.join(split_text)
|
full_authors_names.join(split_text)
|
||||||
end
|
end
|
||||||
def get_authors_show(writing_conference)
|
def get_authors_show(writing_conference)
|
||||||
authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
|
authors_text = Nokogiri::HTML(writing_conference.authors.to_s).text
|
||||||
split_text = authors_text.match(/[、,,\/]/)
|
split_text = authors_text.match(/[、,,\/]/)
|
||||||
split_text = split_text.nil? ? '/' : split_text[0]
|
split_text = split_text.nil? ? '/' : split_text[0]
|
||||||
full_authors_names = []
|
|
||||||
full_authors = get_member(writing_conference).collect{|member|
|
|
||||||
member_name = member.name
|
|
||||||
full_authors_names << member_name
|
|
||||||
"<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member_name}'>#{member_name}</a>"
|
|
||||||
}
|
|
||||||
if authors_text.present?
|
if authors_text.present?
|
||||||
authors_names = authors_text.split(split_text).select{|a| !(full_authors_names.include?(a.strip()))}
|
authors_names = authors_text.split(split_text)
|
||||||
full_authors += authors_names
|
else
|
||||||
|
authors_names = []
|
||||||
end
|
end
|
||||||
|
full_authors = get_member(writing_conference).collect do |member|
|
||||||
|
member_name = member.name
|
||||||
|
idx = authors_names.index{|a| a.chomp('*') == member_name}
|
||||||
|
if idx
|
||||||
|
member_name = authors_names[idx]
|
||||||
|
authors_names[idx] = nil
|
||||||
|
end
|
||||||
|
"<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member_name}'>#{member_name}</a>"
|
||||||
|
end
|
||||||
|
full_authors += authors_names.compact
|
||||||
full_authors.join(split_text)
|
full_authors.join(split_text)
|
||||||
end
|
end
|
||||||
def get_member(writing_conference)
|
def get_member(writing_conference)
|
||||||
|
|
Loading…
Reference in New Issue