Skip to content

Commit 5eb793a

Browse files
committed
Show headers in mailer previews only if there are headers present
1 parent fad9050 commit 5eb793a

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

railties/lib/rails/templates/rails/mailers/email.html.erb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,23 @@
125125
</select>
126126
</dd>
127127
<% end %>
128-
129-
<dt>Headers:</dt>
130-
<dd>
131-
<details>
132-
<summary>Show all headers</summary>
133-
<table>
134-
<% @email.header_fields.each do |field| %>
135-
<tr>
136-
<td align="right" style="color: #7f7f7f"><%= field.name %>:</td>
137-
<td><%= field.value %></td>
138-
</tr>
139-
<% end %>
140-
</table>
141-
</details>
142-
</dd>
128+
129+
<% unless @email.header_fields.nil? || @email.header_fields.empty? %>
130+
<dt>Headers:</dt>
131+
<dd>
132+
<details>
133+
<summary>Show all headers</summary>
134+
<table>
135+
<% @email.header_fields.each do |field| %>
136+
<tr>
137+
<td align="right" style="color: #7f7f7f"><%= field.name %>:</td>
138+
<td><%= field.value %></td>
139+
</tr>
140+
<% end %>
141+
</table>
142+
</details>
143+
</dd>
144+
<% end %>
143145

144146
<dt>EML File:</dt>
145147
<dd><%= link_to "Download", action: :download %></dd>

0 commit comments

Comments
 (0)