<%= provide(:title, @build.name) %>

<!-- JS related to ajax polling for builds-->
<%= javascript_include_tag params[:controller] %>
<%= javascript_tag do %>
  window.recordID   = "<%=j @build.id.to_s %>";
  window.buildID    =  "<%=j @build.build_id.to_s %>";
  window.pending    =  <%= @build.pending %>;
<% end %>

<%= link_to 'Back to Index', smoca_build_index_path %>

<div id="build">

  <div id="build-header" class="row">
    <h1><span id="build-name"><%= @build.name %></span></h1>
  </div>

  <div class="content" class="row">
    <div id="test_case_container" class="col-md-8">
      <h2>Test Cases</h2>
      <hr>
      <% if @build.test_case_results.any? %>
        <%= render 'test_case_container', build: @build %>
      <% else %>
        No Test Cases Recorded.
        <%= ' Try back soon.' if @build.pending %>
      <% end %>
    </div>

    <div id="build_content_container" class="col-md-4" style="padding-left:20px; border-left: 1px solid #ccc;">
      <h2>Build Details</h2>
      <hr>
      <div id="build-content">
        <p>
          <ui>
            <% unless @build.jenkins_log_url.nil? %>
              <li>
                <!--Display Jenkins Log if it's available -->
                <%= link_to('Jenkins Log', @build.jenkins_log_url, :target => '_blank') %>
              </li>
            <% end %>

            <li>
              <text>Initiated At:</text>
              <text id="build-time"><%= "#{@build.initiated_at.to_s}" %></text>
            </li>

            <li>
              <text>Developer:</text>
              <text><%= @build.developer %></text>
            </li>

            <li>
              <text>Environment:</text>
              <text><%= @build.environment %></text>
            </li>

            <li>
              <text>Result:</text>
              <text class="text-uppercase"><%= @build.display_result %></text>
            </li>
          </ui>
        </p>
      </div>
    </div>
  </div>
  </div>
