5 <& /util/import_javascript.mas, classes => [ 'jstree.dist.jstree', 'CXGN.TrialTreeFolders'] &>
7 <& /util/import_css.mas, paths => ['/static/documents/inc/jstree_theme/jstree-bstheme-min.css'] &>
9 <& /breeders_toolbox/folder/folder_set.mas, project_type=>'Genotyping Plate' &>
10 <& /breeders_toolbox/folder/folder_new.mas, project_type=>'genotyping_plate' &>
11 <& /breeders_toolbox/folder/folder_move.mas, project_type=>'Genotyping Plate' &>
12 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Genotyping Plate', folder_tree_identifier => 'genotyping_trial_list', folder_tree_refresh_name => 'refresh_genotyping_trial_jstree_html' &>
14 <table class="table table-bordered">
18 <th>Breeding Programs -- Folders -- Genotyping Plates <button class="btn btn-sm btn-default" id="refresh_genotyping_trial_jstree_html_trialtree_button" name="refresh_genotyping_trial_jstree_html">Refresh</button></th>
25 <input type="text" class="form-control input-sm" id="genotyping_trial_tree_search" placeholder="Search" />
28 <h5><i>Double click<br />genotyping plate ( <span class="glyphicon glyphicon-th text-success"></span> ) or folder ( <span class="glyphicon glyphicon-folder-open text-danger"></span> )<br/>to view detail page.</i></h5>
29 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
33 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
34 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move genotyping plate(s) to folder</button><br/><br/>
35 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
37 <div id="folder_edit_options" style="display:none">
39 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
40 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
44 <!--<button id="delete" disabled="disabled" >Delete</button -->
48 <div id="genotyping_trial_list" >[loading...]</div>
59 jQuery(document).ready(function($) {
62 url: '/ajax/breeders/get_trials_with_folders_cached?type=genotyping_trial',
63 success: function(response) {
64 var html = '<ul>'+response.html+'</ul>';
66 jQuery('#genotyping_trial_list').html(html);
68 jQuery('#genotyping_trial_list').jstree( {
69 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
70 "valid_children" : [ "folder", "genotyping_trial", "breeding_program" ],
72 "breeding_program" : {
73 "icon": 'glyphicon glyphicon-briefcase text-info',
76 "icon": 'glyphicon glyphicon-folder-open text-danger',
78 "genotyping_trial" : {
79 "icon": 'glyphicon glyphicon-th text-success',
83 "case_insensitive" : true,
85 "plugins" : ["html_data","types","search"],
90 error: function(response) {
91 alert("An error occurred while loading the trial data.");
95 jQuery("#genotyping_trial_tree_search").keyup(function() {
96 var v = jQuery("#genotyping_trial_tree_search").val();
97 jQuery("#genotyping_trial_list").jstree(true).search(v);
100 jQuery('#genotyping_trial_list').on("changed.jstree", function (e, data) {
102 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
103 jQuery("#folder_edit_options").show();
106 jQuery("#folder_edit_options").hide();
110 jQuery("#genotyping_trial_list").delegate("li", "dblclick", function(event){
111 var node = $("#genotyping_trial_list").jstree("get_node", this);
113 if (node.id.substr(0,1) !== 'j') {
114 if (node.type == 'folder') {
115 window.open('/folder/'+node.id);
116 event.stopPropagation();
117 } else if (node.type == 'genotyping_trial') {
118 window.open('/breeders_toolbox/trial/'+node.id);
119 event.stopPropagation();