Noosfero/noosfero

View on GitHub
plugins/html5_video/views/content_viewer/video_channel.html.erb

Summary

Maintainability
Test Coverage
<% extend Html5VideoPlugin::PoolHelper %>

<div>
  <%= @page.body %>
</div>

<div class="video-channel">
  <% if @page.videos.empty? %>
    <p><em><%= _('This channel contains no videos yet') %></em></p>
  <% else %>
    <div class="video-player">
      <h2></h2>
      <%= render :partial => 'video_player', :locals => {:video => nil} %>
      <div class="video-player-info">
        <div class="quality">
          <strong><%=_('Quality options')%>:</strong>
          <ul></ul>
        </div>
        <div class="tags">
          <strong><%=_('Tags')%>:</strong>
          <div class="data"></div>
        </div>
        <div class="abstract">
          <strong><%=_('Description')%>:</strong>
          <div class="data"></div>
        </div>
      </div>
      <br style="clear: both"/>
    </div>

    <ul class="video-list">
      <% @page.converted_videos.each do |f| %>
        <li class="video-list-item" title="<%=html_escape f.title%>">
          <%= link_to(
                content_tag('strong',
                  f.title.
                    gsub(/([a-z0-9])_+([a-z0-9])/i, '\1 \2').
                    gsub(/\.[a-z0-9]{2,4}$/i, '')
                ),
                f.view_url,
                {
                  'data-poster'      => f.image_preview(:big),
                  'data-download'    => f.public_filename,
                  'data-webversions' => CGI::escapeHTML(f.web_versions!.to_json).html_safe,
                  :style => "background-image:url(#{f.image_preview(:big)})"
                }) %>
          <ul>
            <li class="vli-data-tags">
              <strong>tags:</strong>
              <div><%= linked_article_tags f %></div>
            </li>
          </ul>
          <div class="abstract"><%= f.abstract %></div>
        </li>
      <% end %>
    </ul>
  <% end %>

  <% if @page.unconverted_videos.present? %>
    <div class="unconverted-videos">
      <div>
        <span><%= n_(
            'This channel has one video waiting to be converted',
            'This channel has %d videos waiting to be converted',
            @page.unconverted_videos.length
          ) % @page.unconverted_videos.length
        %></span>
        <span class='fa fa-plus-circle'></span>
      </div>
      <ul>
        <% @page.unconverted_videos.each do |f| %>
          <li>
            <%= link_to f.title, f.view_url %>
            <span>
              <% if position_for(f).present? %>
                <%= _("%sÂș video in the queue") % position_for(f) %>
              <% elsif is_ongoing?(f) %>
                <%= _('This video is being processed, it might take a while') %>
              <% elsif f.enqueuing_jobs.present? %>
                <%= _("This video will be enqueued soon") %>
              <% else %>
                <%= _("Conversion couldn't be completed") %>
              <% end %>
            </span>
          </li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <% if @page.non_video_files.present? %>
    <div class="non-video-list">
      <h3><%=_('Non video files')%></h3>
      <%= list_contents contents: @page.non_video_files %>
    </div>
  <% end %>

</div>

<script type="text/javascript">
  new VideoChannel( jQuery(".video-channel").last() );
</script>