Better file deletion confirmation (shows file to be deleted)

This commit is contained in:
Dane Everitt 2016-09-07 16:12:17 -04:00
parent 228d6b1b21
commit 36c139d33d
2 changed files with 6 additions and 4 deletions

View file

@ -98,14 +98,16 @@
// Handle Deleting Files
function reloadActionDelete () {
$('a.delete_file').click(function (e) {
$('[data-action="delete_file"]').click(function (e) {
e.preventDefault();
var clicked = $(this);
var deleteItemPath = $(this).attr('href');
swal({
type: 'warning',
title: 'Really Delete this File?',
title: '',
text: 'Are you sure you want to delete <code>' + clicked.data('name') + '</code>?',
html: true,
showCancelButton: true,
showConfirmButton: true,
closeOnConfirm: false,

View file

@ -60,7 +60,7 @@
</div>
<div class="col-md-3">
@can('delete-files', $server)
<a href="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}/@endif{{ rawurlencode($folder['entry']) }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span></a>
<a href="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}/@endif{{ rawurlencode($folder['entry']) }}" data-action="delete_file" data-name="{{ $folder['entry'] }}"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span></a>
@endcan
</div>
</div>
@ -94,7 +94,7 @@
</div>
<div class="col-md-3">
@can('delete-files', $server)
<a href="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="delete_file"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span>
<a href="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" data-action="delete_file" data-name="{{ $file['entry'] }}"><span class="badge label-danger"><i class="fa fa-trash-o"></i></span>
@endcan
</div>
</div>