Skip to content

Commit

Permalink
Add clazz
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Feb 10, 2024
1 parent 8b944e9 commit 1c19e43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/src/main/resources/lib/layout/dropdowns/item.jelly
Expand Up @@ -37,6 +37,9 @@ THE SOFTWARE.
<st:attribute name="href">
Optional HREF for the menu item
</st:attribute>
<st:attribute name="clazz">
Optional class for the menu item
</st:attribute>
</st:documentation>

<j:set var="icon">
Expand All @@ -48,5 +51,6 @@ THE SOFTWARE.
data-dropdown-icon="${icon}"
data-dropdown-text="${attrs.text}"
data-dropdown-href="${attrs.href}"
data-dropdown-clazz="${attrs.clazz}"
/>
</j:jelly>
2 changes: 1 addition & 1 deletion war/src/main/js/components/dropdowns/templates.js
Expand Up @@ -45,7 +45,7 @@ function menuItem(options) {
const tag = itemOptions.type === "link" ? "a" : "button";

const item = createElementFromHtml(`
<${tag} class="jenkins-dropdown__item" href="${itemOptions.url}" id="${itemOptions.id}">
<${tag} class="jenkins-dropdown__item ${itemOptions.clazz ? itemOptions.clazz : ''}" href="${itemOptions.url}" id="${itemOptions.id}">
${
itemOptions.icon
? `<div class="jenkins-dropdown__item__icon">${
Expand Down
1 change: 1 addition & 0 deletions war/src/main/js/components/dropdowns/utils.js
Expand Up @@ -153,6 +153,7 @@ function convertHtmlToItems(children) {
id: attributes.dropdownId,
icon: attributes.dropdownIcon,
iconXml: attributes.dropdownIcon,
clazz: attributes.dropdownClazz,
};

if (attributes.dropdownHref) {
Expand Down

0 comments on commit 1c19e43

Please sign in to comment.