Skip to content

Commit

Permalink
Merge pull request rails#41154 from c960657/patch-2
Browse files Browse the repository at this point in the history
Explicit check for html and text parts
  • Loading branch information
kaspth committed Jan 18, 2021
2 parents c219450 + 25f388b commit db79da6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions railties/lib/rails/templates/rails/mailers/email.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@
<% end %>

<dt>Format:</dt>
<% if @email.multipart? %>
<% if @email.html_part && @email.text_part %>
<dd>
<select id="part" onchange="refreshBody(false);">
<option <%= request.format == Mime[:html] ? 'selected' : '' %> value="<%= part_query('text/html') %>">View as HTML email</option>
<option <%= request.format == Mime[:text] ? 'selected' : '' %> value="<%= part_query('text/plain') %>">View as plain-text email</option>
</select>
</dd>
<% elsif @part %>
<dd id="mime_type" data-mime-type="<%= part_query(@part.mime_type) %>"><%= @part.mime_type == 'text/html' ? 'HTML email' : 'plain-text email' %></dd>
<% else %>
<dd id="mime_type" data-mime-type="<%= part_query(@email.mime_type) %>"><%= @email.mime_type == 'text/html' ? 'HTML email' : 'plain-text email' %></dd>
<dd id="mime_type" data-mime-type=""></dd>
<% end %>
<% if I18n.available_locales.count > 1 %>
Expand Down

0 comments on commit db79da6

Please sign in to comment.