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 2.3KB

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