CV-Gate/search_for_text_into_pdfs

View on GitHub
app/views/documents/search.html.erb

Summary

Maintainability
Test Coverage
<%= render 'search_form' %>
<h1>Search results</h1>

<table>
  <tr>
    <th>Title</th>
    <th>Content</th>
    <th>Private</th>
    <th>Download</th>
  </tr>

<% @documents.each do |document| %>
  <tr>
    <td><%= document.title %></td>
    <td><%= excerpt(document.content, params[:search], radius: 150, separator: " ") %></td>
    <td><%= document.private %></td>
    <td><%= link_to "Download", document.file_url.to_s %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Document', new_document_path %>