|
14 | 14 |
|
15 | 15 | </st:documentation> |
16 | 16 |
|
17 | | - <j:set var="jumplist"> |
18 | | - <st:include it="${action}" page="jumplist.jelly" optional="true" /> |
19 | | - </j:set> |
20 | | - <x:comment>rendering primary action: ${action.class.name}</x:comment> |
21 | | - <j:if test="${jumplist.length() == 0}"> |
22 | | - <j:set var="tooltip"> |
23 | | - <st:include it="${action}" page="tooltip.jelly" optional="true" /> |
24 | | - </j:set> |
25 | | - </j:if> |
| 17 | + <j:choose> |
| 18 | + <j:when test="${h.hasView(action, 'action')}"> |
| 19 | + <j:scope> |
| 20 | + <!-- Root actions expect to be in the context of Jenkins (as it) --> |
| 21 | + <j:set var="it" value="${app}"/> |
| 22 | + <j:set var="isInPrimaryHeader" value="true"/> |
| 23 | + <st:include page="action.jelly" from="${action}" optional="true"/> |
| 24 | + </j:scope> |
| 25 | + </j:when> |
| 26 | + <j:otherwise> |
| 27 | + <j:set var="icon" value="${action.iconClassName != null ? action.iconClassName : action.iconFileName}"/> |
| 28 | + <j:if test="${icon != null}"> |
| 29 | + <j:set var="jumplist"> |
| 30 | + <st:include it="${action}" page="jumplist.jelly" optional="true" /> |
| 31 | + </j:set> |
| 32 | + <x:comment>rendering primary action: ${action.class.name}</x:comment> |
| 33 | + <j:if test="${jumplist.length() == 0}"> |
| 34 | + <j:set var="tooltip"> |
| 35 | + <st:include it="${action}" page="tooltip.jelly" optional="true" /> |
| 36 | + </j:set> |
| 37 | + </j:if> |
26 | 38 |
|
27 | | - <j:set var="badge" value="${action.badge}" /> |
28 | | - <j:if test="${jumplist.length() == 0 and tooltip.length() == 0}"> |
29 | | - <j:set var="tooltip"> |
30 | | - <div style="text-align: center;">${action.displayName}</div> |
31 | | - <j:if test="${badge != null}"> |
32 | | - <div style="text-align: center; color: var(--text-color-secondary)">${badge.tooltip}</div> |
33 | | - </j:if> |
34 | | - </j:set> |
35 | | - </j:if> |
| 39 | + <j:set var="badge" value="${action.badge}" /> |
| 40 | + <j:if test="${jumplist.length() == 0 and tooltip.length() == 0}"> |
| 41 | + <j:set var="tooltip"> |
| 42 | + <div style="text-align: center;">${action.displayName}</div> |
| 43 | + <j:if test="${badge != null}"> |
| 44 | + <div style="text-align: center; color: var(--text-color-secondary)">${badge.tooltip}</div> |
| 45 | + </j:if> |
| 46 | + </j:set> |
| 47 | + </j:if> |
36 | 48 |
|
37 | | - <j:set var="interactive" value="${jumplist.length() gt 0}" /> |
38 | | - <j:set var="icon" value="${action.iconClassName != null ? action.iconClassName : action.iconFileName}"/> |
39 | | - <x:element name="${action.urlName == null ? 'button' : 'a'}"> |
40 | | - <x:attribute name="data-dropdown">${interactive}</x:attribute> |
41 | | - <x:attribute name="id">root-action-${action.class.simpleName}</x:attribute> |
42 | | - <x:attribute name="href">${h.getActionUrl(app.url, action)}</x:attribute> |
43 | | - <j:if test="${interactive}"> |
44 | | - <x:attribute name="data-tippy-offset">[0, 10]</x:attribute> |
45 | | - </j:if> |
46 | | - <j:if test="${!interactive}"> |
47 | | - <x:attribute name="data-html-tooltip" escapeText="false"><j:out value="${tooltip}" /></x:attribute> |
48 | | - </j:if> |
49 | | - <x:attribute name="data-tooltip-interactive">${interactive}</x:attribute> |
50 | | - <x:attribute name="data-tippy-animation">tooltip</x:attribute> |
51 | | - <x:attribute name="data-tippy-theme">${interactive ? 'dropdown' : 'tooltip'}</x:attribute> |
52 | | - <x:attribute name="data-tippy-trigger">mouseenter focus</x:attribute> |
53 | | - <x:attribute name="data-tippy-touch">${interactive}</x:attribute> |
54 | | - <x:attribute name="data-type">header-action</x:attribute> |
55 | | - <x:attribute name="draggable">false</x:attribute> |
56 | | - <x:attribute name="class">jenkins-button ${isCurrent ? '' : 'jenkins-button--tertiary'}</x:attribute> |
57 | | - <l:icon src="${icon}" class="${action.class.name == 'jenkins.model.navigation.UserAction' ? 'jenkins-avatar' : ''}"/> |
58 | | - <span class="jenkins-visually-hidden" data-type="action-label">${action.displayName}</span> |
59 | | - <j:if test="${badge != null}"> |
60 | | - <span class="jenkins-badge jenkins-!-${badge.severity}-color" /> |
61 | | - </j:if> |
62 | | - </x:element> |
| 49 | + <j:set var="interactive" value="${jumplist.length() gt 0}" /> |
| 50 | + <x:element name="${action.urlName == null ? 'button' : 'a'}"> |
| 51 | + <x:attribute name="data-dropdown">${interactive}</x:attribute> |
| 52 | + <x:attribute name="id">root-action-${action.class.simpleName}</x:attribute> |
| 53 | + <x:attribute name="href">${h.getActionUrl(app.url, action)}</x:attribute> |
| 54 | + <j:if test="${interactive}"> |
| 55 | + <x:attribute name="data-tippy-offset">[0, 10]</x:attribute> |
| 56 | + </j:if> |
| 57 | + <j:if test="${!interactive}"> |
| 58 | + <x:attribute name="data-html-tooltip" escapeText="false"><j:out value="${tooltip}" /></x:attribute> |
| 59 | + </j:if> |
| 60 | + <x:attribute name="data-tooltip-interactive">${interactive}</x:attribute> |
| 61 | + <x:attribute name="data-tippy-animation">tooltip</x:attribute> |
| 62 | + <x:attribute name="data-tippy-theme">${interactive ? 'dropdown' : 'tooltip'}</x:attribute> |
| 63 | + <x:attribute name="data-tippy-trigger">mouseenter focus</x:attribute> |
| 64 | + <x:attribute name="data-tippy-touch">${interactive}</x:attribute> |
| 65 | + <x:attribute name="data-type">header-action</x:attribute> |
| 66 | + <x:attribute name="draggable">false</x:attribute> |
| 67 | + <x:attribute name="class">jenkins-button ${isCurrent ? '' : 'jenkins-button--tertiary'}</x:attribute> |
| 68 | + <l:icon src="${icon}" class="${action.class.name == 'jenkins.model.navigation.UserAction' ? 'jenkins-avatar' : ''}"/> |
| 69 | + <span class="jenkins-visually-hidden" data-type="action-label">${action.displayName}</span> |
| 70 | + <j:if test="${badge != null}"> |
| 71 | + <span class="jenkins-badge jenkins-!-${badge.severity}-color" /> |
| 72 | + </j:if> |
| 73 | + </x:element> |
63 | 74 |
|
64 | | - <j:if test="${interactive}"> |
65 | | - <template> |
66 | | - <div class="jenkins-dropdown"> |
67 | | - <j:out value="${jumplist}" /> |
68 | | - </div> |
69 | | - </template> |
70 | | - </j:if> |
| 75 | + <j:if test="${interactive}"> |
| 76 | + <template> |
| 77 | + <div class="jenkins-dropdown"> |
| 78 | + <j:out value="${jumplist}" /> |
| 79 | + </div> |
| 80 | + </template> |
| 81 | + </j:if> |
| 82 | + </j:if> |
| 83 | + </j:otherwise> |
| 84 | + </j:choose> |
71 | 85 |
|
72 | 86 | </j:jelly> |
0 commit comments