%h1 Blacklisted email addresses

= paginated_section @black_lists, renderer: PagerRenderer, previous_label: image_tag("pager/previous.png", size: "13x14"), next_label: image_tag("pager/next.png", size: "13x14"), text: "Address" do
  %p.count= page_entries_info @black_lists, model: "blacklisted email addresses"
  %table.table.table-striped
    %thead
      %tr
        %th Email address
        %th Reason blacklisted
        %th When
    %tbody
      - @black_lists.each do |black_list|
        %tr
          %td= black_list.address.text
          %td
            - unless black_list.caused_by_delivery.subject.blank?
              = link_to truncate(black_list.caused_by_delivery.postfix_log_lines.first.extended_status, length: 160), black_list.caused_by_delivery
          %td
            = time_ago_in_words(black_list.caused_by_delivery.postfix_log_lines.first.created_at)
            ago
          - if policy(black_list).destroy?
            %td
              = button_to "Remove", black_list, method: :delete, class: "btn btn-danger"

.page-header
  %h1 Blacklisted email addresses
  %p
    This list is auto-populated with any email addresses that bounce. Any further emails to addresses
    in this list will be "held back" and not sent.


= paginated_section @black_lists, renderer: PagerRenderer, previous_label: image_tag("pager/previous.png", size: "13x14"), next_label: image_tag("pager/next.png", size: "13x14"), text: "Address" do
  %p.count= page_entries_info @black_lists, model: "blacklisted email addresses"
  - if @black_lists.size > 0
    %table.table.table-striped
      %thead
        %tr
          %th Email address
          %th Reason blacklisted
          %th When
      %tbody
        - @black_lists.each do |black_list|
          %tr
            %td= black_list.address.text
            %td
              - unless black_list.caused_by_delivery.subject.blank?
                = link_to truncate(black_list.caused_by_delivery.postfix_log_lines.first.extended_status, length: 160), black_list.caused_by_delivery
            %td
              = time_ago_in_words(black_list.caused_by_delivery.postfix_log_lines.first.created_at)
              ago
            - if policy(black_list).destroy?
              %td
                = button_to "Remove", black_list, method: :delete, class: "btn btn-danger"

Use page header and don't show table header if no blacklisted emails
Use page header and don't show table header if no blacklisted emails
