<commit_before><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Sent Email</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.0.0/normalize.css" charset="utf-8">
    <style>
      body {
        min-width: 800px;
        font-size: 15px;
        font-family: sans-serif;
      }

      iframe {
        width: 100%;
        border: none;
      }

      .truncate {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .container {
        display: flex;
        flex-direction: row;
      }

      .email-sidebar {
        display: flex;
        flex-direction: column;
        padding: 25px 35px;;
        width: 40%;
        max-width: 400px;
      }

      .selected-email {
        background-color: #2D9EB9;
        -webkit-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
        -moz-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
        box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
      }

      .selected-email .email-summary-subject,
      .selected-email .email-summary-recipients {
        color: #fff;
      }

      .selected-email .email-summary-body-excerpt {
        color: #CDF0F8;
      }

      .email-summary {
        display: flex;
        flex-direction: column;
        text-decoration: none;
        color: #000;
        padding: 15px 25px;
        border-radius: 5px;
      }

      .email-summary:hover {
        -webkit-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
        -moz-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
        box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
      }

      .email-summary-subject {
        font-weight: 700;
        font-size: 15px;
        padding: 5px 0px;
      }

      .email-summary-recipients {
        font-size: 15px;
        padding-bottom: 5px;
      }

      .email-summary-body-excerpt {
        color: #777;
        max-height: 40px;
        font-size: 14px;
        line-height: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .email-detail-pane {
        width: 100%;
        padding: 35px;
        padding-left: 0;
        display: flex;
        flex-direction: column;
      }

      .email-detail-hero {
        display: flex;
        flex-direction: column;
        padding-left: 20px;
      }

      .email-detail-subject {
        font-weight: bold;
        font-size: 22px;
        padding: 10px 0;
      }

      .email-detail-bodies-container {
        border: 1px solid #eee;
        border-radius: 5px;
        padding: 20px;
        margin-top: 30px;
      }

      .email-detail-body-label {
        padding: 0;
        margin: 0 0 12px 0;
        font-size: 15px;
        font-weight: 700;
      }

      .email-detail-recipients,
      .email-detail-headers {
        color: #aaa;
      }

      .email-detail-recipients strong,
      .email-detail-headers strong {
        color: #555;
      }

      .email-detail-body {
        margin: 15px 0 25px 0;
      }
    </style>
  </head>

  <body>
    <main class="container">
      <aside class="email-sidebar">
        <%= for email <- @emails do %>
          <a
            class="email-summary <%= Bamboo.SentEmailViewerPlug.Helper.selected_email_class(email, @selected_email) %>"
            href="<%= "#{@base_path}/#{Bamboo.SentEmail.get_id(email)}" %>">
            <span class="email-summary-subject truncate"><%= email.subject %></span>
            <span class="email-summary-recipients truncate">
              <%= Bamboo.SentEmailViewerPlug.Helper.format_email_address(email.from) %>
              to <%= Bamboo.SentEmailViewerPlug.Helper.email_addresses(email) %>
            </span>
            <span class="email-summary-body-excerpt"><%= email.text_body %></span>
          </a>
        <% end %>
      </aside>
      <section class="email-detail-pane">
        <section class="email-detail-hero">
          <span class="email-detail-subject"><%= @selected_email.subject %></span>
          <span class="email-detail-recipients">
            From <strong><%= Bamboo.SentEmailViewerPlug.Helper.format_email_address(@selected_email.from) %></strong>
            to <strong><%= Bamboo.SentEmailViewerPlug.Helper.email_addresses(@selected_email) %></strong>
          </span>
          <span class="email-detail-headers">
            <%= for {header, value} <- @selected_email.headers do %>
              <div class="email-detail-header">
                <%= header %> <strong><%= Bamboo.SentEmailViewerPlug.Helper.format_headers(value) %></strong>
              </div>
            <% end %>
          </span>
        </section>

        <section class="email-detail-bodies-container">
          <h3 class="email-detail-body-label">HTML body</h3>
          <p class="email-detail-body">
            <script>
            function adjustFrameHeight(iframe) {
              var body = iframe.contentWindow.document.body;
              iframe.style.height = (body.scrollHeight + body.offsetHeight - body.clientHeight) + "px";
            }
            </script>
            <iframe onload="adjustFrameHeight(this)" src="<%= "#{@base_path}/#{Bamboo.SentEmail.get_id(@selected_email)}/html" %>"></iframe>
          </p>

          <h3 class="email-detail-body-label">Text Body</h3>
          <p class="email-detail-body">
            <%= Bamboo.SentEmailViewerPlug.Helper.format_text(@selected_email.text_body) %>
          </p>
        </section>
      </section>
    </main>
  </body>
</html><commit_msg>Fix collapsing html email preview (#351)<commit_after><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Sent Email</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.0.0/normalize.css" charset="utf-8">
    <style>
      body {
        min-width: 800px;
        font-size: 15px;
        font-family: sans-serif;
      }

      iframe {
        width: 100%;
        border: none;
      }

      .truncate {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .container {
        display: flex;
        flex-direction: row;
      }

      .email-sidebar {
        display: flex;
        flex-direction: column;
        padding: 25px 35px;;
        width: 40%;
        max-width: 400px;
      }

      .selected-email {
        background-color: #2D9EB9;
        -webkit-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
        -moz-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
        box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.21);
      }

      .selected-email .email-summary-subject,
      .selected-email .email-summary-recipients {
        color: #fff;
      }

      .selected-email .email-summary-body-excerpt {
        color: #CDF0F8;
      }

      .email-summary {
        display: flex;
        flex-direction: column;
        text-decoration: none;
        color: #000;
        padding: 15px 25px;
        border-radius: 5px;
      }

      .email-summary:hover {
        -webkit-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
        -moz-box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
        box-shadow: 0px 5px 17px 1px rgba(0,0,0,0.11);
      }

      .email-summary-subject {
        font-weight: 700;
        font-size: 15px;
        padding: 5px 0px;
      }

      .email-summary-recipients {
        font-size: 15px;
        padding-bottom: 5px;
      }

      .email-summary-body-excerpt {
        color: #777;
        max-height: 40px;
        font-size: 14px;
        line-height: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .email-detail-pane {
        width: 100%;
        padding: 35px;
        padding-left: 0;
        display: flex;
        flex-direction: column;
      }

      .email-detail-hero {
        display: flex;
        flex-direction: column;
        padding-left: 20px;
      }

      .email-detail-subject {
        font-weight: bold;
        font-size: 22px;
        padding: 10px 0;
      }

      .email-detail-bodies-container {
        border: 1px solid #eee;
        border-radius: 5px;
        padding: 20px;
        margin-top: 30px;
      }

      .email-detail-body-label {
        padding: 0;
        margin: 0 0 12px 0;
        font-size: 15px;
        font-weight: 700;
      }

      .email-detail-recipients,
      .email-detail-headers {
        color: #aaa;
      }

      .email-detail-recipients strong,
      .email-detail-headers strong {
        color: #555;
      }

      .email-detail-body {
        margin: 15px 0 25px 0;
      }
    </style>
  </head>

  <body>
    <main class="container">
      <aside class="email-sidebar">
        <%= for email <- @emails do %>
          <a
            class="email-summary <%= Bamboo.SentEmailViewerPlug.Helper.selected_email_class(email, @selected_email) %>"
            href="<%= "#{@base_path}/#{Bamboo.SentEmail.get_id(email)}" %>">
            <span class="email-summary-subject truncate"><%= email.subject %></span>
            <span class="email-summary-recipients truncate">
              <%= Bamboo.SentEmailViewerPlug.Helper.format_email_address(email.from) %>
              to <%= Bamboo.SentEmailViewerPlug.Helper.email_addresses(email) %>
            </span>
            <span class="email-summary-body-excerpt"><%= email.text_body %></span>
          </a>
        <% end %>
      </aside>
      <section class="email-detail-pane">
        <section class="email-detail-hero">
          <span class="email-detail-subject"><%= @selected_email.subject %></span>
          <span class="email-detail-recipients">
            From <strong><%= Bamboo.SentEmailViewerPlug.Helper.format_email_address(@selected_email.from) %></strong>
            to <strong><%= Bamboo.SentEmailViewerPlug.Helper.email_addresses(@selected_email) %></strong>
          </span>
          <span class="email-detail-headers">
            <%= for {header, value} <- @selected_email.headers do %>
              <div class="email-detail-header">
                <%= header %> <strong><%= Bamboo.SentEmailViewerPlug.Helper.format_headers(value) %></strong>
              </div>
            <% end %>
          </span>
        </section>

        <section class="email-detail-bodies-container">
          <h3 class="email-detail-body-label">HTML body</h3>
          <p class="email-detail-body">
            <script>
            function adjustFrameHeight(iframe) {
              var contentWindow = iframe.contentWindow;
              iframe.style.height = (contentWindow.outerHeight) + "px";
            }
            </script>
            <iframe onload="adjustFrameHeight(this)" src="<%= "#{@base_path}/#{Bamboo.SentEmail.get_id(@selected_email)}/html" %>"></iframe>
          </p>

          <h3 class="email-detail-body-label">Text Body</h3>
          <p class="email-detail-body">
            <%= Bamboo.SentEmailViewerPlug.Helper.format_text(@selected_email.text_body) %>
          </p>
        </section>
      </section>
    </main>
  </body>
</html>
{'fraction_non_alphanumeric': 0.14499910217274198, 'fraction_numerical': 0.029538516789369727, 'mean_word_length': 1.8423067108956366, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 153, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4222522', 'n_tokens_mistral': 3982, 'n_tokens_neox': 3511, 'n_words': 636}