Select all button works only on Nucleotide, not on Proteins

Hi all,

I tried adding a button to select/deselect all databases in SS. Following advice on SS Github, I implemented it in search.rb, but it works only on the first column (nucleotide) and not on the Protein column.

The code generating the databases list is the same in both column. Any advice?

I’m attaching my search.rb file. This is the portion of the code that affects the databases choice.


</div>
<div
class="form-group databases-container">
<%# sort => same ordering of nucleotide and protein datbases %>
<% databases.keys.sort.each do |type| %>
<div
class="<%= databases[(databases.keys - [type]).first] ? 'col-md-6' : 'col-md-12' %>">
<div
class="panel panel-default">
<div
class="panel-heading">
<h4><%= type.capitalize %> databases</h4>
</div>
<input type="checkbox" id="checkAll" /> Select All Databases<br />
<ul
class="list-group databases <%= type %>">
<% databases[type].sort_by(&:title).each do |database| %>

<li class="list-group-item">
<div
class="checkbox">
<label>
<input type="checkbox" name="databases[]" value="<%=database.id%>" data-type="<%=database.type%>" />
<%= database.title or database.name %>
</label>
</div>
</li>
<% end %>
</ul>
</div>
</div>


<!-- Select All -->
<script>
$(function(){
$('#checkAll').on('change', function(){
var others = $(this).parent().find('input[type="checkbox"]').not(this);
var value = !!this.checked;
others.prop('checked', value);
});
});
</script>

search.erb (16.2 KB)