Skip to content
Snippets Groups Projects
Commit da80f969 authored by pabois's avatar pabois
Browse files

Merge branch 'master' of github.com:noesya/osuny

parents 6f74bdff 94718505
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,6 @@ class MediaController < ApplicationController
blob_or_variant_url = transformations.empty? ? url_for(@blob)
: url_for(@blob.variant(transformations))
render json: { transformations: transformations, url: blob_or_variant_url }
redirect_to blob_or_variant_url
end
end
<%
width, height = @blob.metadata.values_at('width', 'height')
ratio = width.present? && height.present? ? (width.to_f / height.to_f) : nil
university = University.find_by(id: @blob.university_id)
base_url = university&.url || ""
media_endpoint_path = medium_path(signed_id: @blob.signed_id, filename_with_transformations: @blob.filename)
%>
<%# TODO: Replace @blob.url with the media endpoint when it's ready %>
<%= raw({
......@@ -9,5 +12,5 @@ ratio = width.present? && height.present? ? (width.to_f / height.to_f) : nil
"width" => width,
"height" => height,
"ratio" => ratio,
"url" => @blob.url
"url" => "#{base_url}#{media_endpoint_path}"
}.compact.to_yaml) %>
......@@ -6,12 +6,10 @@ class VariantServiceTest < ActiveSupport::TestCase
include ActiveRecord::TestFixtures
setup do
ActiveStorage::Current.host = "https://example.com"
@was_tracking, ActiveStorage.track_variants = ActiveStorage.track_variants, false
end
teardown do
ActiveStorage::Current.reset
ActiveStorage.track_variants = @was_tracking
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment