indentlabs/notebook

View on GitHub
app/views/admin/spam.html.erb

Summary

Maintainability
Test Coverage
<table style="max-width: 100%">
  <tr>
    <th>Thread</th>
    <th>Links</th>
    <th>Images</th>
    <th>Full text</th>
  </tr>
  <tr>

  <% @posts.each do |post| %>
    <% links = post.content.scan(/([htp]+?s?:?\/\/[^\s\)"']*)/i) %>
    <% next unless links.any? %>
    <tr>
        <td style="max-width: 200px">
          <%= post.postable.title %> (<%= post.postable.slug %>)
        </td>
        <td style="max-width: 200px; overflow-x: scroll">
          <ul>
            <% links.each do |url| %>
              <%= link_to url.first, url.first %>
            <% end %>
          </ul>
        </td>
        <td>
          <% links.each do |url| %>
            <%= link_to url.first do %>
              <%= image_tag url.first, class: 'left', style: "height: 200px; width: 200px" %>
            <% end %>
          <% end %>
        </td>
        <td style="max-width: 800px; overflow-x: scroll">
          <%= post.content %>
        </td>
    </tr>
  <% end %>
</table>