From 5b5ea57582d0a56f61e850ffc36540c9f312f117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Wed, 11 Sep 2024 08:16:48 +0800 Subject: [PATCH] Hide field-head when no papers. --- .../admin/e_paper_criterias/emailer.html.erb | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/app/views/admin/e_paper_criterias/emailer.html.erb b/app/views/admin/e_paper_criterias/emailer.html.erb index 28cfca3..0290fd3 100644 --- a/app/views/admin/e_paper_criterias/emailer.html.erb +++ b/app/views/admin/e_paper_criterias/emailer.html.erb @@ -162,10 +162,19 @@ } +<% + have_papaers = papers_data.present? + if paper.image.present? + img_src = siteurl + "/" + paper.image.url + else + img_src = nil + end +%>
- <% if paper.image.present? %> - " alt="<%= paper.title %>" /> + <% if have_papaers %> + <% if img_src %> + <%= paper.title %> <% end %>
@@ -181,10 +190,8 @@ <%= t('e_paper.description') %>: - <% if papers_data.present? %> - <%= paper.description.html_safe %> -
- <% end %> + <%= paper.description.html_safe %> +
<%= paper.content.html_safe %>
@@ -208,6 +215,21 @@ <% end %> <% end %>
+ <% else %> + <% if img_src %> + <%= paper.title %> + <% end %> +
+ +
+ <%= paper.content.html_safe %> +
+
+ <% end %>