sergio-fry/youtube-fetcher

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

Summary

Maintainability
Test Coverage
<% content_for :meta_title, "#{@podcast.title} Podcast feed" %>

<h1><%= @podcast.title %> <%= t :podcast %>
  <i class="fa fa-podcast" aria-hidden="true"></i>
</h1>

<% if @podcast.source_type == 'playlist' %>
  <%= render partial: 'podcast_link', locals: { audio_feed_url: playlist_url(@podcast.origin_id, format: :atom), video_feed_url: playlist_url(@podcast.origin_id, type: :video, format: :atom) } %>
<% else %>
  <%= render partial: 'podcast_link', locals: { audio_feed_url: channel_url(@podcast.origin_id, format: :atom), video_feed_url: channel_url(@podcast.origin_id, type: :video, format: :atom) } %>
<% end %>

<br />
<br />

<table class='episodes table'>
  <tr>
    <th><%= t :title %></th>
    <th><%= t :published_at %></th>
    <th><i class="fa fa-headphones"></i></th>
    <% if Flipper.enabled? :video %>
      <th><i class="fa fa-video-camera"></i></th>
    <% end %>
  </tr>
  <% (new_videos + @videos).compact.sort_by(&:published_at).reverse.each do |episode| %>
    <tr class='episode' id='episode-<%= episode.id %>'>
      <td><%= link_to episode.title, video_path(episode.origin_id) %></td>
      <td><%= episode.published_at %></td>

      <td class='episode__media'>
        <% if episode.has_audio? %>
          <%= link_to number_to_human_size(episode.audio_size), episode.audio_url %>
        <% else %>
          <i class="fa fa-refresh fa-spin" aria-hidden="true"></i>
        <% end %>
      </td>
      <% if Flipper.enabled? :video %>
        <td class='episode__media'>
          <% if episode.has_video? %>
            <%= link_to number_to_human_size(episode.video_size), video_path(episode.origin_id, format: :mp4) %>
          <% else %>
            <% if @podcast.video_required? %>
              <i class="fa fa-refresh fa-spin" aria-hidden="true"></i>
            <% else %>
              <i class="fa fa-times-circle" aria-hidden="true" title="<%= t :video_has_not_been_requested %>"></i>
            <% end %>
          <% end %>
        </td>
      <% end %>
    </tr>
  <% end %>
</table>