mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-10 02:26:18 +00:00
Merge pull request #4586 from daniel-beck/manage-context-menu-titles
Add section titles to Manage Jenkins context menu
This commit is contained in:
4 files changed
+32
-2
No files matched your search
@@ -14,6 +14,8 @@ import org.apache.commons.jelly.JellyException;
|
||||
import org.apache.commons.jelly.JellyTagException;
|
||||
import org.apache.commons.jelly.Script;
|
||||
import org.apache.commons.jelly.XMLOutput;
|
||||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.DoNotUse;
|
||||
import org.kohsuke.stapler.HttpResponse;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
@@ -128,6 +130,18 @@ public interface ModelObjectWithContextMenu extends ModelObject {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a header row (no icon, no URL, rendered in header style).
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
@Restricted(DoNotUse.class) // manage.jelly only
|
||||
public ContextMenu addHeader(String title) {
|
||||
final MenuItem item = new MenuItem().withDisplayName(title);
|
||||
item.header = true;
|
||||
return add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a manually constructed {@link MenuItem}
|
||||
*
|
||||
@@ -259,6 +273,13 @@ public interface ModelObjectWithContextMenu extends ModelObject {
|
||||
*/
|
||||
@Exported public boolean requiresConfirmation;
|
||||
|
||||
|
||||
/**
|
||||
* True to display this item as a section header.
|
||||
* @since TODO
|
||||
*/
|
||||
@Exported public boolean header;
|
||||
|
||||
/**
|
||||
* If this is a submenu, definition of subitems.
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ THE SOFTWARE.
|
||||
<j:forEach var="category" items="${it.categorizedManagementLinks.entrySet()}">
|
||||
<section class="manage-page__category">
|
||||
<h2>${category.key.label}</h2>
|
||||
|
||||
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.addHeader(category.key.label) : null}
|
||||
<div class="manage-page__row">
|
||||
<j:forEach var="m" items="${category.value}">
|
||||
<j:set var="icon" value="${m.iconClassName != null ? m.iconClassName : m.iconFileName}" />
|
||||
|
||||
@@ -126,3 +126,8 @@
|
||||
A.model-link.inside, #breadcrumbs A.inside {/* additional 'inside' class allows pre-allocation of the context menu space */
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
#breadcrumb-menu .header {
|
||||
font-weight: bold;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
@@ -203,7 +203,11 @@ var breadcrumbs = (function() {
|
||||
onComplete:function (x) {
|
||||
var a = x.responseText.evalJSON().items;
|
||||
function fillMenuItem(e) {
|
||||
e.text = makeMenuHtml(e.icon, e.displayName);
|
||||
if (e.header) {
|
||||
e.text = makeMenuHtml(e.icon, "<span class='header'>" + e.displayName + "</span>");
|
||||
} else {
|
||||
e.text = makeMenuHtml(e.icon, e.displayName);
|
||||
}
|
||||
if (e.subMenu!=null)
|
||||
e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)};
|
||||
if (e.requiresConfirmation) {
|
||||
|
||||
Reference in new issue
Block a user