Simplify item page rendering
Just removing some caching and the expiration of it! There's still more superfluous(?) caching on the item page to audit, but these seem a bit more sensible about avoiding loading extra data.
This commit is contained in:
parent
02abd4e07f
commit
ffa73b6b03
3 changed files with 34 additions and 41 deletions
|
@ -61,14 +61,12 @@ class ItemsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
unless localized_fragment_exist?("items/#{@item.id} info")
|
|
||||||
@occupied_zones = @item.occupied_zones(
|
@occupied_zones = @item.occupied_zones(
|
||||||
scope: Zone.includes_translations.alphabetical
|
scope: Zone.includes_translations.alphabetical
|
||||||
)
|
)
|
||||||
@restricted_zones = @item.restricted_zones(
|
@restricted_zones = @item.restricted_zones(
|
||||||
scope: Zone.includes_translations.alphabetical
|
scope: Zone.includes_translations.alphabetical
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
unless localized_fragment_exist?("items/#{@item.id} contributors")
|
unless localized_fragment_exist?("items/#{@item.id} contributors")
|
||||||
@contributors_with_counts = @item.contributors_with_counts
|
@contributors_with_counts = @item.contributors_with_counts
|
||||||
|
|
|
@ -16,8 +16,6 @@ class Item
|
||||||
private
|
private
|
||||||
|
|
||||||
def self.expire_cache_for(item)
|
def self.expire_cache_for(item)
|
||||||
expire_fragment_in_all_locales("items/#{item.id} header")
|
|
||||||
expire_fragment_in_all_locales("items/#{item.id} info")
|
|
||||||
expire_key_in_all_locales("items/#{item.id}#as_json")
|
expire_key_in_all_locales("items/#{item.id}#as_json")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
- title @item.name
|
- title @item.name
|
||||||
- canonical_path @item
|
- canonical_path @item
|
||||||
|
|
||||||
- localized_cache "items/#{@item.id} header" do
|
|
||||||
%header#item-header
|
%header#item-header
|
||||||
= image_tag @item.thumbnail.secure_url, :id => 'item-thumbnail'
|
= image_tag @item.thumbnail.secure_url, :id => 'item-thumbnail'
|
||||||
%div
|
%div
|
||||||
|
@ -47,7 +46,6 @@
|
||||||
t('.closet_hangers.quantity_label')
|
t('.closet_hangers.quantity_label')
|
||||||
= submit_tag t('.closet_hangers.submit')
|
= submit_tag t('.closet_hangers.submit')
|
||||||
|
|
||||||
- localized_cache "items/#{@item.id} info" do
|
|
||||||
%p= @item.description
|
%p= @item.description
|
||||||
|
|
||||||
#item-zones
|
#item-zones
|
||||||
|
@ -73,7 +71,6 @@
|
||||||
%span.more= t '.trading_closet_hangers.show_more'
|
%span.more= t '.trading_closet_hangers.show_more'
|
||||||
%span.less= t '.trading_closet_hangers.show_less'
|
%span.less= t '.trading_closet_hangers.show_less'
|
||||||
|
|
||||||
- localized_cache 'items#show preview_header' do
|
|
||||||
#item-preview-header
|
#item-preview-header
|
||||||
%h3= t '.preview.header'
|
%h3= t '.preview.header'
|
||||||
= link_to t('.preview.customize_more'), root_path, :id => 'customize-more',
|
= link_to t('.preview.customize_more'), root_path, :id => 'customize-more',
|
||||||
|
|
Loading…
Reference in a new issue