10 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form','CXGN.BreedersToolbox.Crosses', 'jstree.dist.jstree', 'CXGN.TrialTreeFolders'] &>
12 <& /util/import_css.mas, paths => ['/static/documents/inc/jstree_theme/jstree-bstheme-min.css'] &>
14 % if ($odk_service eq 'ONA') {
15 <& /breeders_toolbox/cross/cross_wishlist.mas &>
17 <& /breeders_toolbox/cross/add_cross_dialogs.mas, programs=>\@programs, locations=>\@locations &>
18 <& /breeders_toolbox/cross/upload_crosses_dialogs.mas, programs=>\@programs, locations=>\@locations &>
19 <& /breeders_toolbox/cross/add_crossing_trial_dialogs.mas, programs=>\@programs, locations=>\@locations &>
20 <& /breeders_toolbox/folder/folder_set.mas, project_type=>'crossing_experiment' &>
21 <& /breeders_toolbox/folder/folder_new.mas, project_type=>'crossing_experiment' &>
22 <& /breeders_toolbox/folder/folder_move.mas, project_type=>'crossing_experiment' &>
23 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Cross', folder_tree_identifier => 'crosses_list', folder_tree_refresh_name => 'refresh_crosses_jstree_html' &>
25 <table class="table table-bordered">
29 <th>Breeding Programs -- Folders -- Crossing Experiments <button class="btn btn-sm btn-default" id="refresh_crosses_jstree_html_trialtree_button" name="refresh_crosses_jstree_html">Refresh</button></th>
36 <input type="text" class="form-control input-sm" id="cross_tree_search" placeholder="Search" />
39 <h5><i>Double click<br />crossing experiment ( <span class="glyphicon glyphicon-grain text-success"></span> ) or folder ( <span class="glyphicon glyphicon-folder-open text-danger"></span> )<br/>to view detail page.</i></h5>
40 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
44 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
45 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move crossing experiment(s) to folder</button><br/><br/>
46 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
48 <div id="folder_edit_options" style="display:none">
50 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
51 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
55 <!--<button id="delete" disabled="disabled" >Delete</button -->
59 <div id="crosses_list" >[loading...]</div>
70 jQuery(document).ready(function($) {
72 jQuery('#crosses_datatable').DataTable({
80 url: '/ajax/breeders/get_trials_with_folders_cached?type=cross',
81 success: function(response) {
82 var html = '<ul>'+response.html+'</ul>';
84 jQuery('#crosses_list').html(html);
86 jQuery('#crosses_list').jstree( {
87 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
88 "valid_children" : [ "folder", "trial", "breeding_program" ],
90 "breeding_program" : {
91 "icon": 'glyphicon glyphicon-briefcase text-info',
94 "icon": 'glyphicon glyphicon-folder-open text-danger',
97 "icon": 'glyphicon glyphicon-grain text-success',
101 "case_insensitive" : true,
103 "plugins" : ["html_data","types","search"],
108 error: function(response) {
109 alert("An error occurred while loading the trial data.");
113 jQuery("#cross_tree_search").keyup(function() {
114 var v = jQuery("#cross_tree_search").val();
115 jQuery("#crosses_list").jstree(true).search(v);
118 jQuery('#crosses_list').on("changed.jstree", function (e, data) {
120 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
121 jQuery("#folder_edit_options").show();
124 jQuery("#folder_edit_options").hide();
128 jQuery("#crosses_list").delegate("li", "dblclick", function(event){
129 var node = $("#crosses_list").jstree("get_node", this);
131 if (node.id.substr(0,1) !== 'j') {
132 if (node.type == 'folder') {
133 window.open('/folder/'+node.id);
134 event.stopPropagation();
135 } else if (node.type == 'cross') {
136 window.open('/breeders_toolbox/trial/'+node.id);
137 event.stopPropagation();