Skip to content
Browse files
[FIXED JENKINS-23160] Newly added module locations' / additional cred…
…entials' "Add" credential button does not work

- Also changed the width of the drop-down to be auto so that the add button is more clearly associated
- Also fixed select box alignment with add button

- Root cause was f:repeatable was neither generating a new id nor re-executing the in-line script, this fixes both in one go by using Behaviour to apply the rule thus removing the need for the id on the button
  • Loading branch information
stephenc committed Aug 6, 2014
1 parent 1d374a9 commit 7c263cbb86276cf9a7ff67c43d6532776efac5aa
@@ -44,25 +44,21 @@
<st:adjunct includes=""/>
<f:select style="width:90%" clazz="${attrs.clazz} credentials-select" field="${attrs.field}"
<f:select clazz="${attrs.clazz} credentials-select" field="${attrs.field}" default="${attrs.default}"/>
<!-- TODO add support for checking permissions against stores in request path -->
<j:set var="buttonId" value="${h.generateId()}"/>
<j:when test="${h.hasPermission(app.getDescriptorByName('com.cloudbees.plugins.credentials.CredentialsSelectHelper').CREATE)}">
<button id="${buttonId}" type="button" onclick="return window.credentials.add();">
<button class="credentials-add" type="button" onclick="return window.credentials.add();">
<img src="${resURL}/plugin/credentials/images/16x16/new-credential.png" alt=""/>
<script>(function(){var a=function(){var b=document.getElementById('${buttonId}');if(b!=null) makeButton(b, window.credentials.add)};if(document.getElementById('${buttonId}')==null) window.setTimeout(a,10); else a();})();</script>
<button id="${buttonId}" type="button" disabled="disabled">
<button class="credentials-add" type="button" disabled="disabled">
<img src="${resURL}/plugin/credentials/images/16x16/new-credential.png" alt=""/>
<script>(function(){var a=function(){var b=document.getElementById('${buttonId}');if(b!=null) makeButton(b)};if(document.getElementById('${buttonId}')==null) window.setTimeout(a,10); else a();})();</script>
@@ -0,0 +1 @@
select.credentials-select { width: auto; vertical-align: top; }
@@ -16,7 +16,8 @@ window.credentials.init = function () {
window.credentials.add = function () {
window.credentials.add = function (e) {
new Ajax.Request(rootURL + "/descriptor/com.cloudbees.plugins.credentials.CredentialsSelectHelper/dialog", {
method: 'get',
@@ -146,4 +147,9 @@ window.credentials.addSubmit = function (e) {
return false;
Behaviour.specify("BUTTON.credentials-add", 'select', 0, function (e) {
makeButton(e, e.disabled ? null : window.credentials.add);
e = null; // avoid memory leak

0 comments on commit 7c263cb

Please sign in to comment.