item presentation is neat

This commit is contained in:
Emi Matchu 2010-05-15 14:01:15 -04:00
parent cee6ee68a1
commit 8519f9131b
4 changed files with 7 additions and 3 deletions

View file

@ -3,7 +3,7 @@ class ItemsController < ApplicationController
if params.has_key?(:q) if params.has_key?(:q)
@query = params[:q] @query = params[:q]
begin begin
@results = Item.search(@query).all @results = Item.search(@query).alphabetize.all
rescue rescue
flash[:alert] = $!.message flash[:alert] = $!.message
end end

View file

@ -2,6 +2,8 @@ class Item < ActiveRecord::Base
set_table_name 'objects' # Neo & PHP Impress call them objects, but the class name is a conflict (duh!) set_table_name 'objects' # Neo & PHP Impress call them objects, but the class name is a conflict (duh!)
set_inheritance_column 'inheritance_type' # PHP Impress used "type" to describe category set_inheritance_column 'inheritance_type' # PHP Impress used "type" to describe category
scope :alphabetize, order('name ASC')
# Not defining validations, since this app is currently read-only # Not defining validations, since this app is currently read-only
def species_support_ids def species_support_ids

View file

@ -0,0 +1,3 @@
= div_for item do
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
= item.name

View file

@ -1,5 +1,4 @@
= form_tag items_path, :method => :get do = form_tag items_path, :method => :get do
= text_field_tag :q, @query = text_field_tag :q, @query
= submit_tag 'Search', :name => nil = submit_tag 'Search', :name => nil
- if @results = render @results
= @results.inspect