Remove no-op item.thumbnail.secure_url
There was a time when I used an old proxy server to try to fix mixed content issues, and I eventually removed it but never took the tendrils out from the code. We probably _should_ figure out how to secure these URLs! But until then, we may as well simplify the code.
This commit is contained in:
parent
5e25e0bda6
commit
c6cb61ef38
6 changed files with 5 additions and 29 deletions
|
@ -19,7 +19,7 @@ module ContributionHelper
|
||||||
:item_link => link)
|
:item_link => link)
|
||||||
output = translate("contributions.contributed_description.main.#{main_key}_html",
|
output = translate("contributions.contributed_description.main.#{main_key}_html",
|
||||||
:item_description => description)
|
:item_description => description)
|
||||||
output << image_tag(item.thumbnail.secure_url) if show_image
|
output << image_tag(item.thumbnail_url) if show_image
|
||||||
output
|
output
|
||||||
else
|
else
|
||||||
translate('contributions.contributed_description.parents.item.blank')
|
translate('contributions.contributed_description.parents.item.blank')
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
class Image
|
|
||||||
attr_reader :insecure_url, :secure_url
|
|
||||||
|
|
||||||
def initialize(insecure_url, secure_url)
|
|
||||||
@insecure_url = insecure_url
|
|
||||||
@secure_url = secure_url
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.from_insecure_url(insecure_url)
|
|
||||||
# TODO: We used to use a "Camo" server for this, but we don't anymore.
|
|
||||||
# Replace this with actual logic to actually secure the URLs!
|
|
||||||
Image.new insecure_url, insecure_url
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -413,16 +413,6 @@ class Item < ApplicationRecord
|
||||||
modeled_body_ids.size.to_f / predicted_body_ids.size
|
modeled_body_ids.size.to_f / predicted_body_ids.size
|
||||||
end
|
end
|
||||||
|
|
||||||
def thumbnail
|
|
||||||
if thumbnail_url.present?
|
|
||||||
url = thumbnail_url
|
|
||||||
else
|
|
||||||
url = ActionController::Base.helpers.asset_path(
|
|
||||||
"broken_item_thumbnail.gif")
|
|
||||||
end
|
|
||||||
@thumbnail ||= Image.from_insecure_url(url)
|
|
||||||
end
|
|
||||||
|
|
||||||
def as_json(options={})
|
def as_json(options={})
|
||||||
json = {
|
json = {
|
||||||
:description => description,
|
:description => description,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
= link_to item_path(item) do
|
= link_to item_path(item) do
|
||||||
= image_tag item.thumbnail.secure_url, :alt => item.description, :title => item.description
|
= image_tag item.thumbnail_url, :alt => item.description, :title => item.description
|
||||||
%span.name= item.name
|
%span.name= item.name
|
||||||
= nc_icon_for(item)
|
= nc_icon_for(item)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- canonical_path @item
|
- canonical_path @item
|
||||||
|
|
||||||
%header#item-header
|
%header#item-header
|
||||||
= image_tag @item.thumbnail.secure_url, :id => 'item-thumbnail'
|
= image_tag @item.thumbnail_url, :id => 'item-thumbnail'
|
||||||
%div
|
%div
|
||||||
%h2#item-name= @item.name
|
%h2#item-name= @item.name
|
||||||
= nc_icon_for(@item)
|
= nc_icon_for(@item)
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
- @newest_unmodeled_items.each do |item|
|
- @newest_unmodeled_items.each do |item|
|
||||||
- localized_cache "items/#{item.id} modeling_progress updated_at=#{item.updated_at.to_i}" do
|
- localized_cache "items/#{item.id} modeling_progress updated_at=#{item.updated_at.to_i}" do
|
||||||
%li{'data-item-id' => item.id}
|
%li{'data-item-id' => item.id}
|
||||||
= link_to image_tag(item.thumbnail.secure_url), item, :class => 'image-link'
|
= link_to image_tag(item.thumbnail_url), item, :class => 'image-link'
|
||||||
= link_to item, :class => 'header' do
|
= link_to item, :class => 'header' do
|
||||||
%h2= item.name
|
%h2= item.name
|
||||||
%span.meter{style: "width: #{@newest_unmodeled_items_predicted_modeled_ratio[item]*100}%"}
|
%span.meter{style: "width: #{@newest_unmodeled_items_predicted_modeled_ratio[item]*100}%"}
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
- @newest_modeled_items.each do |item|
|
- @newest_modeled_items.each do |item|
|
||||||
%li.object
|
%li.object
|
||||||
= link_to item, title: item.name, alt: item.name do
|
= link_to item, title: item.name, alt: item.name do
|
||||||
= image_tag item.thumbnail.secure_url
|
= image_tag item.thumbnail_url
|
||||||
= nc_icon_for(item)
|
= nc_icon_for(item)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue