]> source.dussan.org Git - gitblit.git/commitdiff
Only show pager if the total search hits exceed the page size
authorJames Moger <james.moger@gitblit.com>
Wed, 21 Mar 2012 22:05:50 +0000 (18:05 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 21 Mar 2012 22:05:50 +0000 (18:05 -0400)
src/com/gitblit/wicket/pages/LuceneSearchPage.java

index e43935e3aff5dab5a1df1ae67a5ae851ebf6df32..c9e70661e3b5c65031d309334f02e6973d99c906 100644 (file)
@@ -239,12 +239,14 @@ public class LuceneSearchPage extends RootPage {
                pagerParams.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
                pagerParams.put("query", queryModel.getObject());\r
                \r
+               boolean showPager = false;\r
                int totalPages = 0;\r
                if (results.size() > 0) {\r
                        totalPages = (results.get(0).totalHits / pageSize) + (results.get(0).totalHits % pageSize > 0 ? 1 : 0);\r
+                       showPager = results.get(0).totalHits > pageSize;\r
                }\r
                \r
-               add(new PagerPanel("topPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
-               add(new PagerPanel("bottomPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
+               add(new PagerPanel("topPager", page, totalPages, LuceneSearchPage.class, pagerParams).setVisible(showPager));\r
+               add(new PagerPanel("bottomPager", page, totalPages, LuceneSearchPage.class, pagerParams).setVisible(showPager));\r
        }\r
 }\r