1
0
Fork 0
forked from OpenNeo/impress

retain query on item page

This commit is contained in:
Emi Matchu 2010-06-07 20:02:46 -04:00
parent 55126756ea
commit df3fcd101f
2 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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