Added report templates

pull/1040/head
Brian Daniels 2015-04-13 17:04:57 -05:00
parent 8576f74b3c
commit 4b0926fcdb
2 changed files with 76 additions and 15 deletions

View File

@ -1,19 +1,26 @@
<div> <div class="toggleshow{% if report.failing|length == 0 %} toggleshow-hide{% endif %}">
<h3> <h3>
{% if report.failing|length > 0 %} <a href="#" class="toggleshow-title">
<span class="redbold">[FAIL]</span> <span class="toggleshow-arrow"></span>
{% else %} {% if report.failing|length > 0 %}
<span class="greenbold">[OK]</span> <span class="redbold">[FAIL]</span>
{% endif %} {% else %}
<span class="greenbold">[OK]</span>
{% endif %}
{{report.target}} - Passing: {{report.passing|length}}, Failing: {{report.failing|length}}</h3> {{report.target}} - Passing: {{report.passing|length}}, Failing: {{report.failing|length}}
<h4>Failing</h4> </a>
{% with build = report.failing %} </h3>
{% include 'build_report_table.html' %}
{% endwith %}
<h4>Passing</h4> <div class="toggleshow-body">
{% with build = report.passing %} <h4 class="redbold">Failing</h4>
{% include 'build_report_table.html' %} {% with build = report.failing %}
{% endwith %} {% include 'build_report_table.html' %}
{% endwith %}
<h4 class="greenbold">Passing</h4>
{% with build = report.passing %}
{% include 'build_report_table.html' %}
{% endwith %}
</div>
</div> </div>

View File

@ -7,3 +7,57 @@
{% for report in passing_builds %} {% for report in passing_builds %}
{% include 'build_report.html' %} {% include 'build_report.html' %}
{% endfor %} {% endfor %}
<script>
var elements = document.querySelectorAll(".toggleshow"),
hideClass = 'toggleshow-hide';
for (var i = 0; i < elements.length; i++) {
var arrow = elements[i].querySelector(".toggleshow-arrow");
// Initial hide/show based on class
// Update arrow as well
if (containsClass(elements[i], 'toggleshow-hide')) {
toggleDisplay(elements[i]);
changeArrow(arrow, false);
} else {
changeArrow(arrow, true);
}
// Add click handler
addClick(elements[i], toggleDisplay);
}
function containsClass(element, className) {
var eleClassName = ' ' + elements[i].className + ' ';
return eleClassName.indexOf(' ' + className + ' ') > -1;
}
function toggleDisplay(parentElement) {
var body = parentElement.querySelector(".toggleshow-body"),
arrow = parentElement.querySelector(".toggleshow-arrow");
if (body.style.display == 'block' || body.style.display == '') {
body.style.display = 'none';
changeArrow(arrow, false);
} else {
body.style.display = 'block';
changeArrow(arrow, true);
}
}
function changeArrow(element, visible) {
if (visible) {
element.innerHTML = '&#9650';
} else {
element.innerHTML = '&#9660';
}
}
function addClick(parentElement, func) {
parentElement.querySelector(".toggleshow-title").addEventListener("click", function(e) {
func(parentElement);
e.preventDefault();
return false;
});
}
</script>