提交 a4172953 编写于 作者: K Kohsuke Kawaguchi

Added "manage Jenkins" as a sub-menu to the Jenkins context menu.

上级 d0dbd3b8
......@@ -84,6 +84,8 @@ Upcoming changes</a>
Added REST API for view manipulation
<li class="rfe">
OS X installer now has an Uninstall tool (in /Library/Application Support/Jenkins).
<li class=rfe>
Added "manage Jenkins" as a sub-menu to the Jenkins context menu.
<li class=rfe>
Executor is exposed to the remote API
(<a href="https://github.com/jenkinsci/jenkins/pull/520">pull 520</a>)
......
......@@ -3024,7 +3024,14 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
}
public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws IOException, JellyException {
return new ContextMenu().from(this,request,response);
ContextMenu menu = new ContextMenu().from(this, request, response);
for (MenuItem i : menu.items) {
if (i.url.equals("/manage")) {
// add "Manage Jenkins" subitems
i.subMenu = new ContextMenu().from(this, request, response, "manage");
}
}
return menu;
}
/**
......
......@@ -110,8 +110,12 @@ public interface ModelObjectWithContextMenu extends ModelObject {
* directly to provide alternative semantics.
*/
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response) throws JellyException, IOException {
return from(self,request,response,"sidepanel");
}
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response, String view) throws JellyException, IOException {
WebApp webApp = WebApp.getCurrent();
final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript("sidepanel");
final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript(view);
if (s!=null) {
JellyFacet facet = webApp.getFacet(JellyFacet.class);
request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us
......
......@@ -31,6 +31,8 @@ THE SOFTWARE.
<d:taglib uri="local">
<!-- table to show a map -->
<d:tag name="feature">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL+'/48x48/'+icon}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title) : null}
<t:summary icon="${icon}"
href="${href}" iconOnly="true">
<div class="link"><a href="${href}">${title}</a></div>
......@@ -41,7 +43,9 @@ THE SOFTWARE.
</d:tag>
</d:taglib>
<st:include page="sidepanel.jelly" />
<j:if test="${!taskTags}">
<st:include page="sidepanel.jelly" />
</j:if>
<l:main-panel>
<h1>${%Manage Jenkins}</h1>
<j:if test="${it.checkURIEncodingEnabled}">
......
......@@ -102,9 +102,12 @@ var breadcrumbs = (function() {
xhr = new Ajax.Request(combinePath(e.getAttribute("href"),"contextMenu"), {
onComplete:function (x) {
var a = x.responseText.evalJSON().items;
a.each(function (e) {
function fillMenuItem(e) {
e.text = makeMenuHtml(e.icon, e.displayName);
});
if (e.subMenu!=null)
e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)};
}
a.each(fillMenuItem);
e.items = function() { return a };
showMenu(a);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册