summaryrefslogtreecommitdiffstats
path: root/src/main/java/com
diff options
context:
space:
mode:
authorTom <tw201207@gmail.com>2016-10-31 07:50:26 +0100
committerTom <tw201207@gmail.com>2016-10-31 07:50:26 +0100
commitd4a1aae48f097d48e9fded67445ba20720c1d966 (patch)
treea685d1c2d0847a9675f41be79c26f75c032f55a6 /src/main/java/com
parent35f149120cc1ab874f7fa8c1a299006a90759da9 (diff)
downloadgitblit-d4a1aae48f097d48e9fded67445ba20720c1d966.tar.gz
gitblit-d4a1aae48f097d48e9fded67445ba20720c1d966.zip
Fix disabled links in PagerPanel
Disabled links in the PagerPanel (used on the LuceneSearchPage to page through search results) were only rendered as "disabled". The links themselves remained active, which gives strange effects when clicked. For instance it was possible to move to result pages -1, -2, and so on. Really disable the links. Add missing CSS rules to have correct styling as Wicket renders disabled links as spans, not anchors. Include the new CSS file in BasePage.html. And add the left/right arrows only if not on the first/last page.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BasePage.html1
-rw-r--r--src/main/java/com/gitblit/wicket/panels/PagerPanel.java5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.html b/src/main/java/com/gitblit/wicket/pages/BasePage.html
index b998428c..4dbc2e57 100644
--- a/src/main/java/com/gitblit/wicket/pages/BasePage.html
+++ b/src/main/java/com/gitblit/wicket/pages/BasePage.html
@@ -17,6 +17,7 @@
<link rel="stylesheet" href="fontawesome/css/font-awesome.min.css"/>
<link rel="stylesheet" href="octicons/octicons.css"/>
<link rel="stylesheet" type="text/css" href="gitblit.css"/>
+ <link rel="stylesheet" type="text/css" href="bootstrap-fixes.css"/>
</wicket:head>
<body>
diff --git a/src/main/java/com/gitblit/wicket/panels/PagerPanel.java b/src/main/java/com/gitblit/wicket/panels/PagerPanel.java
index 2d774c41..d1214cae 100644
--- a/src/main/java/com/gitblit/wicket/panels/PagerPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/PagerPanel.java
@@ -48,7 +48,7 @@ public class PagerPanel extends Panel {
deltas = new int[] { -2, -1, 0, 1, 2 };
}
- if (totalPages > 0) {
+ if (totalPages > 0 && currentPage > 1) {
pages.add(new PageObject("\u2190", currentPage - 1));
}
for (int delta : deltas) {
@@ -57,7 +57,7 @@ public class PagerPanel extends Panel {
pages.add(new PageObject("" + page, page));
}
}
- if (totalPages > 0) {
+ if (totalPages > 0 && currentPage < totalPages) {
pages.add(new PageObject("\u2192", currentPage + 1));
}
@@ -75,6 +75,7 @@ public class PagerPanel extends Panel {
item.add(link);
if (pageItem.page == currentPage || pageItem.page < 1 || pageItem.page > totalPages) {
WicketUtils.setCssClass(item, "disabled");
+ link.setEnabled(false);
}
}
};