From 9a869735db922617d1b9b606df9bd0d33c9587e7 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Fri, 6 Feb 2015 17:52:10 -0600 Subject: rrs: Maintainers page fix maintainer count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aníbal Limón --- templates/rrs/maintainers.html | 39 ++++++++++++++++++++++++++++++++++----- templates/rrs/recipes.html | 3 ++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/templates/rrs/maintainers.html b/templates/rrs/maintainers.html index acc7c4c201..4dca3eeea5 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 cdb9c52767..6c86a55641 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() -- cgit 1.2.3-korg