Class: OutlineVideoPresenter
- Inherits:
-
ExplicitDelegator
show all
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- app/presenters/outline_video_presenter.rb
Instance Method Summary
collapse
enforce_definitions, #enforced_methods, #ensure_defined, #initialize
Instance Method Details
#css_class ⇒ Object
9
10
11
12
13
14
15
|
# File 'app/presenters/outline_video_presenter.rb', line 9
def css_class
css_classes = []
css_classes << "disabled" if !video.enabled
css_classes << "completed" if video.completed
css_classes.join(" ")
end
|
#duration ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/presenters/outline_video_presenter.rb', line 21
def duration
minutes = (video.duration.to_f / 1000.0 / 60.0).floor
remainder = (video.duration - (minutes * 60 * 1000))
seconds = (remainder.to_f / 1000.0).floor
if seconds <= 9
seconds = "0#{seconds}"
end
"#{minutes}:#{seconds}"
end
|
#linkable? ⇒ Boolean
55
56
57
|
# File 'app/presenters/outline_video_presenter.rb', line 55
def linkable?
video.completed || video.enabled
end
|
#playback_class ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'app/presenters/outline_video_presenter.rb', line 41
def playback_class
if video.completed
"icon-ok"
elsif video.enabled
"icon-play"
else
"icon-lock"
end
end
|
#playback_icon ⇒ Object
51
52
53
|
# File 'app/presenters/outline_video_presenter.rb', line 51
def playback_icon
content_tag(:i, nil, class: playback_class)
end
|
#render_description {|video.description| ... } ⇒ Object
59
60
61
|
# File 'app/presenters/outline_video_presenter.rb', line 59
def render_description
yield(video.description) unless video.description.nil?
end
|
#render_now_playing ⇒ Object
63
64
65
|
# File 'app/presenters/outline_video_presenter.rb', line 63
def render_now_playing
yield if video.now_playing?
end
|
#slug ⇒ Object
17
18
19
|
# File 'app/presenters/outline_video_presenter.rb', line 17
def slug
"video_#{video.id}"
end
|
#url ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/presenters/outline_video_presenter.rb', line 33
def url
if video.enabled
video.url
else
"#"
end
end
|