Module: Www::VideosHelper

Defined in:
app/helpers/www/videos_helper.rb

Overview

View helper: videos.

Instance Method Summary collapse

Instance Method Details

#cf_thumbnail_url(cloudflare_uid) ⇒ Object



4
5
6
# File 'app/helpers/www/videos_helper.rb', line 4

def cf_thumbnail_url(cloudflare_uid)
  "#{CF_STREAM_URL}/#{cloudflare_uid}/thumbnails/thumbnail.jpg"
end

#video_by_slug(slug) ⇒ Object

Simple helper for single video lookup by slug - returns presenter object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/www/videos_helper.rb', line 9

def video_by_slug(slug)
  video = Video.friendly.find(slug)
  if video
    present(video, Www::VideoPresenter)
  else
    ErrorReporting.error('Video not found', slug: slug) if Rails.env.production?
    nil
  end
rescue ActiveRecord::RecordNotFound
  ErrorReporting.error('Video not found', slug: slug) if Rails.env.production?
  nil
end