{% extends "base.html" %}
{% load i18n %}

{% block js %}
  {{ block.super }}
  <script src="{{ STATIC_URL }}js/ansi_up.js"></script>
  <script src="{{ STATIC_URL }}js/colorify.js"></script>
  <script src="{{ STATIC_URL }}js/builds.js"></script>
  {% if not build.result or build.result.still_running %}
    <script>
      $(document).ready(function() {
        var intervalId = setInterval(function () {
          $.ajax('{% url 'api_partial_build_page' build.project.owner build.project.name build.build_number %}')
              .done(function (data){
                $('.content-grid').html(data);
                if (!data.match(/<strong>State:<\/strong>[ \n]+pending/)) {
                  clearInterval(intervalId);
                }
              });
        }, 2500);
      });
    </script>
  {% endif %}

  <script>
    $('.build-logs h3').on('click', function() {
      $(this).parent().find('pre').slideToggle();
    });
  </script>
{% endblock js %}

{% block content %}
  {% include "builds/partials/build_result.html" %}
{% endblock %}

{% extends "base.html" %}
{% load i18n %}

{% block js %}
  {{ block.super }}
  <script src="{{ STATIC_URL }}js/ansi_up.js"></script>
  <script src="{{ STATIC_URL }}js/colorify.js"></script>
  <script src="{{ STATIC_URL }}js/builds.js"></script>
  {% if not build.result or build.result.still_running %}
    <script>
      $(document).ready(function() {
        var intervalId = setInterval(function () {
          $.ajax('{% url 'api_partial_build_page' build.project.owner build.project.name build.build_number %}')
              .done(function (data){
                $('.content-grid').html(data);
                $('.build-logs h3').off('click').on('click', function() {
                  $(this).parent().find('pre').slideToggle();
                });
                if (!data.match(/<strong>State:<\/strong>[ \n]+pending/)) {
                  clearInterval(intervalId);
                }
              });
        }, 2500);
      });
    </script>
  {% endif %}

  <script>
    $('.build-logs h3').on('click', function() {
      $(this).parent().find('pre').slideToggle();
    });
  </script>
{% endblock js %}

{% block content %}
  {% include "builds/partials/build_result.html" %}
{% endblock %}

Fix toggling of task output after ajax call
Fix toggling of task output after ajax call
