From 5b23772abdf10ab40d48afa448bb58d61317c150 Mon Sep 17 00:00:00 2001 From: Amid Esfahani Date: Sun, 14 Jul 2024 00:14:50 +0330 Subject: [PATCH 1/2] fix delete bug --- public/js/script.js | 17 ++++++++++++----- src/config/lfm.php | 1 + src/views/index.blade.php | 8 ++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index fd527de4..bd681f0e 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -266,6 +266,9 @@ function performLfmRequest(url, parameter, type) { }); } + $('#notify').modal('hide'); + $('#dialog').modal('hide'); + return $.ajax({ type: 'GET', beforeSend: function(request) { @@ -284,7 +287,7 @@ function performLfmRequest(url, parameter, type) { } function displayErrorResponse(jqXHR) { - var message = JSON.parse(jqXHR.responseText) + var message = JSON.parse(jqXHR.responseText) ?? '' if (Array.isArray(message)) { message = message.join('
') } @@ -799,13 +802,17 @@ function notImp() { } function notify(body) { + $('#notify').find('.btn-primary').off('click').hide(); $('#notify').modal('show').find('.modal-body').html(body); + if (!$('#notify').hasClass('show')) { + $('#notify').modal('show'); + } } function confirm(body, callback) { - $('#confirm').find('.btn-primary').toggle(callback !== undefined); - $('#confirm').find('.btn-primary').click(callback); - $('#confirm').modal('show').find('.modal-body').html(body); + $('#notify').find('.btn-primary').toggle(callback !== undefined); + $('#notify').find('.btn-primary').on('click', callback); + $('#notify').modal('show').find('.modal-body').html(body); } function dialog(title, value, callback) { @@ -813,7 +820,7 @@ function dialog(title, value, callback) { $('#dialog').on('shown.bs.modal', function () { $('#dialog').find('input').focus(); }); - $('#dialog').find('.btn-primary').unbind().click(function (e) { + $('#dialog').find('.btn-primary').off('click').on('click', function (e) { callback($('#dialog').find('input').val()); }); $('#dialog').modal('show').find('.modal-title').text(title); diff --git a/src/config/lfm.php b/src/config/lfm.php index 70e7fd3f..28b6d687 100644 --- a/src/config/lfm.php +++ b/src/config/lfm.php @@ -36,6 +36,7 @@ 'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class, 'allow_shared_folder' => true, + 'allow_delete_folder' => true, 'shared_folder_name' => 'shares', diff --git a/src/views/index.blade.php b/src/views/index.blade.php index dbcb83b0..36187934 100644 --- a/src/views/index.blade.php +++ b/src/views/index.blade.php @@ -107,7 +107,7 @@
-