Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download all traits from phenotype dialog box fixed #4533

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading