Merge branch 'master' into 'master'

fix problem of showing author for admin's index



See merge request !7
This commit is contained in:
wmcheng 2019-11-13 13:36:42 +08:00
commit dbd65617d3
2 changed files with 6 additions and 3 deletions

View File

@ -1,13 +1,16 @@
module Admin::PersonalBooksHelper
def get_authors_text(book)
def get_authors_text(book)
(book.authors.to_s.blank? ? get_member(book).collect(&:name).join('/') : Nokogiri::HTML(book.authors.to_s).text rescue '')
end
def get_authors_show(book)
(book.authors.to_s.blank? ? get_member(book).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('/') : book.authors.to_s rescue '')
(book.authors.to_s.blank? ? get_member_show(book) : book.authors.to_s) rescue ''
end
def get_member(book)
Array(MemberProfile.find(Array(book).collect(&:member_profile_id)))
end
def get_member_show(book)
get_member(book).collect{|member| "<a href='#{OrbitHelper.url_to_plugin_show(member.to_param,'member')}' title='#{member.name}'>#{member.name}</a>"}.join('/')
end
def get_publisher(book)
book.publisher
end

View File

@ -12,6 +12,6 @@
</ul>
</div>
</td>
<td><%= writing_book.member_profile.name rescue "" %></td>
<td><%= get_member_show(writing_book).html_safe %></td>
</tr>
<% end %>