Fix topic_img_url.

This commit is contained in:
邱博亞 2024-09-11 13:17:38 +08:00
parent a44c4667d4
commit 2e25d70d92
1 changed files with 10 additions and 1 deletions

View File

@ -230,9 +230,18 @@
<% topics = (papers_data_hash["topic_ids"].nil? ? papers_data_hash["topics"] : EPaperTopic.where(:id.in=>papers_data_hash["topic_ids"]).to_a) %> <% topics = (papers_data_hash["topic_ids"].nil? ? papers_data_hash["topics"] : EPaperTopic.where(:id.in=>papers_data_hash["topic_ids"]).to_a) %>
<% topics.each do |topic| %> <% topics.each do |topic| %>
<div class="ep-content-item"> <div class="ep-content-item">
<%
if topic.image.present?
topic_img_url = siteurl + topic.image.thumb.url
else
topic_img_url = nil
end
%>
<a class="ep-content-title" href="<%= page + "/" + topic.to_param %>" target="_blank"><%= topic.title %></a> <a class="ep-content-title" href="<%= page + "/" + topic.to_param %>" target="_blank"><%= topic.title %></a>
<div class="ep-img" style="width: 40%; float:left;"> <div class="ep-img" style="width: 40%; float:left;">
<img src="<%= (siteurl + topic.image.thumb.url rescue nil) %>" style="width: 100%;"> <% if topic_img_url %>
<img src="<%= topic_img_url %>" style="width: 100%;">
<% end %>
</div> </div>
<div class="ep-con" style="width: 58%; float: right;"> <div class="ep-con" style="width: 58%; float: right;">
<%= fix_local_url(siteurl, topic.description) %> <%= fix_local_url(siteurl, topic.description) %>