-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-69659] Un-inline multiple occurrences of JavaScript in Jelly…
… templates (#130) Co-authored-by: Yaroslav Afenkin <[email protected]> Co-authored-by: Basil Crow <[email protected]>
- Loading branch information
1 parent
a7c7b8a
commit 4d7b7bf
Showing
7 changed files
with
64 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/resources/hudson/matrix/LabelAxis/label-axis-resources.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Behaviour.specify("DIV.labelAxis-tree", 'LabelAxis', 0, function(e) { | ||
var tree = new YAHOO.widget.TreeView(e); | ||
|
||
var i18nContainer = document.querySelector(".label-axis-i18n"); | ||
var labels = new YAHOO.widget.TextNode(i18nContainer.getAttribute("data-i18n-labels"), tree.getRoot(), false); | ||
var machines = new YAHOO.widget.TextNode(i18nContainer.getAttribute("data-i18n-individual-nodes"), tree.getRoot(), false); | ||
|
||
var values = (e.getAttribute("values") || "").split("/"); | ||
function has(v) { | ||
return values.includes(v) ? 'checked="checked" ' : ""; | ||
} | ||
|
||
var labelAxisDataContainer = document.querySelector(".label-axis-data-container"); | ||
labelAxisDataContainer.childNodes.forEach(node => { | ||
var labelCheckbox = node.getAttribute("data-label-checkbox"); | ||
|
||
var CHECKED_ATTR_INSERT_IDX = "<input ".length; | ||
var output = [labelCheckbox.slice(0, CHECKED_ATTR_INSERT_IDX), | ||
has(node.getAttribute("data-label-atom")), labelCheckbox.slice(CHECKED_ATTR_INSERT_IDX)].join(''); | ||
var label = node.getAttribute("data-label"); | ||
new YAHOO.widget.HTMLNode(output, label === "machines" ? machines : labels, false); | ||
}); | ||
|
||
tree.draw(); | ||
/* | ||
force the rendering of HTML, so that input fields are there | ||
even when the form is submitted without this tree expanded. | ||
*/ | ||
tree.expandAll(); | ||
tree.collapseAll(); | ||
|
||
/* | ||
cancel the event. | ||
from http://yuilibrary.com/forum/viewtopic.php?f=89&t=8209&p=26239&hilit=HTMLNode#p26239 | ||
"To prevent toggling and allow the link to work, add a listener to the clickEvent on that tree and simply return false" | ||
*/ | ||
tree.subscribe("clickEvent", function(node) { | ||
return false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/resources/lib/hudson/matrix-project/matrix-resources.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
refreshPart('matrix',"./ajaxMatrix"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters