forked from OpenNeo/impress
cache just content on items, not action, so we can still use title and canonical
This commit is contained in:
parent
183430adb6
commit
3b7f158890
3 changed files with 40 additions and 38 deletions
|
@ -1,7 +1,6 @@
|
|||
class ItemsController < ApplicationController
|
||||
before_filter :set_query
|
||||
caches_action :show, :layout => false
|
||||
|
||||
|
||||
def index
|
||||
if params.has_key?(:q)
|
||||
begin
|
||||
|
@ -35,11 +34,11 @@ class ItemsController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@item = Item.find params[:id]
|
||||
end
|
||||
|
||||
|
||||
def needed
|
||||
if params[:color] && params[:species]
|
||||
@pet_type = PetType.find_by_color_id_and_species_id(
|
||||
|
@ -54,10 +53,11 @@ class ItemsController < ApplicationController
|
|||
@pet_name = params[:name]
|
||||
render :layout => 'application'
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_query
|
||||
@query = params[:q]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,42 +2,43 @@
|
|||
- content_for :meta do
|
||||
%link{:rel => 'canonical', :href => url_for(@item)}
|
||||
|
||||
%header
|
||||
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
|
||||
%div
|
||||
%h2#item-name= @item.name
|
||||
= nc_icon_for(@item)
|
||||
- unless @item.rarity.blank?
|
||||
== Rarity: #{@item.rarity_index} (#{@item.rarity})
|
||||
%a.button{:href => neoitems_url_for(@item)} NeoItems
|
||||
- cache "items_show_#{@item.id}_main_content" do
|
||||
%header
|
||||
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
|
||||
%div
|
||||
%h2#item-name= @item.name
|
||||
= nc_icon_for(@item)
|
||||
- unless @item.rarity.blank?
|
||||
== Rarity: #{@item.rarity_index} (#{@item.rarity})
|
||||
%a.button{:href => neoitems_url_for(@item)} NeoItems
|
||||
|
||||
%p= @item.description
|
||||
%p= @item.description
|
||||
|
||||
#item-zones
|
||||
%p
|
||||
%strong Occupies:
|
||||
= list_zones @item.occupied_zones, :uncertain_label
|
||||
%p
|
||||
%strong Restricts:
|
||||
- if @item.restricted_zones.empty?
|
||||
None
|
||||
- else
|
||||
= list_zones @item.restricted_zones
|
||||
#item-zones
|
||||
%p
|
||||
%strong Occupies:
|
||||
= list_zones @item.occupied_zones, :uncertain_label
|
||||
%p
|
||||
%strong Restricts:
|
||||
- if @item.restricted_zones.empty?
|
||||
None
|
||||
- else
|
||||
= list_zones @item.restricted_zones
|
||||
|
||||
#item-preview-header
|
||||
%h3 Preview
|
||||
%a#customize-more.button{:href => '/'} Customize more
|
||||
#item-preview-header
|
||||
%h3 Preview
|
||||
%a#customize-more.button{:href => '/'} Customize more
|
||||
|
||||
#item-preview
|
||||
#item-preview-species= standard_species_images_for(@item)
|
||||
#item-preview-error
|
||||
#item-preview-swf
|
||||
Javascript and Flash are required to preview wearables. Sorry!
|
||||
#item-preview
|
||||
#item-preview-species= standard_species_images_for(@item)
|
||||
#item-preview-error
|
||||
#item-preview-swf
|
||||
Javascript and Flash are required to preview wearables. Sorry!
|
||||
|
||||
:javascript
|
||||
var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect},
|
||||
IMPRESS_HOST = #{RemoteImpressHost.inspect};
|
||||
:javascript
|
||||
var CURRENT_ITEM_ZONES_RESTRICT = #{@item.zones_restrict.inspect},
|
||||
IMPRESS_HOST = #{RemoteImpressHost.inspect};
|
||||
|
||||
= include_javascript_libraries :jquery, :swfobject
|
||||
= javascript_include_tag 'items/show'
|
||||
= include_javascript_libraries :jquery, :swfobject
|
||||
= javascript_include_tag 'items/show'
|
||||
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
= submit_tag 'Search', :name => nil
|
||||
= yield
|
||||
= render :file => 'layouts/application'
|
||||
|
||||
|
|
Loading…
Reference in a new issue