sergio-fry/youtube-fetcher

View on GitHub
app/views/videos/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :meta_title, @video.title %>

<% content_for :meta_description do %>
  <%= render partial: 'shared/meta_description', locals: { title: strip_tags(@video.title), image: @video.preview_image_url, text: '', url: video_url(@video.origin_id, utm_medium: :social, utm_source: :share, utm_campaign: @video.origin_id) } %>
<% end %>

<div class="m-4"></div>

<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><%= link_to "#{@video.channel.title} #{t(:podcast)}", channel_path(@video.channel.origin_id) %></li>
    <li class="breadcrumb-item active"><%= @video.title %></li>
  </ol>
</nav>

<h1><%= @video.title %></h1>

<% image_tag @video.preview_image_url %>

<div class="embed-responsive embed-responsive-16by9">
  <iframe width="560" height="315" src="https://www.youtube.com/embed/<%= @video.origin_id %>" frameborder="0" allowfullscreen></iframe>
</div>

<%= simple_format @video.description  %>

<% if @video.has_media? %>
  <br />
  <br />
  <div>
    <%= t :download %>:
    &nbsp;
    &nbsp;

    <% if @video.has_audio? %>
      <%= link_to "mp3 #{t(:audio)}", @video.audio_url %>
      (<%= number_to_human_size(@video.audio_size) %>)
      &nbsp;
      &nbsp;
      &nbsp;
    <% end %>

    <% if Flipper.enabled? :video %>
      <% if @video.has_video? %>
        <%= link_to "mp4 #{t(:video)}", url_for(id: @video.origin_id, format: :mp4) %>
        (<%= number_to_human_size(@video.video_size) %>)
      <% end %>
    <% end %>
  </div>
<% end %>