Skip to content

Commit 2507ba6

Browse files
authored
Merge pull request #5672 from Laravel-Backpack/fix-save-actions-when-all-actions-are-removed
Fix save actions when all actions are removed
2 parents 9a498cd + be029ad commit 2507ba6

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/app/Library/CrudPanel/Traits/SaveActions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ public function getSaveAction()
275275
//get only the save actions that pass visibility callback
276276
$saveOptions = $this->getVisibleSaveActions();
277277

278+
if (empty($saveOptions)) {
279+
return [];
280+
}
281+
278282
//get the current action
279283
$saveCurrent = $this->getCurrentSaveAction($saveOptions);
280284

src/resources/views/crud/inc/form_save_buttons.blade.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
@if(isset($saveAction['active']) && !is_null($saveAction['active']['value']))
2-
<div id="saveActions" class="form-group my-3">
1+
<div id="saveActions" class="form-group my-3">
2+
@if(isset($saveAction['active']) && !is_null($saveAction['active']['value']))
3+
34
<input type="hidden" name="_save_action" value="{{ $saveAction['active']['value'] }}">
45

56
@if(empty($saveAction['options']))
@@ -23,16 +24,16 @@
2324
</ul>
2425
</div>
2526
@endif
27+
@endif
28+
@if(!$crud->hasOperationSetting('showCancelButton') || $crud->getOperationSetting('showCancelButton') == true)
29+
<a href="{{ $crud->hasAccess('list') ? url($crud->route) : url()->previous() }}" class="btn btn-secondary text-decoration-none"><span class="la la-ban"></span> &nbsp;{{ trans('backpack::crud.cancel') }}</a>
30+
@endif
2631

27-
@if(!$crud->hasOperationSetting('showCancelButton') || $crud->getOperationSetting('showCancelButton') == true)
28-
<a href="{{ $crud->hasAccess('list') ? url($crud->route) : url()->previous() }}" class="btn btn-secondary text-decoration-none"><span class="la la-ban"></span> &nbsp;{{ trans('backpack::crud.cancel') }}</a>
29-
@endif
32+
@if ($crud->get('update.showDeleteButton') && $crud->get('delete.configuration') && $crud->hasAccess('delete'))
33+
<button onclick="confirmAndDeleteEntry()" type="button" class="btn btn-danger float-right float-end"><i class="la la-trash-alt"></i> {{ trans('backpack::crud.delete') }}</button>
34+
@endif
35+
</div>
3036

31-
@if ($crud->get('update.showDeleteButton') && $crud->get('delete.configuration') && $crud->hasAccess('delete'))
32-
<button onclick="confirmAndDeleteEntry()" type="button" class="btn btn-danger float-right float-end"><i class="la la-trash-alt"></i> {{ trans('backpack::crud.delete') }}</button>
33-
@endif
34-
</div>
35-
@endif
3637

3738
@push('after_scripts')
3839
<script>

0 commit comments

Comments
 (0)