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,7 +1,11 @@
|
|||
class PackagesController < ApplicationController
|
||||
def index
|
||||
query = '%'+params[:search]+'%'
|
||||
@packages = Package.where("description like ? or name like ?", query, query).order('name').first(20)
|
||||
if params[:search]
|
||||
query = '%'+params[:search]+'%'
|
||||
@packages = Package.where("description like ? or name like ?", query, query).order('name').first(20)
|
||||
else
|
||||
@packages = Package.order('name').first(20)
|
||||
end
|
||||
end
|
||||
|
||||
def with_screenshots
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue