Guest User

Untitled

a guest
Jun 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <h1>Search</h1>
  2.  
  3. <div id="search" style="width:400px; margin:0 auto;">
  4. <% form_for('/search') do %>
  5. <div>
  6. <label for="query">Search For:</label>
  7. <%= text_field_tag 'query', h(params[:query]), :size => 35 %>
  8. <%= submit_tag 'Search' %>
  9. </div>
  10. <div>
  11. <label for="type">Type:</label>
  12. <%= select_tag('type', options_for_select({:Book => 'book', :Tutor => 'tutor'}, params[:type])) %>
  13. <label for="wanted">For Sale:</label>
  14. <%= radio_button_tag 'for_sale', true, (params[:for_sale].nil? || params[:for_sale] == 'true' ? true : false) %>
  15. <label for="wanted">Wanted:</label>
  16. <%= radio_button_tag 'for_sale', false, params[:for_sale] == 'false' ? true : false %>
  17. </div>
  18. <% end %>
  19. </div>
  20.  
  21. <div id="results">
  22. <% if @result.size > 0 %>
  23. <% @results.each do |result| %>
  24. <div class="results">
  25. <h3><%= link_to(h(result.title), :controller => 'search', :action => 'view', :id => result.id) %></h3>
  26. <p>Price: $<%= result.price -%></p>
  27. <p><%=h result.description %></p>
  28. </div>
  29. <% end %>
  30. <% else %>
  31. <p>No results.</p>
  32. <% end %>
  33. </div>
Add Comment
Please, Sign In to add comment