- model_class = Email
.page-header
  %h1=t '.title', :default => model_class.model_name.human

%p
  %strong From:
  = link_to @email.from, emails_path(:from => @email.from)
%p
  %strong To:
  = @email.to.map{|e| link_to e, emails_path(to: e)}.join(", ").html_safe
%hr
- if @email.data.nil?
  %em
    Full text of email is not available
- else
  %p
    = @email.data.gsub("\r\n", "<br\>").html_safe if @email.data
%hr
%p
  %strong Received:
  = time_ago_in_words(@email.created_at)
  ago (#{@email.created_at})
%p
  - if @email.delivered == true
    %strong Delivered succesfully
  - elsif @email.delivered == false
    %strong Not delivered
  - else
    %strong Delivery status unknown

- unless @email.postfix_log_lines.empty?
  %table.table.table-condensed
    %caption Delivery Logs
    %thead
      %tr
        %th To
        %th DSN
        %th Status
    %tbody
      - @email.postfix_log_lines.each do |line|
        %tr
          %td= line.to
          %td= line.dsn
          %td.status{title: line.status}= truncate(line.status)

.form-actions
  = link_to t('.back', :default => t("helpers.links.back")), emails_path, :class => 'btn'

.page-header
  %h1 Email
  %p
  - if @email.delivered == true
    %span.label.label-success Delivered
  - elsif @email.delivered == false
    %span.label.label-warning Not delivered
  - else
    %span.label Delivery status unknown

%p
  %strong From:
  = link_to @email.from, emails_path(:from => @email.from)
%p
  %strong To:
  = @email.to.map{|e| link_to e, emails_path(to: e)}.join(", ").html_safe
%hr
- if @email.data.nil?
  %em
    Full text of email is not available
- else
  %p
    = @email.data.gsub("\r\n", "<br\>").html_safe if @email.data
%hr
%p
  %strong Received:
  = time_ago_in_words(@email.created_at)
  ago (#{@email.created_at})

- unless @email.postfix_log_lines.empty?
  %table.table.table-condensed
    %caption Delivery Logs
    %thead
      %tr
        %th To
        %th DSN
        %th Status
    %tbody
      - @email.postfix_log_lines.each do |line|
        %tr
          %td= line.to
          %td= line.dsn
          %td.status{title: line.status}= truncate(line.status)

.form-actions
  = link_to t('.back', :default => t("helpers.links.back")), emails_path, :class => 'btn'

Make the delivery status a little label
Make the delivery status a little label
