Skip to content

Instantly share code, notes, and snippets.

@arturmalecki
Created July 12, 2012 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturmalecki/3098737 to your computer and use it in GitHub Desktop.
Save arturmalecki/3098737 to your computer and use it in GitHub Desktop.
dam
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