You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

results.erb 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <%= erb :'partials/search' %>
  2. <div class="results-container">
  3. <% if params[:q] %>
  4. <p>Showing results for <strong><em><%= params[:q] %></em></strong>:</p>
  5. <% end %>
  6. <div class="results">
  7. <% if results.empty? %>
  8. <h3>No results!</h3>
  9. <% end %>
  10. <% results.each do |result| %>
  11. <div class="results__result <%= params[:type] %>">
  12. <% if params[:type] == "threads" %>
  13. <a href="http://board.vivalavinyl.com/thread/view/<%= result[:remote_id] %>">
  14. <%= result[:title] %>
  15. </a>
  16. <p class="result__info">
  17. <span>
  18. created by <%= result[:creator] %>
  19. on <%= result[:created_at].strftime('%B %d, %Y') %>
  20. </span>
  21. <span>
  22. last post by <%= result[:last_post_creator] %>
  23. at <%= result[:last_post_created_at].strftime('%-I:%M %p EST') %>
  24. on <%= result[:last_post_created_at].strftime('%B %-d, %Y') %>
  25. </span>
  26. </p>
  27. <% elsif params[:type] == "posts" %>
  28. <p>
  29. In thread:
  30. <a href="http://board.vivalavinyl.com/thread/view/<%= result[:remote_thread_id] %>">
  31. <strong><%= result[:thread_title] %></strong>
  32. </a>
  33. </p>
  34. <p class="result__info">
  35. <%= result[:creator] %> posted this at <%= result[:created_at] %>
  36. </p>
  37. <p class="result__body">
  38. <%= result[:body] %>
  39. </p>
  40. <% end %>
  41. </div>
  42. <% end %>
  43. <% if params[:q] %>
  44. <% if params[:page] > 1 %>
  45. <a class="btn btn--small btn--prev" href="<%= previous_url %>">
  46. previous page
  47. </a>
  48. <% end %>
  49. <a class="btn btn--small btn--next" href="<%= next_url %>">
  50. next page
  51. </a>
  52. <% end %>
  53. </div>
  54. </div>