Skip to content

Instantly share code, notes, and snippets.

@sdilshod
Created April 15, 2015 17:12
Show Gist options
  • Save sdilshod/32a62258c7ed0ce42c61 to your computer and use it in GitHub Desktop.
Save sdilshod/32a62258c7ed0ce42c61 to your computer and use it in GitHub Desktop.
def media_video_link_content( guide )
blank_link = guide.send("video_#{I18n.locale}").blank?
tag = blank_link ? 'div' : 'a'
html_option = { :class => 'video_link pull-left' }
html_option.merge!( :href => guide.video_link ) if tag == 'a'
content_tag( tag, html_option ) do
#TODO refactory with including portrait_files
if guide.portrait.includes(:portrait_files).present?
content_tag( :div, :class => 'guide_image', :style => 'position:relative' ) do
concat( cl_image_tag(asset_path("play-2.png"), style: "position:absolute;height:128px;opacity:0", class: 'overlay') ) unless blank_link
concat cl_image_tag(guide.portrait.first.path, { size: '128x128', crop: :fill, :class => 'media-object' })
end
else
content_tag( :div, :class => 'guide_image', :style => 'position:relative' ) do
concat( cl_image_tag(asset_path("play-2.png"), style: "position:absolute;height:128px;opacity:0", class: 'overlay') ) unless blank_link
concat cl_image_tag(asset_path("tourgudes-img1.jpg"), { size: '128x128', crop: :fill, :class => 'media-object' })
end
end
end
end
.media
= media_video_link_content(guide)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment