From 5cd77a826f5a52168335e1db0926215da6e23ad0 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 28 Jun 2015 20:59:10 +0200 Subject: Show number of selected packages on search page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes FS#45379. Signed-off-by: Johannes Löthberg --- web/html/packages.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'web/html/packages.php') diff --git a/web/html/packages.php b/web/html/packages.php index bf3daf8..4b11f09 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -71,6 +71,22 @@ $(document).ready(function() { collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); collapseDependsList("#pkgsrcslist"); + + function update_checked_count() { + var one_pkg = ''; + var pkgs = ''; + + var count = $('.package-checkbox:checked').length; + if (count === 1) { + var res = one_pkg; + } else { + var res = pkgs; + } + $('#pkglist-checked-count').text(res.replace('%s', count.toString())); + } + update_checked_count(); // Set initial string + + $('.package-checkbox').change(update_checked_count); }); -- cgit v1.2.3-70-g09d2