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.

search.erb 1.4KB

12345678910111213141516171819202122232425262728293031323334
  1. <div class="search">
  2. <form action="/search" method="get" class="form">
  3. <input name="q" type="search" value="<%= params[:q] %>" placeholder="Search for..." class="form__search" required>
  4. <div class="filters">
  5. <div class="filters__section">
  6. <p>Search in:</p>
  7. <label class="form__label">
  8. <input type="radio" name="type" value="threads" <% if [nil, "threads"].include?(params[:type]) %>checked<% end%>>
  9. Threads
  10. </label>
  11. <label class="form__label">
  12. <input type="radio" name="type" value="posts" <% if params[:type] == "posts" %>checked<% end %>>
  13. Posts
  14. </label>
  15. </div>
  16. <div class="filters__section filters__section--sort <%= params[:type] == 'threads' ? 'open' : '' %>">
  17. <p>Sort by:</p>
  18. <label class="form__label">
  19. <input type="radio" name="sort" value="thread" <% if [nil, "thread"].include? params[:sort] %>checked<% end%>>
  20. Thread creation
  21. </label>
  22. <label class="form__label">
  23. <input type="radio" name="sort" value="post" <% if params[:sort] == "post" %>checked<% end %>>
  24. Most recent post
  25. </label>
  26. </div>
  27. <div class="filters__section">
  28. <p>Posted by:</p>
  29. <input type="text" name="username" value="<%= params[:username] %>" class="form__text-field">
  30. </div>
  31. </div>
  32. <input type="submit" value="Search" class="btn form__submit">
  33. </form>
  34. </div>