<% paper = PaperCriteria.find(@data["paper_id"]) rescue nil %> <% paper = @data["paper"] if paper.nil? && @data["paper"] != nil %> <% page = @data["page"] %> <% siteurl = @data["siteurl"] %> <% papers_data = @data["papers_data"] %> <%= paper.title %> <% 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 next if src.blank? if src.match(/^\/[^\/]+/) src_tag.attribute('src').value = siteurl + src end end doc.css('a[href], link[href]').each do |link_tag| href = link_tag.attribute('href').value next if href.blank? if href.match(/^\/[^\/]+/) link_tag.attribute('href').value = siteurl + href end end doc.to_html.html_safe end have_papaers = papers_data.present? if paper.banner_image.present? img = EPaperImage.find(paper.banner_image) img_src = siteurl + img.image.url else img_src = nil end paper_description = fix_local_url(siteurl, paper.description) paper_content = fix_local_url(siteurl, paper.content) %>
<% if have_papaers %> <% if img_src %> <%= paper.title %> <% end %>
<% if paper.title.present? %>
<%= t('e_paper.title') %>:

" target="_blank"><%= paper.title %>

<% end %>
<%= t('e_paper.description') %>: <%= paper_description %>
<%= paper_content %>
<% papers_data.each do |papers_data_hash| %>

" style="color: #fff;text-decoration: none;"><%= papers_data_hash["category_title"] %>

<% 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| %>
<% if topic.image.present? topic_img_url = siteurl + topic.image.thumb.url else topic_img_url = nil end %> " target="_blank"><%= topic.title %>
<% if topic_img_url %> <% end %>
<%= fix_local_url(siteurl, topic.description) %> " target="_blank">more
<% end %> <% end %>
<% else %> <% if img_src %> <%= paper.title %> <% end %>
<% if paper.title.present? %> <% end %>
<%= paper_content %>
<% end %>