Merge branch 'outfit_thumbnails'
This commit is contained in:
commit
8a67f10952
2 changed files with 12 additions and 9 deletions
|
@ -5,7 +5,7 @@ class OutfitImageUploader < CarrierWave::Uploader::Base
|
||||||
include CarrierWave::MiniMagick
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
# Settings for S3 storage. Will only be used on production.
|
# Settings for S3 storage. Will only be used on production.
|
||||||
fog_directory 'impress-outfit-images'
|
fog_directory 'openneo-uploads'
|
||||||
fog_attributes 'Cache-Control' => "max-age=#{15.minutes}",
|
fog_attributes 'Cache-Control' => "max-age=#{15.minutes}",
|
||||||
'Content-Type' => 'image/png'
|
'Content-Type' => 'image/png'
|
||||||
|
|
||||||
|
|
|
@ -631,14 +631,17 @@ View.Outfits = function (wardrobe) {
|
||||||
wardrobe.outfits.toggleOutfitStar(el.tmplItem().data);
|
wardrobe.outfits.toggleOutfitStar(el.tmplItem().data);
|
||||||
});
|
});
|
||||||
|
|
||||||
function pathToUrl(path) {
|
function absoluteUrl(path_or_url) {
|
||||||
|
if(path_or_url.indexOf('://') == -1) {
|
||||||
var host = document.location.protocol + "//" + document.location.host;
|
var host = document.location.protocol + "//" + document.location.host;
|
||||||
if(document.location.port) host += ":" + document.location.port;
|
return host + path_or_url;
|
||||||
return host + path;
|
} else {
|
||||||
|
return path_or_url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateOutfitPermalink(outfit) {
|
function generateOutfitPermalink(outfit) {
|
||||||
return pathToUrl("/outfits/" + outfit.id);
|
return absoluteUrl("/outfits/" + outfit.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOutfitPermalink(outfit, outfit_permalink_el, outfit_url_el) {
|
function setOutfitPermalink(outfit, outfit_permalink_el, outfit_url_el) {
|
||||||
|
@ -785,9 +788,9 @@ View.Outfits = function (wardrobe) {
|
||||||
// to discover if this is a new outfit ID or not fails.
|
// to discover if this is a new outfit ID or not fails.
|
||||||
current_shared_outfit = outfit.clone();
|
current_shared_outfit = outfit.clone();
|
||||||
urls.permalink = generateOutfitPermalink(outfit);
|
urls.permalink = generateOutfitPermalink(outfit);
|
||||||
urls.small_image = pathToUrl(outfit.image_versions.small);
|
urls.small_image = absoluteUrl(outfit.image_versions.small);
|
||||||
urls.medium_image = pathToUrl(outfit.image_versions.medium);
|
urls.medium_image = absoluteUrl(outfit.image_versions.medium);
|
||||||
urls.large_image = pathToUrl(outfit.image_versions.large);
|
urls.large_image = absoluteUrl(outfit.image_versions.large);
|
||||||
formatUrls();
|
formatUrls();
|
||||||
WRAPPER.removeClass('thumbnail-available');
|
WRAPPER.removeClass('thumbnail-available');
|
||||||
subscribeToImageIfVisible(current_shared_outfit);
|
subscribeToImageIfVisible(current_shared_outfit);
|
||||||
|
|
Loading…
Reference in a new issue