1
0
Fork 0
forked from OpenNeo/impress

better cache items#show

This commit is contained in:
Emi Matchu 2012-08-10 00:02:11 -04:00
parent 99669b8e4e
commit 412c401c5f
2 changed files with 34 additions and 29 deletions

View file

@ -22,6 +22,8 @@ class ItemObserver < ActionController::Caching::Sweeper
def expire_cache_for(item) def expire_cache_for(item)
controller.expire_fragment("items/#{item.id}#item_link_partial") controller.expire_fragment("items/#{item.id}#item_link_partial")
controller.expire_fragment("items/#{item.id} header")
controller.expire_fragment("items/#{item.id} info")
end end
def expire_newest_items def expire_newest_items

View file

@ -1,7 +1,8 @@
- title @item.name - title @item.name
- canonical_path @item - canonical_path @item
%header#item-header - cache "items/#{@item.id} header" do
%header#item-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
@ -43,9 +44,11 @@
= label_tag "quantity[#{owned}]" do = label_tag "quantity[#{owned}]" do
How many? How many?
= submit_tag 'Save to Your Items' = submit_tag 'Save to Your Items'
%p= @item.description
#item-zones - cache "items/#{@item.id} info" do
%p= @item.description
#item-zones
%p %p
%strong Occupies: %strong Occupies:
= list_zones @item.occupied_zones, :uncertain_label = list_zones @item.occupied_zones, :uncertain_label
@ -86,8 +89,8 @@
%span.more more %span.more more
%span.less less %span.less less
- cache 'items#show preview_header' do
#item-preview-header #item-preview-header
%h3 Preview %h3 Preview
%a#customize-more.button{:href => '/'} Customize more %a#customize-more.button{:href => '/'} Customize more