aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-12-21 21:37:10 +0000
committerMario <mario@mariovavti.com>2020-12-21 21:37:10 +0000
commitd118ab71e6aa4f300ba6e42663d13a63a2323122 (patch)
tree08282fa1dfb0a2f975fd9d338df7677fa84ea5e9 /view/js
parent81a1aedeb9a4e07c3d1e11905ad3e2434d635e86 (diff)
downloadvolse-hubzilla-d118ab71e6aa4f300ba6e42663d13a63a2323122.tar.gz
volse-hubzilla-d118ab71e6aa4f300ba6e42663d13a63a2323122.tar.bz2
volse-hubzilla-d118ab71e6aa4f300ba6e42663d13a63a2323122.zip
files_ng: implement directory and bulk file download
Diffstat (limited to 'view/js')
-rw-r--r--view/js/mod_cloud.js43
1 files changed, 42 insertions, 1 deletions
diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js
index cbd9c2a08..736dec471 100644
--- a/view/js/mod_cloud.js
+++ b/view/js/mod_cloud.js
@@ -56,6 +56,24 @@ $(document).ready(function () {
close_and_deactivate_all_panels();
});
+ $('.cloud-tool-dir-download-btn').on('click', function (e) {
+ e.preventDefault();
+ close_and_deactivate_all_panels()
+
+ let id = $(this).data('id');
+ if(! id) {
+ return false;
+ }
+
+ close_and_deactivate_all_panels();
+
+ // some trickery to trigger download action via ajax
+ let form = $('<form></form>').attr('action', 'attach').attr('method', 'post');
+ form.append($("<input></input>").attr('type', 'hidden').attr('name', 'channel_id').attr('value', channelId));
+ form.append($("<input></input>").attr('type', 'hidden').attr('name', 'attach_ids[]').attr('value', id));
+ form.appendTo('body').submit().remove();
+ });
+
$('.cloud-tool-delete-btn').on('click', function (e) {
e.preventDefault();
let id = $(this).data('id');
@@ -255,14 +273,37 @@ $(document).ready(function () {
$('#cloud-multi-tool-submit, #cloud-multi-tool-categories').show();
});
+ $('#cloud-multi-tool-download-btn').on('click', function (e) {
+ e.preventDefault();
+
+ let post_data = $('.cloud-multi-tool-checkbox:checked');
+
+ if(! post_data.length) {
+ return false;
+ }
+
+ close_and_deactivate_all_panels();
+
+ // some trickery to trigger download action via ajax
+ var form = $('<form></form>').attr('action', 'attach').attr('method', 'post');
+ form.append($("<input></input>").attr('type', 'hidden').attr('name', 'channel_id').attr('value', channelId));
+ post_data.each(function () {
+ form.append($("<input></input>").attr('type', 'hidden').attr('name', 'attach_ids[]').attr('value', this.value));
+ });
+ form.appendTo('body').submit().remove();
+ });
+
$('#cloud-multi-tool-delete-btn').on('click', function (e) {
e.preventDefault();
- let post_data = $('.cloud-multi-tool-checkbox').serializeArray();
+ close_and_deactivate_all_panels();
+
+ let post_data = $('.cloud-multi-tool-checkbox:checked').serializeArray();
if(! post_data.length) {
return false;
}
+
let confirm = confirmDelete();
if (confirm) {
$('body').css('cursor', 'wait');