Fix local url in email.
This commit is contained in:
parent
2b301b0c38
commit
a44c4667d4
|
@ -160,10 +160,14 @@
|
|||
width: 80%;
|
||||
margin: 10px;
|
||||
}
|
||||
.epaper-show img {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<%
|
||||
def fix_local_url(siteurl, contents)
|
||||
return nil if contents.blank?
|
||||
doc = Nokogiri::HTML.fragment(contents, encoding = 'UTF-8')
|
||||
doc.css('img[src], script[src]').each do |src_tag|
|
||||
src = src_tag.attribute('src').value
|
||||
|
@ -179,7 +183,7 @@
|
|||
link_tag.attribute('href').value = siteurl + href
|
||||
end
|
||||
end
|
||||
doc.to_html
|
||||
doc.to_html.html_safe
|
||||
end
|
||||
|
||||
have_papaers = papers_data.present?
|
||||
|
@ -188,16 +192,8 @@
|
|||
else
|
||||
img_src = nil
|
||||
end
|
||||
if paper.description.present?
|
||||
paper_description = fix_local_url(siteurl, paper.description).html_safe
|
||||
else
|
||||
paper_description = nil
|
||||
end
|
||||
if paper.content.present?
|
||||
paper_content = fix_local_url(siteurl, paper.content).html_safe
|
||||
else
|
||||
paper_content = nil
|
||||
end
|
||||
paper_description = fix_local_url(siteurl, paper.description)
|
||||
paper_content = fix_local_url(siteurl, paper.content)
|
||||
%>
|
||||
<body>
|
||||
<div class="epaper-show">
|
||||
|
@ -236,10 +232,10 @@
|
|||
<div class="ep-content-item">
|
||||
<a class="ep-content-title" href="<%= page + "/" + topic.to_param %>" target="_blank"><%= topic.title %></a>
|
||||
<div class="ep-img" style="width: 40%; float:left;">
|
||||
<img src="<%= (siteurl + "/" + topic.image.thumb.url rescue nil) %>" style="width: 100%;">
|
||||
<img src="<%= (siteurl + topic.image.thumb.url rescue nil) %>" style="width: 100%;">
|
||||
</div>
|
||||
<div class="ep-con" style="width: 58%; float: right;">
|
||||
<%= topic.description %>
|
||||
<%= fix_local_url(siteurl, topic.description) %>
|
||||
<a class="ep-content-more" href="<%= page + "/" + topic.to_param %>" target="_blank">more</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue