Merge branch 'master' into 'master'

epaper out format



See merge request !1
This commit is contained in:
wmcheng 2019-09-02 15:36:59 +08:00
commit d88174a8a8
3 changed files with 7 additions and 5 deletions

View File

@ -48,7 +48,7 @@ def initialize
def send_test_email
paper_criteria = PaperCriteria.find(params[:id])
page = Page.where(:module => "e_paper").first.url rescue ""
email = Email.new(:mail_subject => paper_criteria.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper_criteria, "page" => "http://" + request.host_with_port + page}, :mail_to => params[:email])
email = Email.new(:mail_subject => paper_criteria.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper_criteria, "page" => "http://" + request.host_with_port + page, "siteurl" => "http://" + request.host_with_port }, :mail_to => params[:email])
email.deliver
render :json => {"success" => true}.to_json
end

View File

@ -1,5 +1,6 @@
<% paper = @data["paper"] %>
<% page = @data["page"] %>
<% siteurl = @data["siteurl"] %>
<!DOCTYPE html>
<html>
<head>
@ -159,8 +160,9 @@
<% paper.epaper_topics.desc(:created_at).each do |topic| %>
<div class="ep-content-item">
<a class="ep-content-title" href="<%= page + "/" + topic.to_param %>" target="_blank"><%= topic.title %></a>
<img src="<%= siteurl + "/" + topic.image.thumb.url %>">
<% t = strip_tags(topic.content) %>
<p class="ep-content-text"><%= t[0..100] %></p>
<%= topic.description %>
<a class="ep-content-more" href="<%= page + "/" + topic.to_param %>" target="_blank">more</a>
</div>
<% end %>

View File

@ -14,7 +14,7 @@ namespace :epaper do
subscriber.save
if emails.count == mail_limit
puts "Sending #{mail_limit} mails"
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page}, :mail_to => emails)
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page, "siteurl" => "http://" + domain }, :mail_to => emails)
email.deliver
emails = []
sleep 0.5
@ -26,7 +26,7 @@ namespace :epaper do
emails << email
if emails.count == mail_limit
puts "Sending #{mail_limit} mails"
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page}, :mail_to => emails)
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page, "siteurl" => "http://" + domain }, :mail_to => emails)
email.deliver
emails = []
sleep 0.5
@ -35,7 +35,7 @@ namespace :epaper do
end
if !emails.empty?
puts "Sending last emails"
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page}, :mail_to => emails)
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => :zh_tw, :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page, "siteurl" => "http://" + domain }, :mail_to => emails)
email.deliver
end
paper.save