Skip to content
Permalink
Browse files
first pass at a fix for JENKINS-10072
  • Loading branch information
jieryn committed Jun 22, 2011
1 parent 9d40431 commit fffc5d27d28f8d4e399295f4c11a5c17e4d0756f
@@ -27,8 +27,10 @@
import hudson.Extension;
import hudson.views.ViewsTabBar;
import hudson.views.ViewsTabBarDescriptor;
import net.sf.json.JSONObject;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

/**
* This plugin provides an alternate rendering of the Views bar which runs along
@@ -38,21 +40,46 @@
* @author <a href="mailto:jieryn@gmail.com">Jesse Farinacci</a>
* @since 1.0
*/
public final class DropDownViewsTabBar extends ViewsTabBar
{
@DataBoundConstructor
public DropDownViewsTabBar()
{
super();
}

@Extension
public static class DescriptorImpl extends ViewsTabBarDescriptor
{
@Override
public String getDisplayName()
{
return Messages.DisplayName();
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;

public DescriptorImpl() {
super();
load();
}

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

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

public boolean isShowJobCount() {
return showJobCount;
}

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

@DataBoundConstructor
public DropDownViewsTabBar() {
super();
}
}
}
@@ -0,0 +1,31 @@
<!--
The MIT License
Copyright (c) 2011, Jesse Farinacci
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
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">
<f:section title="${%DropDown.ViewsTabBar.Section.Title}">
<f:entry title="${%DropDown.ViewsTabBar.Section.ShowJobCount.Title}" field="showJobCount">
<f:checkbox />
</f:entry>
</f:section>
</j:jelly>
@@ -0,0 +1,26 @@
#
# The MIT License
#
# Copyright (c) 2011, Jesse Farinacci
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

DropDown.ViewsTabBar.Section.Title = DropDown ViewsTabBar
DropDown.ViewsTabBar.Section.ShowJobCount.Title = Show Job Counts
@@ -0,0 +1,31 @@
<!--
The MIT License
Copyright (c) 2011, Jesse Farinacci
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<div>
Whether to show the job count, e.g. the
<code>(42)</code>
part of
<code>All (42)</code>
, in the drop down label name.
</div>

0 comments on commit fffc5d2

Please sign in to comment.