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