Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Directory Delete #1241

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ function performLfmRequest(url, parameter, type) {
});
}

$('#notify').modal('hide');
$('#dialog').modal('hide');

return $.ajax({
type: 'GET',
beforeSend: function(request) {
Expand All @@ -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('<br>')
}
Expand Down Expand Up @@ -799,21 +802,25 @@ 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) {
$('#dialog').find('input').val(value);
$('#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);
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/DeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getDelete()
}

if ($this->lfm->setName($name_to_delete)->isDirectory()) {
if (! $this->lfm->setName($name_to_delete)->directoryIsEmpty()) {
if ($this->config->get('lfm.allow_delete_folder') === false && !$this->lfm->setName($name_to_delete)->directoryIsEmpty()) {
array_push($errors, parent::error('delete-folder'));
continue;
}
Expand Down
1 change: 1 addition & 0 deletions src/config/lfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,

'allow_shared_folder' => true,
'allow_delete_folder' => true,

'shared_folder_name' => 'shares',

Expand Down
8 changes: 4 additions & 4 deletions src/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<div id="fab"></div>
</div>

<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down Expand Up @@ -135,7 +135,7 @@
</div>
</div>

<div class="modal fade" id="notify" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal" id="notify" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body"></div>
Expand All @@ -146,7 +146,7 @@
</div>
</div>

<div class="modal fade" id="confirm" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal" id="confirm" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body"></div>
Expand All @@ -158,7 +158,7 @@
</div>
</div>

<div class="modal fade" id="dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal" id="dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
Expand Down