Fix "New Item" sidebar URL when browsing a folder view#740
Fix "New Item" sidebar URL when browsing a folder view#740dakanggo wants to merge 1 commit intojenkinsci:masterfrom
Conversation
Why is this an issue, what problems does it cause? |
| @@ -24,5 +24,9 @@ THE SOFTWARE. | |||
| <?jelly escape-by-default='true'?> | |||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form"> | |||
| <j:set var="url" value="${h.getNearestAncestorUrl(request2,it)}"/> | |||
There was a problem hiding this comment.
core just always uses the view URL :-/
When I create a folder on the home page, navigate into that folder, and then create a view inside it, selecting that view to create a job does not place the job under the current view. Instead, the job is created directly under the folder. Example:
Expected behavior: |
Problem
With the Folders plugin, the sidebar "New Item" link is rendered from
Folder/tasks-create.jellyusinggetNearestAncestorUrl(request, folder), which resolves to the folder URL only (e.g.job/myfolder/). When the user is on a non-default view inside that folder (e.g.job/myfolder/view/my_view/), the link incorrectly points to.../newJobunder the folder root instead of.../view/my_view/newJob.Solution
Compute the link prefix from the current View when the Jelly context exposes the
viewvariable (as set by Jenkins core’sView/index.jellybefore the side panel is rendered), and fall back to the folder URL when that is not available.Testing
view/<name>/.Proposed changelog entries