Skip to content

Commit

Permalink
Merge pull request #4533 from solgenomics/topic/accession_download_al…
Browse files Browse the repository at this point in the history
…l_traits

download all traits from phenotype dialog box fixed
  • Loading branch information
lukasmueller authored May 15, 2023
2 parents 5e2829b + 94aae0c commit 42b7b18
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
4 changes: 4 additions & 0 deletions js/source/legacy/CXGN/BreedersToolbox/HTMLSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function get_select_box(type, div_id, options) {
// console.log(JSON.stringify(response.select));
var select = jQuery("#"+options.id).attr('onChange', 'Workflow.complete(this);');
}
if (options.full_dropdown) {
var select_collection = document.getElementById(options.id).options;
document.getElementById(options.id).setAttribute("size", select_collection.length);
}
},
error: function(response) {
alert("An error occurred");
Expand Down
40 changes: 37 additions & 3 deletions mason/stock/download_stock_phenotypes_dialog.mas
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,23 @@ $stock_name => undef
</div>

<div class="form-group">
<label class="col-sm-3 control-label">Traits:<br/><small>(Select none for all traits)</small></label>
<label class="col-sm-3 control-label">Traits:</label>
<div class="col-sm-9" >
<div id="download_stock_phenotypes_traits">
</div>
</div>
</div>
<div class="row">
<div id="download_stock_phenotypes_select_all" class="btn btn-sm btn-primary" style="margin:3px">Select all traits</div>
<div id="download_stock_phenotypes_select_reset" class="btn btn-sm btn-default" style="margin:3px">Unselect all traits</div>
</div>

<style>
#download_stock_phenotypes_traits_select:hover {
width:auto;
margin-left: -140px;
}
</style>
</&>
</form><br/>

Expand All @@ -92,6 +103,20 @@ jQuery(document).ready(function() {
data_level_change_traits();
});

jQuery(document).on('click', "#download_stock_phenotypes_select_all", function() {
var trait_collection = document.getElementById('download_stock_phenotypes_traits_select').options;
for (var index = 0; index < trait_collection.length; index += 1) {
trait_collection[index].selected = true;
};
});

jQuery(document).on('click', "#download_stock_phenotypes_select_reset", function() {
var trait_collection = document.getElementById('download_stock_phenotypes_traits_select').options;
for (var index = 0; index < trait_collection.length; index += 1) {
trait_collection[index].selected = false;
};
});

jQuery('#download_stock_phenotypes_submit_button').click( function () {
var stock_type = "<% $stock_type %>";
var stock_id = ["<% $stock_id %>"];
Expand All @@ -101,7 +126,7 @@ jQuery(document).ready(function() {
if (! Array.isArray(traits) ) {
traits = [ traits ];
}

var datalevel = jQuery("#download_stock_phenotypes_level_option").val();
var exclude_phenotype_outlier = jQuery("#download_stock_phenotypes_exclude_outliers").val();
window.open("/breeders/trials/phenotype/download?"+stock_type+"_list="+JSON.stringify(stock_id)+"&dataLevel="+datalevel+"&format="+format+"&timestamp="+timestamp+"&trait_list="+JSON.stringify(traits)+"&exclude_phenotype_outlier="+exclude_phenotype_outlier);
Expand All @@ -111,6 +136,15 @@ jQuery(document).ready(function() {

function data_level_change_traits() {
var stock_type = "<% $stock_type %>";
get_select_box('traits', 'download_stock_phenotypes_traits', { 'name' : 'download_stock_phenotypes_traits_select', 'id' : 'download_stock_phenotypes_traits_select', 'stock_id':<% $stock_id %>, 'stock_type': stock_type });
get_select_box(
'traits',
'download_stock_phenotypes_traits',
{ 'name' : 'download_stock_phenotypes_traits_select',
'id' : 'download_stock_phenotypes_traits_select',
'stock_id':<% $stock_id %>,
'stock_type': stock_type ,
'multiple': true,
'full_dropdown':true}
);
}
</script>

0 comments on commit 42b7b18

Please sign in to comment.