From 54282a4d8d40059624af2adbd0504ad1ce534025 Mon Sep 17 00:00:00 2001 From: wmcheng Date: Mon, 2 Sep 2019 04:31:45 +0800 Subject: [PATCH 1/3] url for image --- lib/tasks/e_paper_tasks.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/e_paper_tasks.rake b/lib/tasks/e_paper_tasks.rake index d36fcf2..d0811fc 100644 --- a/lib/tasks/e_paper_tasks.rake +++ b/lib/tasks/e_paper_tasks.rake @@ -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 From 9ae9f79e8efe4ca7de3a6f87b7d298600f543ffe Mon Sep 17 00:00:00 2001 From: wmcheng Date: Mon, 2 Sep 2019 04:37:07 +0800 Subject: [PATCH 2/3] tesing email mod for url --- app/controllers/admin/e_paper_criterias_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/e_paper_criterias_controller.rb b/app/controllers/admin/e_paper_criterias_controller.rb index bd2a150..4b19b47 100644 --- a/app/controllers/admin/e_paper_criterias_controller.rb +++ b/app/controllers/admin/e_paper_criterias_controller.rb @@ -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 From 9418068a1b80cc462c39617361648b259d499f85 Mon Sep 17 00:00:00 2001 From: wmcheng Date: Mon, 2 Sep 2019 12:34:07 +0800 Subject: [PATCH 3/3] Update emailer format --- app/views/admin/e_paper_criterias/emailer.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/e_paper_criterias/emailer.html.erb b/app/views/admin/e_paper_criterias/emailer.html.erb index 6c45408..2700a09 100644 --- a/app/views/admin/e_paper_criterias/emailer.html.erb +++ b/app/views/admin/e_paper_criterias/emailer.html.erb @@ -1,5 +1,6 @@ <% paper = @data["paper"] %> <% page = @data["page"] %> +<% siteurl = @data["siteurl"] %> @@ -159,8 +160,9 @@ <% paper.epaper_topics.desc(:created_at).each do |topic| %>
" target="_blank"><%= topic.title %> + "> <% t = strip_tags(topic.content) %> -

<%= t[0..100] %>

+ <%= topic.description %> " target="_blank">more
<% end %>