Fix link bug.

This commit is contained in:
BoHung Chiu 2022-01-03 22:42:39 +08:00
parent c4ae7af68e
commit 7d65070611
2 changed files with 8 additions and 3 deletions

View File

@ -109,7 +109,9 @@ class Book
if !page.nil? && page.custom_string_field == "table"
case t
when "book_title", "extracted_chapters"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_book')}' title=\"#{p.send(t)}\" target='_blank'>#{p.send(t)}</a>" }
link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_book')
link = (link == "#" ? p.send(t) : "<a href='#{link}' title=\"#{p.send(t)}\" target='_blank'>#{p.send(t)}</a>")
pd_data << { "data_title" => link }
when "publish_date", "publication_date"
pd = ""
if !p.publication_date.nil?
@ -126,7 +128,9 @@ class Book
end
else
if t == "book_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_book')}' title=\"#{p.create_link}\" target='_blank'>#{p.create_link}</a>" }
link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_book')
link = (link == "#" ? p.create_link : "<a href='#{link}' title=\"#{p.create_link}\" target='_blank'>#{p.create_link}</a>")
pd_data << { "data_title" => link }
else
pd_data << { "data_title" => p.send(t) }
end

View File

@ -47,7 +47,8 @@
<% end -%>
<td><%= book.year %></td>
<td>
<%= link_to book.create_link, OrbitHelper.url_to_plugin_show(book.to_param,'personal_book'), target: "blank"%>
<% link = OrbitHelper.url_to_plugin_show(book.to_param,'personal_book') %>
<%= (link == "#" ? book.create_link : link_to(book.create_link, link , target: "blank")) %>
<% if has_access? %>
<div class="quick-edit">
<ul class="nav nav-pills hide">