diff --git a/core/src/main/resources/lib/form/hetero-list.jelly b/core/src/main/resources/lib/form/hetero-list.jelly index 05f0a7ec8b19f4e5cf2a434ab3889947381313cb..198ff6e733c1f8700f1e115dea5c7f1083e0a168 100644 --- a/core/src/main/resources/lib/form/hetero-list.jelly +++ b/core/src/main/resources/lib/form/hetero-list.jelly @@ -58,6 +58,10 @@ THE SOFTWARE. Menu alignment against the button. Defaults to tl-bl + + If true, insert new addition by default to their 'desired' location, which + is the order induced by the descriptors. + @@ -96,7 +100,7 @@ THE SOFTWARE. -
+
diff --git a/core/src/main/resources/lib/hudson/project/config-publishers.jelly b/core/src/main/resources/lib/hudson/project/config-publishers.jelly index 71905f083a57a6e9664d7ffe48a63db904cc35a4..ad29a3c4294e9781777eb0890c1020c2e77f776b 100644 --- a/core/src/main/resources/lib/hudson/project/config-publishers.jelly +++ b/core/src/main/resources/lib/hudson/project/config-publishers.jelly @@ -34,6 +34,7 @@ THE SOFTWARE. items="${it.publishersList}" oneEach="true" menuAlign="bl-tl" + honorOrder="true" addCaption="${%Add post-build action}"/> diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 6fb4431f16fcd404f1b11778526cceda457567bd..2c8dc4b0b6055398710fca6afbfe5d8fd6b3a3ab 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -556,7 +556,53 @@ var jenkinsRules = { var scroll = document.body.scrollTop; renderOnDemand(findElementsBySelector(nc,"TR.config-page")[0],function() { - insertionPoint.insert({after:nc}); + function findInsertionPoint() { + // given the element to be inserted 'prospect', + // and the array of existing items 'current', + // and preferred ordering function, return the position in the array + // the prospect should be inserted. + // (for example 0 if it should be the first item) + function findBestPosition(prospect,current,order) { + function desirability(pos) { + var count=0; + for (var i=0; i