]> source.dussan.org Git - gitblit.git/commitdiff
Indicate default days back filter selection
authorJames Moger <james.moger@gitblit.com>
Wed, 19 Jun 2013 01:55:25 +0000 (21:55 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 19 Jun 2013 01:55:25 +0000 (21:55 -0400)
src/main/java/com/gitblit/wicket/pages/RootPage.java

index e8d100744093dc5f844c2f445bee776ba583674c..d21be36640e02c73ff24c7838d9ad7e10cdfe572 100644 (file)
@@ -300,6 +300,17 @@ public abstract class RootPage extends BasePage {
                if (daysBack < 1) {\r
                        daysBack = 7;\r
                }\r
+               PageParameters clonedParams;;\r
+               if (params == null) {\r
+                       clonedParams = new PageParameters();\r
+               } else {\r
+                       clonedParams = new PageParameters(params);\r
+               }\r
+               \r
+               if (!clonedParams.containsKey("db")) {\r
+                       clonedParams.put("db",  daysBack);\r
+               }\r
+               \r
                List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();\r
                Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));\r
                if (choicesSet.isEmpty()) {\r
@@ -310,7 +321,7 @@ public abstract class RootPage extends BasePage {
                String lastDaysPattern = getString("gb.lastNDays");\r
                for (Integer db : choices) {\r
                        String txt = MessageFormat.format(lastDaysPattern, db);\r
-                       items.add(new DropDownMenuItem(txt, "db", db.toString(), params));\r
+                       items.add(new DropDownMenuItem(txt, "db", db.toString(), clonedParams));\r
                }\r
                items.add(new DropDownMenuItem());\r
                return items;\r