newest items
This commit is contained in:
parent
b939c7fce6
commit
d99a1ad792
7 changed files with 53 additions and 27 deletions
|
@ -32,7 +32,10 @@ class ItemsController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render }
|
||||
format.html {
|
||||
@newest_items = Item.newest.limit(9)
|
||||
render
|
||||
}
|
||||
format.js { render :json => {:error => '$q required'}}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,6 +38,8 @@ class Item < ActiveRecord::Base
|
|||
"LEFT JOIN #{SwfAsset.table_name} sa ON sa.type = 'object' AND sa.id = psa.swf_asset_id"
|
||||
).where('sa.id IS NULL')
|
||||
|
||||
scope :newest, order(arel_table[:created_at].desc)
|
||||
|
||||
scope :spidered_longest_ago, order(["(#{Item.arel_table[:last_spidered].eq(nil).to_sql}) DESC", arel_table[:last_spidered].desc])
|
||||
|
||||
scope :sold_in_mall, where(:sold_in_mall => true)
|
||||
|
|
|
@ -8,7 +8,7 @@ body.items-index
|
|||
form
|
||||
margin-bottom: 2em
|
||||
|
||||
#search-help
|
||||
#search-info
|
||||
+main_unit
|
||||
padding-right: 1%
|
||||
dl
|
||||
|
@ -22,3 +22,4 @@ body.items-index
|
|||
img
|
||||
height: 80px
|
||||
width: 80px
|
||||
|
||||
|
|
|
@ -13,26 +13,31 @@
|
|||
= render @items
|
||||
= will_paginate @items
|
||||
- else
|
||||
#search-help
|
||||
%h2 Find what you're looking for
|
||||
%dl
|
||||
%dt kreludor "altador cup" -background
|
||||
%dd
|
||||
returns any item with the word "kreludor" and the phrase "altador cup"
|
||||
in it, but not the word "background"
|
||||
%dt hat user:owns
|
||||
%dd
|
||||
returns
|
||||
= link_to 'items that you own', your_items_path
|
||||
with the word "hat"
|
||||
%dt blue is:nc
|
||||
%dd returns any NC Mall item with the word "blue" in it
|
||||
%dt collar -is:pb
|
||||
%dd returns any item with the word "collar" in it that isn't from a paint brush
|
||||
%dt species:shoyru
|
||||
%dd returns any item a Shoyru can wear
|
||||
%dt type:hat
|
||||
%dd returns any item that fills a "hat" zone
|
||||
#search-info
|
||||
#search-help
|
||||
%h2 Find what you're looking for
|
||||
%dl
|
||||
%dt kreludor "altador cup" -background
|
||||
%dd
|
||||
returns any item with the word "kreludor" and the phrase "altador cup"
|
||||
in it, but not the word "background"
|
||||
%dt hat user:owns
|
||||
%dd
|
||||
returns
|
||||
= link_to 'items that you own', your_items_path
|
||||
with the word "hat"
|
||||
%dt blue is:nc
|
||||
%dd returns any NC Mall item with the word "blue" in it
|
||||
%dt collar -is:pb
|
||||
%dd returns any item with the word "collar" in it that isn't from a paint brush
|
||||
%dt species:shoyru
|
||||
%dd returns any item a Shoyru can wear
|
||||
%dt type:hat
|
||||
%dd returns any item that fills a "hat" zone
|
||||
|
||||
#search-new-items
|
||||
%h2 Newest items
|
||||
= render @newest_items
|
||||
|
||||
#species-search-links
|
||||
%h2 Can't decide? Search by species
|
||||
|
|
13
db/migrate/20110804134432_add_timestamps_to_items.rb
Normal file
13
db/migrate/20110804134432_add_timestamps_to_items.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class AddTimestampsToItems < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_timestamps :objects
|
||||
|
||||
timestamp_query = "(SELECT created_at FROM contributions WHERE contributed_id = objects.id AND contributed_type = 'Item')"
|
||||
update "UPDATE objects SET created_at = #{timestamp_query}, updated_at = #{timestamp_query}"
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_timestamps :objects
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110731021808) do
|
||||
ActiveRecord::Schema.define(:version => 20110804134432) do
|
||||
|
||||
create_table "auth_servers", :force => true do |t|
|
||||
t.string "short_name", :limit => 10, :null => false
|
||||
|
@ -86,6 +86,8 @@ ActiveRecord::Schema.define(:version => 20110731021808) do
|
|||
t.text "species_support_ids", :limit => 16777215
|
||||
t.boolean "sold_in_mall", :null => false
|
||||
t.datetime "last_spidered"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "objects", ["last_spidered"], :name => "objects_last_spidered"
|
||||
|
|
|
@ -1638,21 +1638,21 @@ body.items-index form {
|
|||
margin-bottom: 2em;
|
||||
}
|
||||
/* line 11, ../../../app/stylesheets/items/_index.sass */
|
||||
body.items-index #search-help {
|
||||
body.items-index #search-info {
|
||||
float: left;
|
||||
width: 49%;
|
||||
padding-right: 1%;
|
||||
}
|
||||
/* line 4, ../../../app/stylesheets/items/_index.sass */
|
||||
body.items-index #search-help h2 {
|
||||
body.items-index #search-info h2 {
|
||||
font-size: 125%;
|
||||
}
|
||||
/* line 14, ../../../app/stylesheets/items/_index.sass */
|
||||
body.items-index #search-help dl {
|
||||
body.items-index #search-info dl {
|
||||
text-align: left;
|
||||
}
|
||||
/* line 16, ../../../app/stylesheets/items/_index.sass */
|
||||
body.items-index #search-help dd {
|
||||
body.items-index #search-info dd {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
/* line 19, ../../../app/stylesheets/items/_index.sass */
|
||||
|
|
Loading…
Reference in a new issue