Created
April 15, 2015 17:12
-
-
Save sdilshod/32a62258c7ed0ce42c61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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 |
This file contains hidden or 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
.media | |
= media_video_link_content(guide) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment