Skip to content

Commit

Permalink
[FIXED JENKINS-13048] Cannot save checkbox 'Show Job Counts', moved
Browse files Browse the repository at this point in the history
checkbox label to the right for a more consistent layout
  • Loading branch information
fredg02 committed Apr 27, 2012
1 parent f41c243 commit 9c813f1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 40 deletions.
53 changes: 19 additions & 34 deletions src/main/java/hudson/views/tabbar/DropDownViewsTabBar.java
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright (c) 2011-2012, Jesse Farinacci
* Copyright (c) 2011-2012, Jesse Farinacci, Frederic Gurr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -41,46 +41,31 @@
* @since 1.0
*/
public final class DropDownViewsTabBar extends ViewsTabBar {
@Extension
public static class DescriptorImpl extends ViewsTabBarDescriptor {
/**
* Whether to show the job count, e.g. the <code>(42)</code> part of
* <code>All (42)</code>, in the drop down label name.
*
* @since 1.3
*/
private boolean showJobCount;
/**
* Whether to show the job count, e.g. the <code>(42)</code> part of
* <code>All (42)</code>, in the drop down label name.
*
* @since 1.3
*/
final boolean showJobCount;

public DescriptorImpl() {
super();
load();
}
@DataBoundConstructor
public DropDownViewsTabBar(final boolean showJobCount) {
this.showJobCount = showJobCount;
}

@Override
public boolean configure(final StaplerRequest request,
final JSONObject jsonObject) {
showJobCount = jsonObject.getBoolean("showJobCount");
save();
return true;
}
public boolean isShowJobCount() {
return showJobCount;
}

@Extension
public static class DescriptorImpl extends ViewsTabBarDescriptor {

@Override
public String getDisplayName() {
return Messages.DisplayName();
}

public boolean isShowJobCount() {
return showJobCount;
}

public void setShowJobCount(final boolean showJobCount) {
this.showJobCount = showJobCount;
save();
}
}

@DataBoundConstructor
public DropDownViewsTabBar() {
super();
}
public static final ViewsTabBar INSTANCE = new DropDownViewsTabBar(false);
}
@@ -1,7 +1,7 @@
<!--
The MIT License
Copyright (c) 2011-2012, Jesse Farinacci
Copyright (c) 2011-2012, Jesse Farinacci, Frederic Gurr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,10 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="${%DropDown.ViewsTabBar.Section.Title}">
<f:entry title="${%DropDown.ViewsTabBar.Section.ShowJobCount.Title}" field="showJobCount">
<f:checkbox />
<f:entry field="showJobCount">
<f:checkbox title="${%DropDown.ViewsTabBar.Section.ShowJobCount.Title}"/>
</f:entry>
</f:section>
</j:jelly>
@@ -1,7 +1,7 @@
<!--
The MIT License
Copyright (c) 2011-2012, Jesse Farinacci
Copyright (c) 2011-2012, Jesse Farinacci, Frederic Gurr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<script type="text/javascript">
function selectViewOnChange()
Expand All @@ -46,7 +47,7 @@ THE SOFTWARE.
<select id="selectView" onChange="javascript:selectViewOnChange();">
<j:forEach var="view" items="${views}">
<option id="${view.viewName}" value="${view.viewUrl}">${view.viewName}
<j:if test="${it.descriptor.showJobCount}">(${view.getItems().size()})</j:if>
<j:if test="${it.showJobCount}">(${view.getItems().size()})</j:if>
</option>
</j:forEach>
<j:if test="${currentView.hasPermission(currentView.CREATE)}">
Expand Down

0 comments on commit 9c813f1

Please sign in to comment.