started hooking up right-click menu for Dir and Files all the way through to calling the new ScanFileForPerson() - which is still incomplete but does use the new Faces DB linkages and functions
This commit is contained in:
@@ -222,7 +222,7 @@
|
||||
{% endif %}
|
||||
{# if this dir is the toplevel of the cwd, show the folder icon #}
|
||||
{% if dirname| TopLevelFolderOf(cwd) %}
|
||||
<figure class="px-1 dir" dir="{{dirname}}">
|
||||
<figure class="px-1 dir" id={{obj.id}} dir="{{dirname}}">
|
||||
<i style="font-size:{{size|int-22}};" class="fas fa-folder"></i>
|
||||
<figcaption class="figure-caption text-center text-wrap text-break">{{obj.name}}</figcaption>
|
||||
</figure class="figure">
|
||||
@@ -270,6 +270,13 @@ function GetSelnAsData()
|
||||
return to_del
|
||||
}
|
||||
|
||||
function RunAIOnSeln(person)
|
||||
{
|
||||
post_data = GetSelnAsData()
|
||||
post_data += '&person='+person.replace('ai-','')
|
||||
$.ajax({ type: 'POST', data: post_data, url: '/run_ai_on', success: function(data){ window.location='/'; return false; } })
|
||||
}
|
||||
|
||||
function DelDBox(del_or_undel)
|
||||
{
|
||||
to_del = GetSelnAsData()
|
||||
@@ -457,6 +464,34 @@ function NoSel() {
|
||||
$('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; });
|
||||
$(document).on('click', function(e) { $('.highlight').removeClass('highlight') ; SetButtonState() });
|
||||
|
||||
|
||||
// different context menu on directory
|
||||
$.contextMenu({
|
||||
selector: '.dir',
|
||||
build: function($triggerElement, e){
|
||||
if( NoSel() )
|
||||
DoSel(e, e.currentTarget )
|
||||
item_list = {
|
||||
ai: {
|
||||
name: "Scan file for faces",
|
||||
items: {
|
||||
{% for p in people %}
|
||||
"ai-{{p.tag}}": {"name": "{{p.tag}}"},
|
||||
{% endfor %}
|
||||
"ai-all": {"name": "all"},
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
callback: function( key, options) {
|
||||
if( key.startsWith("ai")) { RunAIOnSeln(key) }
|
||||
},
|
||||
items: item_list
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// different context menu on files
|
||||
$.contextMenu({
|
||||
selector: '.figure',
|
||||
build: function($triggerElement, e){
|
||||
@@ -474,6 +509,7 @@ $.contextMenu({
|
||||
{% for p in people %}
|
||||
"ai-{{p.tag}}": {"name": "{{p.tag}}"},
|
||||
{% endfor %}
|
||||
"ai-all": {"name": "all"},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -493,7 +529,7 @@ $.contextMenu({
|
||||
if( key == "move" ) { MoveDBox() }
|
||||
if( key == "del" ) { DelDBox('Delete') }
|
||||
if( key == "undel" ) { DelDBox('Restore') }
|
||||
if( key.startsWith("ai")) { console.log( key +'was chosen')}
|
||||
if( key.startsWith("ai")) { RunAIOnSeln(key) }
|
||||
},
|
||||
items: item_list
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user