Module: Kinney::ClipHelper
- Defined in:
- app/helpers/kinney/clip_helper.rb
Instance Method Summary collapse
- #download_button(clip) ⇒ Object
-
#duration_pretty(clip) ⇒ Object
FIXME: there has to be a better way to do this so that reloading works! include ::KinneyClipHelper.
- #jump_time(timestamp) ⇒ Object
- #topic_li_class(topic) ⇒ Object
-
#vtt_button(clip) ⇒ Object
TODO: once we have VTT for everything change this and make VTT’s manditory.
Instance Method Details
#download_button(clip) ⇒ Object
11 12 13 14 15 |
# File 'app/helpers/kinney/clip_helper.rb', line 11 def (clip) link_to(clip.mp4, :class => ['btn', 'btn-lg', 'btn-default'], :id => 'download_mp4') do "<i class='icon-arrow-down'></i> #{t 'kinney.clips.show.download_mp4'}".html_safe end end |
#duration_pretty(clip) ⇒ Object
FIXME: there has to be a better way to do this so that reloading works! include ::KinneyClipHelper
6 7 8 |
# File 'app/helpers/kinney/clip_helper.rb', line 6 def duration_pretty(clip) "(#{clip.duration_pretty})" if !clip.duration.blank? end |
#jump_time(timestamp) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/kinney/clip_helper.rb', line 33 def jump_time() time_parts = .split(':') seconds = time_parts.pop minutes = time_parts.pop hours = time_parts.first if !time_parts.blank? total_seconds = hours.to_i.hours.seconds total_seconds += minutes.to_i.minutes.seconds total_seconds += seconds.split('.').first.to_i end |
#topic_li_class(topic) ⇒ Object
43 44 45 |
# File 'app/helpers/kinney/clip_helper.rb', line 43 def topic_li_class(topic) current_page?(topic_path(topic)) ? 'active' : '' end |
#vtt_button(clip) ⇒ Object
TODO: once we have VTT for everything change this and make VTT’s manditory
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/kinney/clip_helper.rb', line 18 def (clip) begin client = HTTPClient.new response = client.head(clip.vtt) = {:class => 'btn btn-lg btn-default', :id => 'download_vtt'} if response.status != 200 .merge!(:style => 'display:none') end link_to(clip.vtt, ) do "<i class='icon-arrow-down'></i> #{t :download_transcript}".html_safe end rescue end end |