forked from OpenNeo/impress
Merge branch 'closet'
This commit is contained in:
commit
92b4d456af
4 changed files with 39 additions and 10 deletions
|
@ -41,6 +41,9 @@ class ItemsController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@item = Item.find params[:id]
|
@item = Item.find params[:id]
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html do
|
||||||
|
|
||||||
@trading_closet_hangers_by_owned = {
|
@trading_closet_hangers_by_owned = {
|
||||||
true => @item.closet_hangers.owned_trading.newest.includes(:user),
|
true => @item.closet_hangers.owned_trading.newest.includes(:user),
|
||||||
false => @item.closet_hangers.wanted_trading.newest.includes(:user)
|
false => @item.closet_hangers.wanted_trading.newest.includes(:user)
|
||||||
|
@ -53,6 +56,14 @@ class ItemsController < ApplicationController
|
||||||
hanger
|
hanger
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
format.gif do
|
||||||
|
expires_in 1.month
|
||||||
|
redirect_to @item.thumbnail_url
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def needed
|
def needed
|
||||||
|
|
|
@ -73,6 +73,21 @@ module ClosetHangersHelper
|
||||||
item.name.gsub(/ on/i, ' o<b></b>n')
|
item.name.gsub(/ on/i, ' o<b></b>n')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
PETPAGE_IMAGE_URL_BLACKLIST = %w(window. ondrop)
|
||||||
|
def petpage_item_thumbnail_url(item)
|
||||||
|
url = item.thumbnail_url
|
||||||
|
|
||||||
|
# If the URL includes any of the blacklisted terms, use our redirect URL
|
||||||
|
PETPAGE_IMAGE_URL_BLACKLIST.each do |term|
|
||||||
|
if url.include?(term)
|
||||||
|
url = item_url(item, :format => :gif)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
url
|
||||||
|
end
|
||||||
|
|
||||||
def public_perspective?
|
def public_perspective?
|
||||||
@public_perspective
|
@public_perspective
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%div.dti-item
|
%div.dti-item
|
||||||
= image_tag hanger.item.thumbnail_url, :alt => nil, :class => 'dti-item-thumbnail'
|
= image_tag petpage_item_thumbnail_url(hanger.item), :alt => nil, :class => 'dti-item-thumbnail'
|
||||||
- if hanger.item.nc?
|
- if hanger.item.nc?
|
||||||
= image_tag nc_icon_url, :alt => 'NC', :class => 'dti-item-nc', :title => 'This is an NC Mall item'
|
= image_tag nc_icon_url, :alt => 'NC', :class => 'dti-item-nc', :title => 'This is an NC Mall item'
|
||||||
%span= petpage_item_name hanger.item
|
%span= petpage_item_name hanger.item
|
||||||
|
|
|
@ -39,5 +39,8 @@ module OpenneoImpressItems
|
||||||
|
|
||||||
# Configure sensitive parameters which will be filtered from the log file.
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
config.filter_parameters << :password
|
config.filter_parameters << :password
|
||||||
|
|
||||||
|
Mime::Type.register "image/gif", :gif
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue