forked from saurabh/personal-book
Merge branch 'master' into 'master'
fix problem of showing author for admin's index See merge request !7
This commit is contained in:
commit
dbd65617d3
|
@ -1,13 +1,16 @@
|
||||||
module Admin::PersonalBooksHelper
|
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 '')
|
(book.authors.to_s.blank? ? get_member(book).collect(&:name).join('/') : Nokogiri::HTML(book.authors.to_s).text rescue '')
|
||||||
end
|
end
|
||||||
def get_authors_show(book)
|
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
|
end
|
||||||
def get_member(book)
|
def get_member(book)
|
||||||
Array(MemberProfile.find(Array(book).collect(&:member_profile_id)))
|
Array(MemberProfile.find(Array(book).collect(&:member_profile_id)))
|
||||||
end
|
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)
|
def get_publisher(book)
|
||||||
book.publisher
|
book.publisher
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><%= writing_book.member_profile.name rescue "" %></td>
|
<td><%= get_member_show(writing_book).html_safe %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue