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.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. <%= external_link(
  14. "http://board.vivalavinyl.com/thread/view/#{result[:remote_id]}",
  15. result[:title]
  16. ) %>
  17. <p class="result__info">
  18. <span>
  19. created by <%= result[:creator] %>
  20. on <%= result[:created_at].strftime('%B %d, %Y') %>
  21. </span>
  22. <span>
  23. last post by <%= result[:last_post_creator] %>
  24. at <%= result[:last_post_created_at].strftime('%-I:%M %p EST') %>
  25. on <%= result[:last_post_created_at].strftime('%B %-d, %Y') %>
  26. </span>
  27. </p>
  28. <% elsif params[:type] == "posts" %>
  29. <p>
  30. In thread:
  31. <strong>
  32. <%= external_link(
  33. "http://board.vivalavinyl.com/thread/view/#{result[:remote_thread_id]}",
  34. result[:thread_title]
  35. ) %>
  36. </strong>
  37. </p>
  38. <p class="result__info">
  39. <%= result[:creator] %> posted this at <%= result[:created_at] %>
  40. </p>
  41. <p class="result__body">
  42. <%= result[:body] %>
  43. </p>
  44. <% end %>
  45. </div>
  46. <% end %>
  47. <% if params[:q] %>
  48. <% if params[:page] > 1 %>
  49. <a class="btn btn--small btn--prev" href="<%= previous_url %>">
  50. previous page
  51. </a>
  52. <% end %>
  53. <% unless results.empty? %>
  54. <a class="btn btn--small btn--next" href="<%= next_url %>">
  55. next page
  56. </a>
  57. <% end %>
  58. <% end %>
  59. </div>
  60. </div>