aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/mod_cloud.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/mod_cloud.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');