From 7c3c8977d6e3dc9a3db422cdc83e8548b5118666 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 13 Jun 2021 22:14:35 +1000 Subject: [PATCH] refined right-click seln. If you have one or more highlights, dont mess with them. If you have none, then select the one you are over. Also finished TODO for view details menu option --- TODO | 1 - templates/files.html | 42 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 8443a3d..3fe5023 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ ## GENERAL - * GUI and routes for View Details... in contextMenu * AddJobForLog can absorb DEBUGs, etc. in fact fix up logging in general * comment your code * more OO goodness :) diff --git a/templates/files.html b/templates/files.html index 73e6f68..c2249a1 100644 --- a/templates/files.html +++ b/templates/files.html @@ -161,7 +161,7 @@ {% endif %} {% if obj.type.name != "Directory" %} {% if (not folders) or ((obj.in_dir.in_path.path_prefix+'/'+obj.in_dir.rel_path+'/'+obj.name) | TopLevelFolderOf(cwd)) %} -
+
{% if obj.type.name=="Image" %}
@@ -260,6 +260,32 @@ function DelDBox(del_or_undel) $('#dbox').modal('show') } +function DetailsDBox() +{ + $('#dbox-title').html('Details of Selected File(s)') + var div ='
' + $('.highlight').each(function( index ) { + div += "
Name:
" + $(this).attr('fname') + "
" + div += "
Date:
" + $(this).attr('pretty_date') + "
" + dir = $(this).attr('in_dir') + if( dir.slice(-1) != "/" ) + dir=dir.concat('/') + div += "
Dir:
" + dir + "
" + div += "
Size:
" + $(this).attr('size') + " MB
" + div += "
Hash:
" + $(this).attr('hash') + "
" + div += "
Path Type:
" + $(this).attr('path_type') + "
" + } ) + div += ` +
+
+
+ +
+ ` + $('#dbox-content').html(div) + $('#dbox').modal('show') +} + function MoveDBox() { $('#dbox-title').html('Move Selected File(s) to new directory in Storage Path') @@ -363,13 +389,24 @@ function SelContainsBinAndNotBin() { return false } +function NoSel() { + var sel=false + $('.highlight').each(function( index ) { sel=true } ) + // func looks for No Selection, so if sel is true and we have a sel, return false (i.e. NOT No Sel -> Sel ) + if( sel ) + return false + else + return true +} + $('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; }); $(document).on('click', function(e) { $('.highlight').removeClass('highlight') ; SetButtonState() }); $.contextMenu({ selector: '.figure', build: function($triggerElement, e){ - var tst; + if( NoSel() ) + DoSel(e, e.currentTarget ) item_list = { details: { name: "Details..." }, view: { name: "View File" }, @@ -387,6 +424,7 @@ $.contextMenu({ return { callback: function( key, options) { + if( key == "details" ) { DetailsDBox() } if( key == "view" ) { document.location.href = $(this).find('a').attr('href'); } if( key == "move" ) { MoveDBox() } if( key == "del" ) { DelDBox('Delete') }