module VideosHelper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
extend self
def video_embed_macro_markup(video)
"{{video(#{video.permalink})}}"
end
def gravatar_enabled?
Setting['gravatar_enabled'] == '1'
end
def video_embed_code(video, size = :standard)
width = size == :large ? 640 : 560
height = size == :large ? 390 : 349
"\n" + \
"\n"
end
def link_to_video_macro_markup(video)
"{{video_link(#{video.permalink})}}"
end
def link_to_video(video)
return "[Video not provided]" unless video.instance_of?(Video)
"#{video.title}"
end
def video_thumbnail_list(videos)
"
\n" + \
videos.map do |video|
"- \n" + \
" \n" + \
" #{video.length}\n" + \
" \n" + \
"
#{link_to(truncate(video.title, :length => 21), prjct_video_path(video.project, video), :title => video.title)}
\n" + \
"\n" + \
" - by:
\n" \
" - #{link_to(truncate(video.user.name, :length => 17), usr_path(video.user))}
\n" + \
"
\n" + \
" \n"
end.join("\n") + \
"
"
end
private
def swf_object_file_url
"/plugin_assets/chili_videos/swfobject.js"
end
def swf_player_file_url
"/plugin_assets/chili_videos/player.swf"
end
def prjct_video_path(project, video)
"/projects/#{project.to_param}/videos/#{video.to_param}"
end
def usr_path(user)
"/users/#{user.to_param}"
end
end