— Mass delete button in "My images" page (#47)

This commit is contained in:
Luc Didry
2023-12-30 08:29:09 +01:00
parent 81701b6f60
commit 0617683c63
7 changed files with 61 additions and 26 deletions
+1
View File
@@ -4,6 +4,7 @@ Revision history for Lutim
- 🐛 — AVIF format support (#139)
- ✨ — Allow to configure the directory where to store the images (#125)
- ✨ — Ask for confirmation before deleting image on index page (#92)
- ✨ — Mass delete button in "My images" page (#47)
0.16.0 2023-12-29
- ⬆️ Update jQuery
+17 -13
View File
@@ -39,7 +39,7 @@ msgstr "1 year"
msgid "24 hours"
msgstr "24 hours"
#: themes/default/templates/partial/myfiles.js.ep:244
#: themes/default/templates/partial/myfiles.js.ep:245
msgid ": Error while trying to get the counter."
msgstr ": Error while trying to get the counter."
@@ -63,7 +63,7 @@ msgstr "Archives download"
msgid "Are you sure you want to delete the image ${short}?"
msgstr "Are you sure you want to delete the image ${short}?"
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:129 themes/default/templates/stats.html.ep:25
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:130 themes/default/templates/stats.html.ep:25
msgid "Back to homepage"
msgstr "Back to homepage"
@@ -91,11 +91,11 @@ msgstr "Copied to clipboard"
msgid "Copy all view links to clipboard"
msgstr "Copy all view links to clipboard"
#: themes/default/templates/index.html.ep:104 themes/default/templates/index.html.ep:16 themes/default/templates/index.html.ep:32 themes/default/templates/index.html.ep:48 themes/default/templates/index.html.ep:80 themes/default/templates/index.html.ep:88 themes/default/templates/index.html.ep:96 themes/default/templates/myfiles.html.ep:66 themes/default/templates/myfiles.html.ep:82 themes/default/templates/myfiles.html.ep:98 themes/default/templates/partial/common.js.ep:206 themes/default/templates/partial/lutim.js.ep:110 themes/default/templates/partial/lutim.js.ep:70 themes/default/templates/partial/lutim.js.ep:82 themes/default/templates/partial/lutim.js.ep:96 themes/default/templates/partial/myfiles.js.ep:182
#: themes/default/templates/index.html.ep:104 themes/default/templates/index.html.ep:16 themes/default/templates/index.html.ep:32 themes/default/templates/index.html.ep:48 themes/default/templates/index.html.ep:80 themes/default/templates/index.html.ep:88 themes/default/templates/index.html.ep:96 themes/default/templates/myfiles.html.ep:66 themes/default/templates/myfiles.html.ep:82 themes/default/templates/myfiles.html.ep:98 themes/default/templates/partial/common.js.ep:209 themes/default/templates/partial/lutim.js.ep:110 themes/default/templates/partial/lutim.js.ep:70 themes/default/templates/partial/lutim.js.ep:82 themes/default/templates/partial/lutim.js.ep:96 themes/default/templates/partial/myfiles.js.ep:183
msgid "Copy to clipboard"
msgstr "Copy to clipboard"
#: themes/default/templates/myfiles.html.ep:117
#: themes/default/templates/myfiles.html.ep:118
msgid "Counter"
msgstr "Counter"
@@ -107,10 +107,14 @@ msgstr "Delay repartition chart for disabled images"
msgid "Delay repartition chart for enabled images"
msgstr "Delay repartition chart for enabled images"
#: themes/default/templates/index.html.ep:126 themes/default/templates/index.html.ep:158 themes/default/templates/index.html.ep:202 themes/default/templates/myfiles.html.ep:118 themes/default/templates/myfiles.html.ep:45 themes/default/templates/partial/lutim.js.ep:150
#: themes/default/templates/index.html.ep:126 themes/default/templates/index.html.ep:158 themes/default/templates/index.html.ep:202 themes/default/templates/myfiles.html.ep:119 themes/default/templates/myfiles.html.ep:45 themes/default/templates/partial/lutim.js.ep:150
msgid "Delete at first view?"
msgstr "Delete at first view?"
#: themes/default/templates/myfiles.html.ep:109
msgid "Delete selected images"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:152 themes/default/templates/raw.html.ep:4
msgid "Deleted images"
msgstr "Deleted images"
@@ -119,7 +123,7 @@ msgstr "Deleted images"
msgid "Deleted images in 30 days"
msgstr "Deleted images in 30 days"
#: themes/default/templates/index.html.ep:109 themes/default/templates/myfiles.html.ep:121 themes/default/templates/partial/common.js.ep:192 themes/default/templates/partial/common.js.ep:197
#: themes/default/templates/index.html.ep:109 themes/default/templates/myfiles.html.ep:122 themes/default/templates/partial/common.js.ep:195 themes/default/templates/partial/common.js.ep:200
msgid "Deletion link"
msgstr "Deletion link"
@@ -147,7 +151,7 @@ msgstr "Drag and drop an image in the appropriate area or use the traditional wa
msgid "Encrypt the image (Lutim does not keep the key)."
msgstr "Encrypt the image (Lutim does not keep the key)."
#: themes/default/templates/partial/lutim.js.ep:38 themes/default/templates/partial/myfiles.js.ep:128
#: themes/default/templates/partial/lutim.js.ep:38 themes/default/templates/partial/myfiles.js.ep:129
msgid "Error while trying to modify the image."
msgstr "Error while trying to modify the image."
@@ -155,7 +159,7 @@ msgstr "Error while trying to modify the image."
msgid "Evolution of total files"
msgstr "Evolution of total files"
#: themes/default/templates/myfiles.html.ep:120
#: themes/default/templates/myfiles.html.ep:121
msgid "Expires at"
msgstr "Expires at"
@@ -163,7 +167,7 @@ msgstr "Expires at"
msgid "Export localStorage data"
msgstr "Export localStorage data"
#: themes/default/templates/myfiles.html.ep:115
#: themes/default/templates/myfiles.html.ep:116
msgid "File name"
msgstr "File name"
@@ -287,7 +291,7 @@ msgstr "Main developers"
msgid "Markdown syntax"
msgstr "Markdown syntax"
#: themes/default/templates/partial/myfiles.js.ep:199
#: themes/default/templates/partial/myfiles.js.ep:200
msgid "Modify expiration delay"
msgstr "Modify expiration delay"
@@ -299,7 +303,7 @@ msgstr "My images"
msgid "Next (arrow right)"
msgstr "Next (arrow right)"
#: themes/default/templates/partial/myfiles.js.ep:120 themes/default/templates/partial/myfiles.js.ep:162
#: themes/default/templates/partial/myfiles.js.ep:121 themes/default/templates/partial/myfiles.js.ep:163
msgid "No limit"
msgstr "No limit"
@@ -498,7 +502,7 @@ msgstr "Unlike many image sharing services, you don't give us rights on uploaded
msgid "Upload an image with its URL"
msgstr "Upload an image with its URL"
#: themes/default/templates/myfiles.html.ep:119
#: themes/default/templates/myfiles.html.ep:120
msgid "Uploaded at"
msgstr "Uploaded at"
@@ -511,7 +515,7 @@ msgstr "Uploaded files by days"
msgid "Uploading is currently disabled, please try later or contact the administrator (%1)."
msgstr "Uploading is currently disabled, please try later or contact the administrator (%1)."
#: themes/default/templates/index.html.ep:76 themes/default/templates/index.html.ep:78 themes/default/templates/myfiles.html.ep:116 themes/default/templates/partial/lutim.js.ep:62 themes/default/templates/partial/lutim.js.ep:66
#: themes/default/templates/index.html.ep:76 themes/default/templates/index.html.ep:78 themes/default/templates/myfiles.html.ep:117 themes/default/templates/partial/lutim.js.ep:62 themes/default/templates/partial/lutim.js.ep:66
msgid "View link"
msgstr "View link"
+17 -13
View File
@@ -40,7 +40,7 @@ msgstr ""
msgid "24 hours"
msgstr ""
#: themes/default/templates/partial/myfiles.js.ep:244
#: themes/default/templates/partial/myfiles.js.ep:245
msgid ": Error while trying to get the counter."
msgstr ""
@@ -64,7 +64,7 @@ msgstr ""
msgid "Are you sure you want to delete the image ${short}?"
msgstr ""
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:129 themes/default/templates/stats.html.ep:25
#: themes/default/templates/about.html.ep:44 themes/default/templates/myfiles.html.ep:130 themes/default/templates/stats.html.ep:25
msgid "Back to homepage"
msgstr ""
@@ -92,11 +92,11 @@ msgstr ""
msgid "Copy all view links to clipboard"
msgstr ""
#: themes/default/templates/index.html.ep:104 themes/default/templates/index.html.ep:16 themes/default/templates/index.html.ep:32 themes/default/templates/index.html.ep:48 themes/default/templates/index.html.ep:80 themes/default/templates/index.html.ep:88 themes/default/templates/index.html.ep:96 themes/default/templates/myfiles.html.ep:66 themes/default/templates/myfiles.html.ep:82 themes/default/templates/myfiles.html.ep:98 themes/default/templates/partial/common.js.ep:206 themes/default/templates/partial/lutim.js.ep:110 themes/default/templates/partial/lutim.js.ep:70 themes/default/templates/partial/lutim.js.ep:82 themes/default/templates/partial/lutim.js.ep:96 themes/default/templates/partial/myfiles.js.ep:182
#: themes/default/templates/index.html.ep:104 themes/default/templates/index.html.ep:16 themes/default/templates/index.html.ep:32 themes/default/templates/index.html.ep:48 themes/default/templates/index.html.ep:80 themes/default/templates/index.html.ep:88 themes/default/templates/index.html.ep:96 themes/default/templates/myfiles.html.ep:66 themes/default/templates/myfiles.html.ep:82 themes/default/templates/myfiles.html.ep:98 themes/default/templates/partial/common.js.ep:209 themes/default/templates/partial/lutim.js.ep:110 themes/default/templates/partial/lutim.js.ep:70 themes/default/templates/partial/lutim.js.ep:82 themes/default/templates/partial/lutim.js.ep:96 themes/default/templates/partial/myfiles.js.ep:183
msgid "Copy to clipboard"
msgstr ""
#: themes/default/templates/myfiles.html.ep:117
#: themes/default/templates/myfiles.html.ep:118
msgid "Counter"
msgstr ""
@@ -108,10 +108,14 @@ msgstr ""
msgid "Delay repartition chart for enabled images"
msgstr ""
#: themes/default/templates/index.html.ep:126 themes/default/templates/index.html.ep:158 themes/default/templates/index.html.ep:202 themes/default/templates/myfiles.html.ep:118 themes/default/templates/myfiles.html.ep:45 themes/default/templates/partial/lutim.js.ep:150
#: themes/default/templates/index.html.ep:126 themes/default/templates/index.html.ep:158 themes/default/templates/index.html.ep:202 themes/default/templates/myfiles.html.ep:119 themes/default/templates/myfiles.html.ep:45 themes/default/templates/partial/lutim.js.ep:150
msgid "Delete at first view?"
msgstr ""
#: themes/default/templates/myfiles.html.ep:109
msgid "Delete selected images"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:152 themes/default/templates/raw.html.ep:4
msgid "Deleted images"
msgstr ""
@@ -120,7 +124,7 @@ msgstr ""
msgid "Deleted images in 30 days"
msgstr ""
#: themes/default/templates/index.html.ep:109 themes/default/templates/myfiles.html.ep:121 themes/default/templates/partial/common.js.ep:192 themes/default/templates/partial/common.js.ep:197
#: themes/default/templates/index.html.ep:109 themes/default/templates/myfiles.html.ep:122 themes/default/templates/partial/common.js.ep:195 themes/default/templates/partial/common.js.ep:200
msgid "Deletion link"
msgstr ""
@@ -148,7 +152,7 @@ msgstr ""
msgid "Encrypt the image (Lutim does not keep the key)."
msgstr ""
#: themes/default/templates/partial/lutim.js.ep:38 themes/default/templates/partial/myfiles.js.ep:128
#: themes/default/templates/partial/lutim.js.ep:38 themes/default/templates/partial/myfiles.js.ep:129
msgid "Error while trying to modify the image."
msgstr ""
@@ -156,7 +160,7 @@ msgstr ""
msgid "Evolution of total files"
msgstr ""
#: themes/default/templates/myfiles.html.ep:120
#: themes/default/templates/myfiles.html.ep:121
msgid "Expires at"
msgstr ""
@@ -164,7 +168,7 @@ msgstr ""
msgid "Export localStorage data"
msgstr ""
#: themes/default/templates/myfiles.html.ep:115
#: themes/default/templates/myfiles.html.ep:116
msgid "File name"
msgstr ""
@@ -288,7 +292,7 @@ msgstr ""
msgid "Markdown syntax"
msgstr ""
#: themes/default/templates/partial/myfiles.js.ep:199
#: themes/default/templates/partial/myfiles.js.ep:200
msgid "Modify expiration delay"
msgstr ""
@@ -300,7 +304,7 @@ msgstr ""
msgid "Next (arrow right)"
msgstr ""
#: themes/default/templates/partial/myfiles.js.ep:120 themes/default/templates/partial/myfiles.js.ep:162
#: themes/default/templates/partial/myfiles.js.ep:121 themes/default/templates/partial/myfiles.js.ep:163
msgid "No limit"
msgstr ""
@@ -495,7 +499,7 @@ msgstr ""
msgid "Upload an image with its URL"
msgstr ""
#: themes/default/templates/myfiles.html.ep:119
#: themes/default/templates/myfiles.html.ep:120
msgid "Uploaded at"
msgstr ""
@@ -508,7 +512,7 @@ msgstr ""
msgid "Uploading is currently disabled, please try later or contact the administrator (%1)."
msgstr ""
#: themes/default/templates/index.html.ep:76 themes/default/templates/index.html.ep:78 themes/default/templates/myfiles.html.ep:116 themes/default/templates/partial/lutim.js.ep:62 themes/default/templates/partial/lutim.js.ep:66
#: themes/default/templates/index.html.ep:76 themes/default/templates/index.html.ep:78 themes/default/templates/myfiles.html.ep:117 themes/default/templates/partial/lutim.js.ep:62 themes/default/templates/partial/lutim.js.ep:66
msgid "View link"
msgstr ""
+1
View File
@@ -110,6 +110,7 @@ $('document').ready(function() {
$('#import').on('change', function() { importStorage(this.files); })
$('#mod-delay').on('click', modifyDelay);
$('#check-all').on('click', checkAll)
$('#mass-delete').on('click', massDelete);
}
$('.copy-to-clipboard-link').on('click', clickOnCopyLink);
$('.copy-all-to-clipboard-link').on('click', copyAllToClipboard);
+1
View File
@@ -106,6 +106,7 @@
<a href="#" id="json-export" class="btn btn-info"><%= l('Export localStorage data') %></a>
<a href="#" id="json-import" class="btn btn-info"><%= l('Import localStorage data') %></a>
<input type="file" class="hidden" id="import">
<a href="#" id="mass-delete" class="btn btn-info" disabled><%= l('Delete selected images') %></a>
</div>
<div class="table-responsive">
<table class="table table-hover">
@@ -177,6 +177,9 @@ function delImageRequest(short, token) {
error: function() {
},
complete: function() {
if (typeof evaluateMassDelete === "function") {
evaluateMassDelete();
}
}
});
}
@@ -54,6 +54,7 @@ function itemExists(name) {
}
function onCheck(e) {
e.preventDefault();
evaluateMassDelete();
var short = $(this).data('short');
var ext = $(this).data('ext');
if ($(this).is(':checked')) {
@@ -248,3 +249,23 @@ function populateFilesTable() {
$('input.ckbx[type="checkbox"]').on('change', onCheck);
$('.copy-to-clipboard').on('click', copyLink);
}
function evaluateMassDelete() {
if ($('input.ckbx:checked').length > 0) {
$('#mass-delete').removeAttr('disabled');
$('#mass-delete').removeClass('disabled');
} else {
$('#mass-delete').attr('disabled');
$('#mass-delete').addClass('disabled');
}
}
function massDelete(event) {
event.preventDefault();
$('input.ckbx:checked').each(delIm);
}
function delIm() {
var short = $(this).attr('data-short');
$(`#del-${short}`).click();
}