Module: VideosHelper

Extended by:
VideosHelper
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper
Included in:
VideosHelper
Defined in:
app/helpers/videos_helper.rb

Instance Method Summary collapse

Instance Method Details

#gravatar_enabled?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/helpers/videos_helper.rb', line 11

def gravatar_enabled?
  Setting['gravatar_enabled'] == '1'
end


33
34
35
36
# File 'app/helpers/videos_helper.rb', line 33

def link_to_video(video)
  return "[Video not provided]" unless video.instance_of?(Video)
  "<a href='#{prjct_video_path(video.project, video)}' class='video-link'>#{video.title}</a>"
end


29
30
31
# File 'app/helpers/videos_helper.rb', line 29

def link_to_video_macro_markup(video)
  "{{video_link(#{video.permalink})}}"
end

#video_embed_code(video, size = :standard) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/videos_helper.rb', line 15

def video_embed_code(video, size = :standard)
  width = size == :large ? 640 : 560
  height = size == :large ? 390 : 349

  "<script type='text/javascript' src='#{swf_object_file_url}'></script>\n" + \
  "<script type='text/javascript'>\n" + \
  "  var s1 = new SWFObject('#{swf_player_file_url}', 'player', '#{width}','#{height}','9');\n" + \
  "  s1.addParam('allowfullscreen','true');\n" + \
  "  s1.addParam('allowscriptaccess','always');\n" + \
  "  s1.addParam('flashvars','file=#{video.url}');\n" + \
  "  s1.write('video_#{video.permalink}');\n" + \
  "</script>\n"
end

#video_embed_macro_markup(video) ⇒ Object



7
8
9
# File 'app/helpers/videos_helper.rb', line 7

def video_embed_macro_markup(video)
  "{{video(#{video.permalink})}}"
end

#video_thumbnail_list(videos) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/helpers/videos_helper.rb', line 38

def video_thumbnail_list(videos)
  "<ul class='videos' style='list-style-type: none; float: left; margin-right: 25px; width: 95%;'>\n" + \
    videos.map do |video|
      "<li class='video' id='#{video.to_param}' style='padding-bottom: 30px; display: inline-block;'>\n" + \
      "  <a href='#{prjct_video_path(video.project, video)}' class='video-cell small' style='float: left; margin-right: 20px; background-color:#000; text-align: right; display: block; width:128px; height:96px;'>\n" + \
      "    <span style='position:relative; top: 81px; padding-right: 3px; color: #CCC; display: block;'>#{video.length}</span>\n" + \
      "  </a>\n" + \
      "<h3 style='border-bottom: none; font-size: 12px; width: 128px; padding: 5px 0 0 0; margin: 0;'>#{link_to(truncate(video.title, :length => 21), prjct_video_path(video.project, video), :title => video.title)}</h3>\n" + \
      "<dl style='margin-top: 0;'>\n" + \
      "  <dt style='float: left; padding-right: 3px;'>by:</dt>\n" \
      "  <dd style='margin: 3px; clear: after; display: block;'>#{link_to(truncate(video.user.name, :length => 17), usr_path(video.user))}</dd>\n" + \
      "</dl>\n" + \
      "</li>\n"
    end.join("\n") + \
  "</ul><div style='clear:both;'></div>"
end