-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d9ffeb
commit 01a3c88
Showing
4 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
jQuery("[data-delete]").on("click", function (event) { | ||
event.preventDefault(); | ||
pjaxgrid = jQuery(this).data('pjax'); | ||
success = jQuery(this).data('success'); | ||
title = jQuery(this).data('delete'); | ||
url = jQuery(this).attr('href'); | ||
yes = jQuery(this).data('yes'); | ||
no = jQuery(this).data('no'); | ||
|
||
swal({ | ||
title: title, | ||
type: 'warning', | ||
reverseButtons: true, | ||
cancelButtonText: no, | ||
showCancelButton: true, | ||
confirmButtonText: yes, | ||
closeOnConfirm: false, | ||
showLoaderOnConfirm: true, | ||
preConfirm: () => { | ||
return jQuery.ajax({url: url}); | ||
} | ||
}) | ||
.then( result => { | ||
if (!result.value) { | ||
throw null; | ||
} | ||
swal({ | ||
title: success, | ||
type: 'success', | ||
showConfirmButton: true, | ||
timer: 1000, | ||
onClose: () => { | ||
if (pjaxgrid) { | ||
jQuery.pjax.reload({container: pjaxgrid}); | ||
} else { | ||
window.location.reload(); | ||
} | ||
} | ||
}); | ||
}) | ||
.catch( error => { | ||
if (error){ | ||
swal({ | ||
title: error.responseText, | ||
type: 'error', | ||
}); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace dynamikaweb\grid; | ||
|
||
use yii\web\AssetBundle; | ||
|
||
class ActionColumnAsset extends AssetBundle | ||
{ | ||
public $sourcePath = '@vendor/dynamikaweb/yii2-grid/src/assets'; | ||
|
||
public $js = [ | ||
'js/grid.js' | ||
]; | ||
|
||
public $depends = [ | ||
'yii\web\YiiAsset', | ||
'dominus77\sweetalert2\assets\SweetAlert2Asset', | ||
]; | ||
} |