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

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