Created
July 12, 2012 15:11
-
-
Save arturmalecki/3098737 to your computer and use it in GitHub Desktop.
dam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dam_image_tag asset, options = {} | |
width = options[:width] || 300 | |
height = options[:height] || nil | |
image_tag dam_state_typical_url(asset), :width => width, :height => height | |
end | |
def dam_state_typical_url model, options = {} | |
use_region_fallback = model.is_a?(TravelReport) && model.region_code | |
case model.state_name | |
when :new, :waiting | |
if use_region_fallback | |
dam_typical_url :regions, model.region_code, options | |
else | |
dam_image_url 'weblounge-typical-transcoding', options | |
end | |
when :ready | |
dam_image_url model.dam_id, options | |
when :failed | |
dam_image_url 'weblounge-typical-error', options | |
else | |
if use_region_fallback | |
dam_typical_url :regions, model.region_code, options | |
else | |
dam_image_url 'weblounge-typical', options | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment