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,6 +1,7 @@
- title @item.name - title @item.name
- canonical_path @item - canonical_path @item
- cache "items/#{@item.id} header" do
%header#item-header %header#item-header
= image_tag @item.thumbnail_url, :id => 'item-thumbnail' = image_tag @item.thumbnail_url, :id => 'item-thumbnail'
%div %div
@ -43,6 +44,8 @@
= 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'
- cache "items/#{@item.id} info" do
%p= @item.description %p= @item.description
#item-zones #item-zones
@ -86,7 +89,7 @@
%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