1
0
Fork 0
forked from OpenNeo/impress

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)
@query = params[:q]
begin
@results = Item.search(@query).all
@results = Item.search(@query).alphabetize.all
rescue
flash[:alert] = $!.message
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_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
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
= text_field_tag :q, @query
= submit_tag 'Search', :name => nil
- if @results
= @results.inspect
= render @results