8 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'jstree.dist.jstree', 'CXGN.TrialTreeFolders'] &>
10 <& /util/import_css.mas, paths => ['/static/documents/inc/jstree_theme/jstree-bstheme-min.css'] &>
12 <& /transformation/add_transformation_project_dialog.mas, user_id=>$user_id, programs=>\@programs, locations=>\@locations, roles=>\@roles &>
13 <& /breeders_toolbox/folder/folder_set.mas, project_type=>'transformation' &>
14 <& /breeders_toolbox/folder/folder_new.mas, project_type=>'transformation' &>
15 <& /breeders_toolbox/folder/folder_move.mas, project_type=>'transformation' &>
16 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Transformation', folder_tree_identifier => 'transformation_projects_list', folder_tree_refresh_name => 'refresh_transformation_project_jstree_html' &>
18 <table class="table table-bordered">
22 <th>Breeding Programs -- Folders -- Transformation Projects <button class="btn btn-sm btn-default" id="refresh_transformation_project_jstree_html_trialtree_button" name="refresh_transformation_project_jstree_html">Refresh</button></th>
29 <input type="text" class="form-control input-sm" id="transformation_tree_search" placeholder="Search" />
32 <h5><i>Double click<br />transformation project ( <span class="glyphicon glyphicon-text-width text-success"></span> ) or folder ( <span class="glyphicon glyphicon-folder-open text-danger"></span> )<br/>to view detail page.</i></h5>
33 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
37 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
38 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move transformation project(s) to folder</button><br/><br/>
39 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
41 <div id="folder_edit_options" style="display:none">
43 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
44 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
48 <!--<button id="delete" disabled="disabled" >Delete</button -->
52 <div id="transformation_projects_list" >[loading...]</div>
63 jQuery(document).ready(function($) {
65 jQuery('#create_transformation_project_link').click(function() {
66 var lo = new CXGN.List();
67 get_select_box('years', 'transformation_project_year', {'id':'transformation_project_year_select', 'name':'transformation_project_year_select', 'auto_generate':1});
68 jQuery("#create_transformation_project_dialog").modal("show");
72 url: '/ajax/breeders/get_trials_with_folders_cached?type=transformation',
73 success: function(response) {
74 var html = '<ul>'+response.html+'</ul>';
76 jQuery('#transformation_projects_list').html(html);
77 jQuery('#transformation_projects_list').jstree( {
78 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
79 "valid_children" : [ "folder", "trial", "breeding_program" ],
81 "breeding_program" : {
82 "icon": 'glyphicon glyphicon-briefcase text-info',
85 "icon": 'glyphicon glyphicon-folder-open text-danger',
88 "icon": 'glyphicon glyphicon-text-width text-success',
92 "case_insensitive" : true,
94 "plugins" : ["html_data","types","search"],
97 error: function(response) {
98 alert("An error occurred while loading the transformation project data.");
102 jQuery("#transformation_tree_search").keyup(function() {
103 var v = jQuery("#transformation_tree_search").val();
104 jQuery("#transformation_projects_list").jstree(true).search(v);
107 jQuery('#transformation_projects_list').on("changed.jstree", function (e, data) {
108 if ($('#transformation_projects_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
109 jQuery("#folder_edit_options").show();
112 jQuery("#folder_edit_options").hide();
116 jQuery("#transformation_projects_list").delegate("li", "dblclick", function(event){
117 var node = $("#transformation_projects_list").jstree("get_node", this);
119 if (node.id.substr(0,1) !== 'j') {
120 if (node.type == 'folder') {
121 window.open('/folder/'+node.id);
122 event.stopPropagation();
123 } else if (node.type == 'transformation') {
124 window.open('/breeders_toolbox/trial/'+node.id);
125 event.stopPropagation();