now have a partial fix_dups path, it shows the content in a much more reasonable manner, and allows the GUI to select the files/paths to keep, HOWEVER, the form POST is not enabled, and I still need to process the form data -- right now, now sure how I know which files to delete vs keep -> will need hidden vars of options, not just the to_keep - then process them
This commit is contained in:
72
templates/dups.html
Normal file
72
templates/dups.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{% extends "base.html" %} {% block main_content %}
|
||||
<div class="container-fluid">
|
||||
<h3 class="offset-lg-2">{{page_title}}</h3>
|
||||
<p>Duplicate files have been detected. They have the same binary content,
|
||||
but either have a different name or are stored in two different
|
||||
directories. Choose between the options below. NOTE: after you click
|
||||
'Delete Duplicates', the files / directories in red will be deleted from the file
|
||||
system, those in green will remain</p>
|
||||
|
||||
<script>
|
||||
let D=[]
|
||||
let F=[]
|
||||
</script>
|
||||
<div class="row">
|
||||
<form class="form form-inline col-lg-12" action="" method="POST">
|
||||
{% for dups in per_file_dups %}
|
||||
{% set outer_loop=loop.index %}
|
||||
<div class="col-lg-12 py-4">
|
||||
<h5>Choose between these files:</h5>
|
||||
{% for dup in dups %}
|
||||
<alert id="kf{{outer_loop}}-f{{loop.index}}" style="cursor: pointer;" class="alert"
|
||||
onClick="KeepFile({{outer_loop}},{{loop.index}})">{{dup.d}}/{{dup.f}}</alert>
|
||||
{% if loop.index < dups|length %}
|
||||
or
|
||||
{% endif %}
|
||||
<script>
|
||||
F[{{outer_loop}}{{loop.index}}]="{{dup.f}}"
|
||||
</script>
|
||||
{% endfor %}
|
||||
</div class="col-lg-12">
|
||||
{% endfor %}
|
||||
|
||||
{% for dup in per_path_dups %}
|
||||
<div class="col-lg-12 py-4">
|
||||
<h5>{{dup.count}} duplicate files (same file names in 2 different directories). Choose path to KEEP:</h5>
|
||||
<alert id="kd{{loop.index}}-d1" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 1)" class="alert">{{dup.d1}}</alert> or
|
||||
<alert id="kd{{loop.index}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{dup.d2}}</alert>
|
||||
<input id="kd{{loop.index}}" type="hidden" name="k1" value="{{dup.d2}}">
|
||||
<script>
|
||||
D[{{loop.index}}1]="{{dup.d1}}"
|
||||
D[{{loop.index}}2]="{{dup.d2}}"
|
||||
</script>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<input class="btn btn-danger" type="submit" value="Delete Duplicates">
|
||||
</form>
|
||||
</div class="row">
|
||||
</div class="container">
|
||||
{% endblock main_content %}
|
||||
{% block script_content %}
|
||||
<script>
|
||||
function KeepFile(row, which)
|
||||
{
|
||||
$('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt')
|
||||
$('#kf'+row+'-f'+which).attr('class', 'alert alert-success')
|
||||
$('#kf'+row).val( F[row.toString()] )
|
||||
}
|
||||
|
||||
function KeepDir(row, which)
|
||||
{
|
||||
$('[id^=kd]').attr('class', 'alert alert-danger sm-txt')
|
||||
$('#kd'+row+'-d'+which).attr('class', 'alert alert-success')
|
||||
$('#kd'+row).val( D[row.toString()+which.toString()] )
|
||||
}
|
||||
|
||||
// force choose last of each keep file set
|
||||
$('[id$=f1]').each( function () { $(this).siblings( '.alert' ).last().click() } )
|
||||
// force choose last of each dir set
|
||||
$('[id$=d2]').click()
|
||||
</script>
|
||||
{% endblock script_content %}
|
||||
Reference in New Issue
Block a user