Moved default page to "packages" controller.
Using a partial template to render search results. Show packages by default even without a query.
This commit is contained in:
parent
acd47f66d7
commit
f26f8a425b
5 changed files with 36 additions and 19 deletions
|
|
@ -1,14 +1,14 @@
|
|||
<h1>Hello, Rails!</h1>
|
||||
|
||||
<h1>Search for a package/description:</h1>
|
||||
<form action="/packages" method="get">
|
||||
<div>
|
||||
<input id="search" name="search" type="text" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<%= form_tag("/packages", method: "get") do %>
|
||||
<%= form_tag(url_for, method: "get") do %>
|
||||
<%= text_field_tag :search, '', autofocus: true, placeholder: 'Search criteria...' %>
|
||||
<%= submit_tag "Search" %>
|
||||
<% end %>
|
||||
|
||||
<h1>Search results</h1>
|
||||
|
||||
<%= @packages %>
|
||||
|
||||
<%= render "packages_search_results", object: @packages %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue