border-color: #eee;\r
}\r
\r
+.topbar div > ul .menu-dropdown .selected, .nav .menu-dropdown .selected, .topbar div > ul .dropdown-menu .selected, .nav .dropdown-menu .selected {\r
+ background-image: url("bullet_blue.png");\r
+ background-repeat: no-repeat;\r
+ background-position: left; \r
+}\r
+\r
.topbar div > ul .menu-dropdown li a, .nav .menu-dropdown li a, .topbar div > ul .dropdown-menu li a, .nav .dropdown-menu li a {\r
color: #555;\r
text-shadow: none;\r
outline: 0;\r
}\r
\r
+.topbar ul .menu-dropdown li a, .topbar ul .dropdown-menu li a {\r
+ padding: 4px 22px; \r
+}\r
+\r
topbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.topbar div>ul .dropdown-menu li a:hover,.nav .dropdown-menu li a:hover{\r
background-color: #000070;\r
background-repeat:no-repeat;\r
\r
private static final long serialVersionUID = 1L;\r
\r
- final PageParameters params;\r
+ final PageParameters parameters;\r
final String displayText;\r
final String parameter;\r
final String value;\r
+ final boolean isSelected;\r
\r
/**\r
* Divider constructor.\r
*/\r
public DropDownMenuItem() {\r
- displayText = null;\r
- parameter = null;\r
- value = null;\r
- params = null;\r
+ this(null, null, null, null);\r
}\r
\r
/**\r
this.displayText = displayText;\r
this.parameter = parameter;\r
this.value = value;\r
+\r
if (params == null) {\r
- this.params = new PageParameters();\r
+ // no parameters specified\r
+ parameters = new PageParameters();\r
+ setParameter(parameter, value);\r
+ isSelected = false;\r
} else {\r
- this.params = new PageParameters(params);\r
+ parameters = new PageParameters(params);\r
+ if (parameters.containsKey(parameter)) {\r
+ isSelected = params.getString(parameter).equals(value);\r
+ if (isSelected) {\r
+ // already selected, so remove this enables toggling\r
+ parameters.remove(parameter);\r
+ } else {\r
+ // set the new selection value\r
+ setParameter(parameter, value);\r
+ }\r
+ } else {\r
+ // not currently selected\r
+ isSelected = false;\r
+ setParameter(parameter, value);\r
+ }\r
}\r
+ }\r
+\r
+ private void setParameter(String parameter, String value) {\r
if (!StringUtils.isEmpty(parameter)) {\r
if (StringUtils.isEmpty(value)) {\r
- this.params.remove(parameter);\r
+ this.parameters.remove(parameter);\r
} else {\r
- this.params.put(parameter, value); \r
+ this.parameters.put(parameter, value);\r
}\r
}\r
}\r
}\r
\r
public PageParameters getPageParameters() {\r
- return params;\r
+ return parameters;\r
}\r
\r
public boolean isDivider() {\r
return displayText == null && value == null && parameter == null;\r
}\r
\r
+ public boolean isSelected() {\r
+ return isSelected;\r
+ }\r
+\r
@Override\r
public int hashCode() {\r
if (isDivider()) {\r
\r
PageParameters currentParameters = getPageParameters();\r
int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);\r
- if (currentParameters.containsKey("db")) {\r
- daysBack = currentParameters.getInt("db");\r
- }\r
- if (daysBack < 1) {\r
- daysBack = 14;\r
+ if (currentParameters != null && !currentParameters.containsKey("db")) {\r
+ currentParameters.put("db", daysBack);\r
}\r
\r
// preserve time filter options on repository choices\r
- filters.menuItems.addAll(getRepositoryFilterItems(new PageParameters("db=" + daysBack)));\r
- \r
+ filters.menuItems.addAll(getRepositoryFilterItems(currentParameters));\r
+\r
// preserve repository filter options on time choices\r
filters.menuItems.addAll(getTimeFilterItems(currentParameters));\r
\r
\r
@Override\r
protected void addDropDownMenus(List<PageRegistration> pages) {\r
- int daysBack = 0;\r
PageParameters currentParameters = getPageParameters();\r
- if (currentParameters != null && currentParameters.containsKey("db")) {\r
- daysBack = currentParameters.getInt("db");\r
- }\r
- PageParameters params = null;\r
- if (daysBack > 0) {\r
- params = new PageParameters("db=" + daysBack);\r
+ int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);\r
+ if (currentParameters != null && !currentParameters.containsKey("db")) {\r
+ currentParameters.put("db", daysBack);\r
}\r
\r
DropDownMenuRegistration menu = new DropDownMenuRegistration("gb.filters",\r
RepositoriesPage.class);\r
// preserve time filter option on repository choices\r
- menu.menuItems.addAll(getRepositoryFilterItems(params));\r
+ menu.menuItems.addAll(getRepositoryFilterItems(currentParameters));\r
\r
// preserve repository filter option on time choices\r
menu.menuItems.addAll(getTimeFilterItems(currentParameters));\r
\r
private PageParameters getRootPageParameters() {\r
if (reusePageParameters()) {\r
- PageParameters params = getPageParameters();\r
- if (params != null) {\r
+ PageParameters pp = getPageParameters();\r
+ if (pp != null) {\r
+ PageParameters params = new PageParameters(pp);\r
// remove named repository parameter\r
params.remove("r");\r
- }\r
- return params;\r
+\r
+ // remove days back parameter if it is the default value\r
+ if (params.containsKey("db")\r
+ && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 14)) {\r
+ params.remove("db");\r
+ }\r
+ return params;\r
+ } \r
}\r
return null;\r
}\r
if (addedExpression) {\r
filters.add(new DropDownMenuItem());\r
}\r
- } \r
+ }\r
return new ArrayList<DropDownMenuItem>(filters);\r
}\r
\r
if (!hasParameter) {\r
models.addAll(availableModels);\r
}\r
- \r
+\r
// time-filter the list\r
if (daysBack > 0) {\r
Calendar cal = Calendar.getInstance();\r
if (entry.isDivider()) {\r
item.add(new Label("menuItem").setRenderBodyOnly(true));\r
WicketUtils.setCssClass(item, "divider");\r
- } else {\r
+ } else { \r
item.add(new LinkPanel("menuItem", null, entry.toString(), menu.pageClass,\r
entry.getPageParameters()).setRenderBodyOnly(true));\r
+ if (entry.isSelected()) {\r
+ WicketUtils.setCssClass(item, "selected");\r
+ }\r
}\r
}\r
};\r