diff --git a/templates/rrs/maintainers.html b/templates/rrs/maintainers.html index acc7c4c..4dca3ee 100644 --- a/templates/rrs/maintainers.html +++ b/templates/rrs/maintainers.html @@ -21,7 +21,7 @@ -{% if maintainer_count == 0 %} -
No maintainers found
-{% else %} +
+ No maintainers found View all maintainers +
@@ -100,7 +100,6 @@ {% endfor %}
-{% 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() }); {% endif %} diff --git a/templates/rrs/recipes.html b/templates/rrs/recipes.html index cdb9c52..6c86a55 100644 --- a/templates/rrs/recipes.html +++ b/templates/rrs/recipes.html @@ -246,8 +246,9 @@ $(document).ready(function() { upstreamStatus = 'All' maintainer = 'All' applyFilters() + $("#filter").val('') updateRecipeCount() - }) + }); applyFilters() updateRecipeCount()