Skip to content

Commit

Permalink
🔥: drop jquery dynatree usage
Browse files Browse the repository at this point in the history
  • Loading branch information
itisAliRH committed Oct 8, 2024
1 parent 73cf966 commit e9cf7d5
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 125 deletions.
1 change: 0 additions & 1 deletion client/src/libs/jquery.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require("imports-loader?imports=default|jqueryVendor|jQuery!libs/jquery/select2"
require("imports-loader?imports=default|jqueryVendor|jQuery!libs/jquery/jquery-ui");
require("imports-loader?imports=default|jqueryVendor|jQuery!libs/farbtastic");
// TODO: ensure unused
require("imports-loader?imports=default|jqueryVendor|jQuery!libs/jquery/jquery.dynatree");
require("imports-loader?imports=default|jqueryVendor|jQuery!jquery-migrate");

// Only used in reports
Expand Down
1 change: 0 additions & 1 deletion lib/tool_shed/util/shed_util_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ def open_repository_files_folder(
)
if filename:
if os.path.isdir(full_path) and path_is_browsable:
# Append a '/' character so that our jquery dynatree will function properly.
filename = f"{filename}/"
full_path = f"{full_path}/"
is_folder = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<%def name="stylesheets()">
${parent.stylesheets()}
${h.css( "dynatree_skin/ui.dynatree" )}
</%def>

<%def name="javascripts()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,6 @@
<script type="text/javascript">
config.addInitialization(function() {
console.log("common.mako, common_javascripts");
// --- Initialize sample trees
$("#tree").dynatree({
title: "${repository.name}",
minExpandLevel: 1,
persist: false,
checkbox: true,
selectMode: 3,
onPostInit: function(isReloading, isError) {
// Re-fire onActivate, so the text is updated
this.reactivate();
},
fx: { height: "toggle", duration: 200 },
// initAjax is hard to fake, so we pass the children as object array:
initAjax: {url: "${h.url_for( controller='repository', action='open_folder' )}",
dataType: "json",
data: { folder_path: "${repository.repo_path( trans.app )}", repository_id: "${trans.security.encode_id( repository.id )}" },
},
onLazyRead: function(dtnode){
dtnode.appendAjax({
url: "${h.url_for( controller='repository', action='open_folder' )}",
dataType: "json",
data: { folder_path: dtnode.data.key, repository_id: "${trans.security.encode_id( repository.id )}" },
});
},
onSelect: function(select, dtnode) {
// Display list of selected nodes
var selNodes = dtnode.tree.getSelectedNodes();
// convert to title/key array
var selKeys = $.map(selNodes, function(node) {
return node.data.key;
});
},
onActivate: function(dtnode) {
var cell = $("#file_contents");
var selected_value;
if (dtnode.data.key == 'root') {
selected_value = "${repository.repo_path( trans.app )}/";
} else {
selected_value = dtnode.data.key;
};
if (selected_value.charAt(selected_value.length-1) != '/') {
// Make ajax call
$.ajax( {
type: "POST",
url: "${h.url_for( controller='repository', action='get_file_contents' )}",
dataType: "json",
data: { file_path: selected_value, repository_id: "${trans.security.encode_id( repository.id )}" },
success : function ( data ) {
cell.html( '<label>'+data+'</label>' )
}
});
} else {
cell.html( '' );
};
},
});
});
</script>
</%def>
Expand Down
65 changes: 0 additions & 65 deletions templates/webapps/tool_shed/repository/common.mako
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,6 @@
<script type="text/javascript">
config.addInitialization(function() {
console.log("common.mako, common_javascripts");
// --- Initialize sample trees
$("#tree").dynatree({
title: "${repository.name}",
minExpandLevel: 1,
persist: false,
checkbox: true,
selectMode: 3,
onPostInit: function(isReloading, isError) {
// Re-fire onActivate, so the text is updated
this.reactivate();
},
fx: { height: "toggle", duration: 200 },
// initAjax is hard to fake, so we pass the children as object array:
initAjax: {url: "${h.url_for( controller='repository', action='open_folder' )}",
dataType: "json",
data: { folder_path: "${repository.repo_path( trans.app )}", repository_id: "${trans.security.encode_id( repository.id )}" },
},
onLazyRead: function(dtnode){
dtnode.appendAjax({
url: "${h.url_for( controller='repository', action='open_folder' )}",
dataType: "json",
data: { folder_path: dtnode.data.key, repository_id: "${trans.security.encode_id( repository.id )}" },
});
},
onSelect: function(select, dtnode) {
// Display list of selected nodes
var selNodes = dtnode.tree.getSelectedNodes();
// convert to title/key array
var selKeys = $.map(selNodes, function(node) {
return node.data.key;
});
if (document.forms["select_files_to_delete"]) {
// The following is used only ~/templates/webapps/tool_shed/repository/browse_repository.mako.
document.select_files_to_delete.selected_files_to_delete.value = selKeys.join(",");
}
// The following is used only in ~/templates/webapps/tool_shed/repository/upload.mako.
if (document.forms["upload_form"]) {
document.upload_form.upload_point.value = selKeys.slice(-1);
}
},
onActivate: function(dtnode) {
var cell = $("#file_contents");
var selected_value;
if (dtnode.data.key == 'root') {
selected_value = "${repository.repo_path( trans.app )}/";
} else {
selected_value = dtnode.data.key;
};
if (selected_value.charAt(selected_value.length-1) != '/') {
// Make ajax call
$.ajax( {
type: "POST",
url: "${h.url_for( controller='repository', action='get_file_contents' )}",
dataType: "json",
data: { file_path: selected_value, repository_id: "${trans.security.encode_id( repository.id )}" },
success : function ( data ) {
cell.html( '<label>'+data+'</label>' )
}
});
} else {
cell.html( '' );
};
},
});
});
</script>
</%def>
Expand Down

0 comments on commit e9cf7d5

Please sign in to comment.