Skip to content

Commit

Permalink
Merge branch 'v1.0' of github.com:leantony/laravel-grid into v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leantony committed May 1, 2018
2 parents 092c2fb + 2075610 commit ee54fa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Buttons/RendersButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected function addDeleteButton(): GenericButton
'pjaxEnabled' => false,
'dataAttributes' => [
'method' => 'DELETE',
'confirm' => 'Sure?',
'trigger-confirm' => true,
'pjax-target' => '#' . $this->id
],
'url' => function ($gridName, $item) {
Expand Down Expand Up @@ -412,4 +412,4 @@ protected function editToolbarButton(string $button, array $properties)
$instance->{$k} = $v;
}
}
}
}
6 changes: 4 additions & 2 deletions src/resources/assets/js/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ var _grids = _grids || {};
// since our refs are data-remote or class with data-remote, we need to loop
element.each(function (i, obj) {
obj = $(obj);
var confirmation = obj.data('confirm');
// confirmation
var confirmation = obj.data('trigger-confirm');
var confirmationMessage = obj.data('confirmation-msg') || 'Are you sure?';
// check if we need to refresh any pjax container
var pjaxContainer = obj.data('pjax-target');
// check if we need to force a page refresh. will override shouldPjax
Expand All @@ -55,7 +57,7 @@ var _grids = _grids || {};
e.preventDefault();
// check for a confirmation message
if (confirmation) {
if (!confirm(confirmation)) {
if (!confirm(confirmationMessage)) {
return;
}
}
Expand Down

0 comments on commit ee54fa0

Please sign in to comment.