Skip to content

Commit

Permalink
Fix action dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
rxcod9 committed Mar 18, 2023
1 parent adb8dda commit b81e86b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 29 deletions.
25 changes: 25 additions & 0 deletions config/voyager-datatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,31 @@
'not_allowed_slugs' => array_filter(explode(',', env('VOYAGER_DATATABLE_QUICK_PREVIEW_NOT_ALLOWED_SLUGS', ''))),
],

'quick-delete' => [
/*
* If enabled for voyager-datatable quick delete package.
*/
'enabled' => env('VOYAGER_DATATABLE_QUICK_DELETE_ENABLED', true),

/*
| Here you can specify for which data type slugs bulk-update is enabled
|
| Supported: "*", or data type slugs "users", "roles"
|
*/

'allowed_slugs' => array_filter(explode(',', env('VOYAGER_DATATABLE_QUICK_DELETE_ALLOWED_SLUGS', '*'))),

/*
| Here you can specify for which data type slugs bulk-update is not allowed
|
| Supported: "*", or data type slugs "users", "roles"
|
*/

'not_allowed_slugs' => array_filter(explode(',', env('VOYAGER_DATATABLE_QUICK_DELETE_NOT_ALLOWED_SLUGS', ''))),
],

/*
|--------------------------------------------------------------------------
| Lens config
Expand Down
2 changes: 2 additions & 0 deletions resources/views/bread/datatable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
@include('joy-voyager-datatable::bread.partials.group-actions', ['actions' => $actions, 'dataType' => $dataType, 'data' => null])
@include('voyager::multilingual.language-selector')
</div>
@if(config('joy-voyager-datatable.lens.enabled', true))
<div class="container-fluid">
@include('joy-voyager-datatable::bread.partials.group-lenses', ['lenses' => $lenses, 'dataType' => $dataType, 'data' => null])
</div>
@endif
@stop

@section('content')
Expand Down
39 changes: 25 additions & 14 deletions resources/views/bread/partials/group-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
'*PreviewAction',
'*ExportAction',
], get_class($action));
})->filter(function($action) {
return !Str::is([
'*DeleteAction',
'*RestoreAction',
'*EditAction',
'*ViewAction',
'*QuickEditAction',
'*PreviewAction',
'*ExportAction',
], get_class($action));
});
@endphp
<div class="btn-group group-actions">
Expand All @@ -28,18 +38,19 @@
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => null])
@endif
@endforeach
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
@foreach($otherActions as $action)
@if (method_exists($action, 'massAction'))
<li>
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => null])
</li>
@endif
@endforeach
</ul>
</ul>
@if($otherActions->count() > 0)
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
@foreach($otherActions as $action)
@if (method_exists($action, 'massAction'))
<li>
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => null])
</li>
@endif
@endforeach
</ul>
@endif
</div>
32 changes: 17 additions & 15 deletions resources/views/bread/partials/single-group-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@
});
@endphp
<div class="btn-group single-group-actions btn-group-xs pull-right">
<button type="button" class="btn btn-default dropdown-toggle pull-right" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu dropdown-menu-left pull-right">
<li class="pull-right">
<div class="btn-group pull-right">
@foreach($otherActions as $action)
@if (!method_exists($action, 'massAction'))
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => $data])
@endif
@endforeach
</div>
</li>
</ul>
@if($otherActions->count() > 0)
<button type="button" class="btn btn-default dropdown-toggle pull-right" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu dropdown-menu-left pull-right">
<li class="pull-right">
<div class="btn-group pull-right">
@foreach($otherActions as $action)
@if (!method_exists($action, 'massAction'))
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => $data])
@endif
@endforeach
</div>
</li>
</ul>
@endif
@foreach($crudActions as $action)
@if (!method_exists($action, 'massAction'))
@include('voyager::bread.partials.actions', ['action' => $action, 'dataType' => $dataType, 'data' => $data])
Expand Down

0 comments on commit b81e86b

Please sign in to comment.