Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-31939
  • Loading branch information
klimas7 committed Mar 19, 2016
1 parent 613cabb commit e22af51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Expand Up @@ -11,19 +11,18 @@
</j:if>
<st:adjunct includes="lib.form.select.select"/>
<input type="hidden" name="name" value="${it.name}"/>
<select name="value" class="select" size="5" width="200px" id="select"
<select name="value" class="select" size="5" style="min-width: 200px" id="select"
fillUrl="${h.getCurrentDescriptorByNameUrl()}/${it.descriptor.descriptorUrl}/fillValueItems?param=${it.name}">
<option value="">${%Retrieving Git references…}</option>
</select>
<j:if test="${it.quickFilterEnabled}">
<input class='git_parameter_quick_filter' type='text' value='' name='quickFilter' placeholder='Filter'
style="vertical-align: top" id="filter"/>

<script type="text/javascript">
var parentDiv = jQuery('#${divId}');
new GitParameter.QuickFilter(parentDiv.find('.select').get(0),parentDiv.find('.git_parameter_quick_filter').get(0));
</script>
</j:if>
<script type="text/javascript">
var parentDiv = jQuery('#${divId}');
new GitParameter.QuickFilter(parentDiv.find('.select').get(0),parentDiv.find('.git_parameter_quick_filter').get(0));
</script>
</div>
<div>You must have built the project at least once, to get entries in the list above.</div>
<div>If you wipe out your workspace, the plugin needs to clone the repository before it can list the
Expand Down
Expand Up @@ -50,6 +50,14 @@ var GitParameter = GitParameter || (function($) {
return this.originalOptions;
}

QuickFilter.prototype.setSelectedFirst = function() {
var _self = this;
var filteredElement = _self.getSelectElement();
if (jQuery(filteredElement).get(0).length > 0) {
jQuery(filteredElement).get(0).options[0].selected = true;
}
}

QuickFilter.prototype.initEventHandler = function() {
var _self = this;

Expand All @@ -59,6 +67,9 @@ var GitParameter = GitParameter || (function($) {
for (var i = 0; i < options.length; ++i) {
_self.getOriginalOptions().push(options[i]);
}

_self.setSelectedFirst();

jQuery(_self.getFilterElement()).prop("disabled",false);
console.log("Quick Filter handler filled event." );
});
Expand Down Expand Up @@ -87,9 +98,7 @@ var GitParameter = GitParameter || (function($) {
jQuery(filteredElement).append(opt);
}

if (jQuery(filteredElement).get(0).length > 0) {
jQuery(filteredElement).get(0).options[0].selected = true;
}
_self.setSelectedFirst();

// Propagate the changes made by the filter
console.log('Propagating change event after filtering');
Expand Down

0 comments on commit e22af51

Please sign in to comment.