cache just content on items, not action, so we can still use title and canonical

This commit is contained in:
Emi Matchu 2011-05-20 20:23:37 -04:00
parent 183430adb6
commit 3b7f158890
3 changed files with 40 additions and 38 deletions

View file

@ -1,6 +1,5 @@
class ItemsController < ApplicationController class ItemsController < ApplicationController
before_filter :set_query before_filter :set_query
caches_action :show, :layout => false
def index def index
if params.has_key?(:q) if params.has_key?(:q)
@ -61,3 +60,4 @@ class ItemsController < ApplicationController
@query = params[:q] @query = params[:q]
end end
end end

View file

@ -2,7 +2,8 @@
- content_for :meta do - content_for :meta do
%link{:rel => 'canonical', :href => url_for(@item)} %link{:rel => 'canonical', :href => url_for(@item)}
%header - cache "items_show_#{@item.id}_main_content" do
%header
= image_tag @item.thumbnail_url, :id => 'item-thumbnail' = image_tag @item.thumbnail_url, :id => 'item-thumbnail'
%div %div
%h2#item-name= @item.name %h2#item-name= @item.name
@ -11,9 +12,9 @@
== Rarity: #{@item.rarity_index} (#{@item.rarity}) == Rarity: #{@item.rarity_index} (#{@item.rarity})
%a.button{:href => neoitems_url_for(@item)} NeoItems %a.button{:href => neoitems_url_for(@item)} NeoItems
%p= @item.description %p= @item.description
#item-zones #item-zones
%p %p
%strong Occupies: %strong Occupies:
= list_zones @item.occupied_zones, :uncertain_label = list_zones @item.occupied_zones, :uncertain_label
@ -24,20 +25,20 @@
- else - else
= list_zones @item.restricted_zones = list_zones @item.restricted_zones
#item-preview-header #item-preview-header
%h3 Preview %h3 Preview
%a#customize-more.button{:href => '/'} Customize more %a#customize-more.button{:href => '/'} Customize more
#item-preview #item-preview
#item-preview-species= standard_species_images_for(@item) #item-preview-species= standard_species_images_for(@item)
#item-preview-error #item-preview-error
#item-preview-swf #item-preview-swf
Javascript and Flash are required to preview wearables. Sorry! Javascript and Flash are required to preview wearables. Sorry!
:javascript :javascript
var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect}, var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect},
IMPRESS_HOST = #{RemoteImpressHost.inspect}; IMPRESS_HOST = #{RemoteImpressHost.inspect};
= include_javascript_libraries :jquery, :swfobject = include_javascript_libraries :jquery, :swfobject
= javascript_include_tag 'items/show' = javascript_include_tag 'items/show'

View file

@ -9,3 +9,4 @@
= submit_tag 'Search', :name => nil = submit_tag 'Search', :name => nil
= yield = yield
= render :file => 'layouts/application' = render :file => 'layouts/application'