forked from geoffbullen/build-pipeline-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-38670 update docs, add support for JS in handlebars templates
This is a bit anathema to using handlebars but we're more or less stuck with it: provide a way for a BuildCardExtention to contribute JS to the build card, allowing for richer build cards. Also switched an appendTo() to an append() which during testing did an evaluation of the JS but only when it was in progress - this would result in build cards being hidden if the build is in progress. jQuery docs say these are equivalent, but they are liars.
- Loading branch information
Dan Alvizu
committed
Jun 13, 2017
1 parent
c12811d
commit 48410da
Showing
5 changed files
with
66 additions
and
3 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
22 changes: 22 additions & 0 deletions
22
...umsystems/hudson/plugin/buildpipeline/extension/BuildCardExtension/buildCardHelpers.jelly
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,22 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt"> | ||
<!-- | ||
This file is included once in the build pipeline file - it is intended to allow a BuildCardExtension to contribute | ||
any 'global' scripts or assets to the build pipeline. This includes the ability to add a Handlebars helper | ||
(if you really, really must be using JS in a handlebars template). | ||
By default we just include helpers to append script tags to your build card | ||
--> | ||
<![CDATA[ | ||
<script type="text/javascript"> | ||
Handlebars.registerHelper('startScript', function() { | ||
return new Handlebars.SafeString("<scr" + "ipt>"); | ||
}); | ||
Handlebars.registerHelper('endScript', function() { | ||
return new Handlebars.SafeString("</scr" + "ipt>"); | ||
}); | ||
</script> | ||
]]> | ||
</j:jelly> |
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