$("#is_parallel_build_in_progress").val("<%= (@build && @build.incomplete?).to_s  %>");
<% if @build && @build.is_parallel && @build.incomplete? %>
  $("#ui-test-results-div").html("<%= escape_javascript(partial("/builds/ui_test_results".to_sym)) %>" );

  $(".test-file-link").click(function () {
    <% if defined?(RACK_ENV) && RACK_ENV == "showcase" %>
      event.preventDefault();
      bootbox.alert("This feature 'displaying test script content' is disabled in ShowCase mode");

    <% elsif (@project.config.show_test_scripts_to_public || (@user && @user.is_member?(@project))  ) %>

      var item_id = $(this).attr('data-id');
      var item_name = $(this).attr('data-name');
      if (item_id == "") {
          var scriptUrl = "/builds/<%= @build.id%>/test_files/" + item_name;
      } else {
          var scriptUrl = "/test_files/" + item_id;
      }

      $.get(scriptUrl, function (data) {
          $("#test_script_header").html(item_name);
          $("#test_script_content").html(data);
          $("#dialog").modal("show");
      });

    <% else %>
      event.preventDefault();
      bootbox.alert("You are not allowed to view the test script content, which is set to be accessible to project team members only.");
    <% end %>
      // });
  });
  
<% elsif @build && @build.is_parallel %>
  location.reload();  
<% end %>
  