rrs: Maintainers page fix maintainer count

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
Aníbal Limón 2015-02-06 17:52:10 -06:00 committed by Paul Eggleton
parent 831464466c
commit 9a869735db
2 changed files with 36 additions and 6 deletions

View File

@ -21,7 +21,7 @@
<div class="navbar-inner table-controls">
<ul class="nav">
<li class="dropdown">
<span class="badge" style="margin-top:11px;">{{ maintainer_count }} maintainers</span>
<span class="badge" style="margin-top:11px;"></span>
</li>
</ul>
<form class="navbar-form pull-right">
@ -30,9 +30,9 @@
</div>
</div>
{% if maintainer_count == 0 %}
<div class="alert"> No maintainers found</div>
{% else %}
<div id="no_maintainers_alert" class="alert">
No maintainers found <a href="#" id="view-all-maintainers" style="margin-left:10px;">View all maintainers</a>
</div>
<table class="table table-bordered table-hovere" id="statistics-table">
<thead>
<tr>
@ -100,7 +100,6 @@
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}
{% block scripts %}
@ -111,6 +110,27 @@
$(document).ready(function() {
statisticsTable = $('#statistics-table');
function updateMaintainerCount() {
$('#statistics-table').show()
$('#no_maintainers_alert').hide()
count = 0
$('tr:visible').each(function() {
count++
});
if (count == 1) {
$('#statistics-table').hide()
$('#no_maintainers_alert').show()
}
if (count == 2) {
$('.badge').html("1 maintainer");
} else {
$('.badge').html((count - 1) + " maintainers")
}
}
$(statisticsTable).tablesorter({
sortList: [[0,0]],
headers: {
@ -133,7 +153,16 @@ $(document).ready(function() {
$("#filter").keyup(function() {
$.uiTableFilter(statisticsTable, this.value);
updateMaintainerCount()
});
$("#view-all-maintainers").click(function() {
$.uiTableFilter(statisticsTable, '');
$("#filter").val('')
updateMaintainerCount()
});
updateMaintainerCount()
});
</script>
{% endif %}

View File

@ -246,8 +246,9 @@ $(document).ready(function() {
upstreamStatus = 'All'
maintainer = 'All'
applyFilters()
$("#filter").val('')
updateRecipeCount()
})
});
applyFilters()
updateRecipeCount()