From 804c7cbf5609d0113d60ffe2b03e79850ebcdd91 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 10 Jun 2021 17:45:08 +1000 Subject: [PATCH] made trash icon be red/Delete or green/Restore for GUI, plumbed this through modified DelDBox() and hooked it all so that you can either click the button, or right-click context menu and you will get the right del/restore dbox and that routes through via ajax to the right URL and actually deletes/restores. Also tweaked right-click to start context menu so that it is also a way to alter highlighting -- this honours ctrl and shift too --- templates/files.html | 48 ++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/templates/files.html b/templates/files.html index fc0f84d..88347b4 100644 --- a/templates/files.html +++ b/templates/files.html @@ -17,7 +17,6 @@ {% set tmp_path=cwd | replace( "static/Storage", "" ) + "/" %} {% else %} - {% set tmp_path=cwd | replace( "static/Bin", "" ) + "/" %} {% endif %} {{tmp_path}} @@ -47,7 +46,14 @@
- + {% if "files_rbp" in request.url %} +
@@ -224,22 +230,26 @@ function GetSelnAsData() return to_del } -function DelDBox() +function DelDBox(del_or_undel) { + console.log(del_or_undel) to_del = GetSelnAsData() - console.log(to_del) - $('#dbox-title').html('Delete Selected File(s)') - div =` -
-

Delete the following files?

-
` + $('#dbox-title').html(del_or_undel+' Selected File(s)') + div ='

' + del_or_undel + ' the following files?

' div+=GetSelnAsDiv() - div+=` -
+ div+=`
- + ` + div+=` +
` $('#dbox-content').html(div) @@ -295,6 +305,8 @@ function ChangeSize(clicked_button,sz) // whether you click after highlight or before function DoSel(e, el) { + console.log(e) + console.log(el) if( e.ctrlKey ) { $(el).toggleClass('highlight') @@ -321,6 +333,7 @@ $(document).on('click', function(e) { $('.highlight').removeClass('highlight') } $.contextMenu({ selector: '.figure', build: function($triggerElement, e){ + DoSel(e, e.currentTarget ) if (e.currentTarget.getAttribute('path_type') == 'Bin' ) { item_list = { details: { name: "Details..." }, @@ -343,9 +356,10 @@ $.contextMenu({ callback: function( key, options) { console.log( $(this).attr('id') ) console.log( $(this).attr('path_type') ) - if( key == "view" ) { - document.location.href = $(this).find('a').attr('href'); - } + if( key == "view" ) { document.location.href = $(this).find('a').attr('href'); } + if( key == "move" ) { MoveDBox() } + if( key == "del" ) { DelDBox('Delete') } + if( key == "undel" ) { DelDBox('Restore') } }, items: item_list };