<commit_before><div class="row">
  <div class="span3 hidden-phone" id="left_column">
    <% if can? :edit, @mediaobject %>
      <%= render "media_objects/toggle_edit_mode" %>
      <%= render "media_objects/withdraw_object", mediaobject: @mediaobject %>
    <% else %>&nbsp;    
    <% end %>
  </div>

  <% if can? :manage, @mediaobject %>
    <% if @mediaobject.is_published? %>
      <%= link_to 'Unpublish', update_status_media_object_path(@mediaobject, a: 'unpublish'), class: 'btn pull-right' %>
    <% else %>
      <%= link_to 'Publish', update_status_media_object_path(@mediaobject, a: 'publish'), class: 'btn pull-right' %>
    <% end %>
  <% end %>

  <div id="main_content_container" class="offset1 span8">
    <div class="row-fluid whitespace">
      <div>
        <% unless @mediaobject.title.blank? %>
      <h2>
        <%= @mediaobject.title %>
      <% else %>
        <%= @mediaobject.pid %>
      <% end %>
      </h2>
        <% if not @currentStream.blank? and 
          @masterFiles.length >= 2 %>
         <h3 id="stream_label"><%= @currentStream.label %></h3>
        <% end %>
     </div>
    </div>
    
    <div class="row-fluid whitespace">
      <section id="player">        
        <% if @masterFiles.blank? %>
          <div class="alert">
            <p>No media is associated with this item</p>
          </div>
        <% else if @currentStream.derivatives.blank? %>
          <div class="alert <%= @currentStream.status_code == 'FAILED' ? 'alert-error' : 'alert-info' %> span10">
            <h4>Conversion Process</h4>
            <br/>
            <p><%= @currentStream.status_description %></p>
            <div class="progress progress-striped active hidden-phone">
              <div class="bar" style="width: <%= @currentStream.percent_complete %>%;"></div>
            </div>
          </div>
        <% else %>
          <div id="nojs">
            <%# TODO : Come up with a more user friendly error message %>
            <noscript>You don't have Javascript</noscript>
          </div>
        <%# End of the block if media does exist %>
        <% end %>
        <% end %>
      </section>  
    </div>

    <div class="row-fluid whitespace">
      <% unless @masterFiles.empty? %>
      <section>
        <h3>Sections</h3>
          <ul class="unstyled" id="section_links">
            <% @masterFiles.each do |master| %>
              <li>
                <%# If the label has not been set use the file name as a default %>
                <%=
                  link_to stream_label_for(master),
                    media_object_path(@mediaobject, {content: master.pid}),
                    data: {segment: master.pid},
                    class: (master.pid == @currentStream.pid ? 'current-stream' : nil)
                %>
                (<%= number_to_human_size(master.file_size) %>)
              </li>
              <% end %>
          </ul>
       </section>
     <% end %>
    </div>
    
    <div class="row-fluid whitespace">
      <h3>Resource description</h3>
      <section id="metadata"><%= render "modules/metadata_display" %></section>
    </div>
        
    <div class="row-fluid">
      <div class="span8">
        <div id="permalink" class="alert alert-success">
        <h4 class="alert-heading">Permalink</h4>
        <p>To share this item with others use the following canonical link</p>
        <address><%= link_to media_object_url(@mediaobject.pid) %></address>
      </div>
    </div>
  </div>
</div>

<% content_for :title do %>
  Preview -
  <% unless @mediaobject.title.blank? %>
  <%= @mediaobject.title %> (<%= @mediaobject.pid %>)
  <% else %>
    <%= @mediaobject.pid %>
  <% end %>
<% end %>

<% content_for :page_scripts do %>
  <%# Since there are no streams if @currentStream is nil then don't bother including any of the following content %>
  <%= javascript_include_tag 'switch_streams' %>
  <%= javascript_include_tag 'swfobject' %>
  <%= javascript_include_tag 'avalonplayer' %>

  <script>
    $(function(){
      if ($("#nojs").length > 0) {
        currentPlayer = avalonPlayer("#player", 
                   { hls: <%= @currentStreamInfo[:stream_hls].to_json.html_safe %>,
                     poster: "<%= @currentStreamInfo[:poster_image] %>", 
                     mediaPackageId: "<%= @currentStreamInfo[:mediapackage_id] %>", 
                     flash: <%= @currentStreamInfo[:stream_flash].to_json.html_safe %> });
      }
    })
  </script>
<% end %>
<commit_msg>Revamped the item view page<commit_after><div class="row">
  <div class="span6" id="left_column">
    <%# Refactor into its own partial once the layout is clear %>
       <section id="player">        
        <% if @masterFiles.blank? %>
          <div class="alert">
            <p>No media is associated with this item</p>
          </div>
        <% else if @currentStream.derivatives.blank? %>
          <div class="alert <%= @currentStream.status_code == 'FAILED' ? 'alert-error' : 'alert-info' %>">
            <h4>Conversion Process</h4>
            <br/>
            <p><%= @currentStream.status_description %></p>
            <div class="progress progress-striped active hidden-phone">
              <div class="bar" style="width: <%= @currentStream.percent_complete %>%;"></div>
            </div>
          </div>
        <% else %>
          <div id="nojs">
            <%# TODO : Come up with a more user friendly error message %>
            <noscript>You don't have Javascript</noscript>
          </div>
        <%# End of the block if media does exist %>
        <% end %>
        <% end %>
      </section>  

      <%# Partial once the layout makes sense %>
      <% unless @masterFiles.empty? and @masterfiles.length > 0 %>
      <section>
        <h3>Sections</h3>
          <ul class="unstyled" id="section_links">
            <% @masterFiles.each do |master| %>
              <li>
                <%# If the label has not been set use the file name as a default %>
                <%=
                  link_to stream_label_for(master),
                    media_object_path(@mediaobject, {content: master.pid}),
                    data: {segment: master.pid},
                    class: (master.pid == @currentStream.pid ? 'current-stream' : nil)
                %>
                ( Duration )
              </li>
              <% end %>
          </ul>
       </section>
     <% end %>
  </div>

  <div class="span6" id="right-column">
  <% if can? :manage, @mediaobject %>
    <div id="administrative_options">
    <% if @mediaobject.is_published? %>
      <%= link_to 'Unpublish', update_status_media_object_path(@mediaobject, a: 'unpublish'), class: 'btn' %>
    <% else %>
      <%= link_to 'Publish', update_status_media_object_path(@mediaobject, a: 'publish'), class: 'btn' %>
    <% end %>
  <% end %>
  </div>

  <div id="metadata_container" class="">
      <div>
        <% unless @mediaobject.title.blank? %>
      <h2>
        <%= @mediaobject.title %>
      <% else %>
        <%= @mediaobject.pid %>
      <% end %>
      </h2>
        <% if not @currentStream.blank? and 
          @masterFiles.length >= 2 %>
         <h3 id="stream_label"><%= @currentStream.label %></h3>
        <% end %>
     </div>
    </div>
    
      <section id="metadata"><%= render "modules/metadata_display" %></section>
        
    <div class="row-fluid">
        <div id="permalink" class="alert alert-success">
        <h4 class="alert-heading">Permalink</h4>
        <p>To share this item with others use the following canonical link</p>
        <address><%= link_to media_object_url(@mediaobject.pid) %></address>
      </div>
    </div>
  </div>
</div>

<% content_for :title do %>
  Preview -
  <% unless @mediaobject.title.blank? %>
  <%= @mediaobject.title %> (<%= @mediaobject.pid %>)
  <% else %>
    <%= @mediaobject.pid %>
  <% end %>
<% end %>

<% content_for :page_scripts do %>
  <%# Since there are no streams if @currentStream is nil then don't bother including any of the following content %>
  <%= javascript_include_tag 'switch_streams' %>
  <%= javascript_include_tag 'swfobject' %>
  <%= javascript_include_tag 'avalonplayer' %>

  <script>
    $(function(){
      if ($("#nojs").length > 0) {
        currentPlayer = avalonPlayer("#player", 
                   { hls: <%= @currentStreamInfo[:stream_hls].to_json.html_safe %>,
                     poster: "<%= @currentStreamInfo[:poster_image] %>", 
                     mediaPackageId: "<%= @currentStreamInfo[:mediapackage_id] %>", 
                     flash: <%= @currentStreamInfo[:stream_flash].to_json.html_safe %> });
      }
    })
  </script>
<% end %>

{'fraction_non_alphanumeric': 0.16465816917728854, 'fraction_numerical': 0.004055619930475087, 'mean_word_length': 2.1592240117130306, 'pattern_counts': {'":': 0, '<': 238, '<?xml version=': 0, '>': 243, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '508596', 'n_tokens_mistral': 2842, 'n_tokens_neox': 2550, 'n_words': 578}