forked from OpenNeo/impress
retain query on item page
This commit is contained in:
parent
55126756ea
commit
df3fcd101f
2 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
class ItemsController < ApplicationController
|
||||
before_filter :set_query
|
||||
|
||||
def index
|
||||
if params.has_key?(:q)
|
||||
@query = params[:q]
|
||||
begin
|
||||
@results = Item.search(@query).alphabetize.paginate :page => params[:page]
|
||||
rescue
|
||||
|
@ -13,4 +14,10 @@ class ItemsController < ApplicationController
|
|||
def show
|
||||
@item = Item.find params[:id]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_query
|
||||
@query = params[:q]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
= link_to item, :class => 'item' do
|
||||
= link_to item_path(item, :q => @query), :class => 'item' do
|
||||
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
|
||||
= item.name
|
||||
|
|
Loading…
Reference in a new issue