Class: Www::VideoPresenter
Instance Attribute Summary
#current_account, #options, #url_helper
Instance Method Summary
collapse
#build_transcript_schema, #cf_poster_url, #cloudflare_embed_url, #cloudflare_mp4_url, #cloudflare_video_url, #created_at, #format_duration, #format_duration_for_display, #format_paragraphs_as_text, #format_sentences_as_text, #format_structured_paragraphs_as_text, #format_timestamp, #has_assemblyai_transcript_id?, #has_audio_extraction?, #has_cloudflare_captions?, #has_html_transcript?, #has_structured_transcript_json?, #schema_dot_org_structure, #title, #transcript_display, #transcript_duration, #transcript_language, #video_medias_url
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Constructor Details
#initialize(model, view = nil, options = nil) ⇒ VideoPresenter
Returns a new instance of VideoPresenter.
4
5
6
7
|
# File 'app/presenters/www/video_presenter.rb', line 4
def initialize(model, view = nil, options = nil)
@url_helper = Www::Router.new
super
end
|
Instance Method Details
#breadcrumb_links_array(_params) ⇒ Object
13
14
15
16
17
18
|
# File 'app/presenters/www/video_presenter.rb', line 13
def breadcrumb_links_array(_params)
b_arr = [{ name: 'Video Library', url: h.cms_link('/video-media') }]
b_arr += h.catalog_breadcrumb_links(primary_product_line) if primary_product_line
b_arr << { name: video.title }
b_arr
end
|
#cloudflare_stream_url ⇒ Object
42
43
44
|
# File 'app/presenters/www/video_presenter.rb', line 42
def cloudflare_stream_url
cloudflare_video_url
end
|
#expanded_description ⇒ Object
21
22
23
|
# File 'app/presenters/www/video_presenter.rb', line 21
def expanded_description
h.localize_content video.expanded_description
end
|
#id_iri ⇒ Object
Provide a stable @id IRI for the VideoObject so WebPage mainEntity can reference it
64
65
66
|
# File 'app/presenters/www/video_presenter.rb', line 64
def id_iri
path
end
|
#page_description ⇒ Object
38
39
40
|
# File 'app/presenters/www/video_presenter.rb', line 38
def page_description
h.localize_content(super)
end
|
#page_title ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'app/presenters/www/video_presenter.rb', line 46
def page_title
t = String.new('')
t << (video.meta_title.presence || video.title.presence)
t << " | #{h.company_locale}" unless t.include?(h.company_locale)
t.prepend('Video: ') unless t.start_with?('Video:')
t
end
|
#path ⇒ Object
59
60
61
|
# File 'app/presenters/www/video_presenter.rb', line 59
def path
h.cms_link("/video-media/#{slug}")
end
|
#primary_product_line ⇒ Object
9
10
11
|
# File 'app/presenters/www/video_presenter.rb', line 9
def primary_product_line
video.product_lines.first
end
|
#render_transcript ⇒ Object
Transcript rendering methods for public pages
69
70
71
72
73
74
75
76
77
78
|
# File 'app/presenters/www/video_presenter.rb', line 69
def render_transcript
return '' unless video.transcript.present?
h.content_tag(:div, class: 'transcript') do
h.safe_join([
,
render_transcript_content
])
end
end
|
29
30
31
|
# File 'app/presenters/www/video_presenter.rb', line 29
def
h.localize_content video.
end
|
#text_description ⇒ Object
33
34
35
36
|
# File 'app/presenters/www/video_presenter.rb', line 33
def text_description
d = video.meta_description.presence || (Nokogiri::HTML(video.expanded_description).text if video.expanded_description.present?) || video..presence || video.meta_title.presence || video.title.presence
h.localize_content(d.squeeze(' ').strip)
end
|
#to_json_ld ⇒ Object
55
56
57
|
# File 'app/presenters/www/video_presenter.rb', line 55
def to_json_ld
schema_dot_org_structure.to_s
end
|
#transcript ⇒ Object
25
26
27
|
# File 'app/presenters/www/video_presenter.rb', line 25
def transcript
h.localize_content video.transcript
end
|