Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable navigation urls on panels #5709

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/app/Http/Controllers/Operations/ListOperation.php
Original file line number Diff line number Diff line change
@@ -45,6 +45,12 @@ protected function setupListDefaults()

$this->crud->operation('list', function () {
$this->crud->loadDefaultOperationSettingsFromConfig();

$this->crud->setOperationSetting('breadcrumbs', [
trans('backpack::crud.admin') => url(config('backpack.base.route_prefix'), 'dashboard'),
$this->crud->entity_name_plural => url($this->crud->route),
trans('backpack::crud.list') => false,
]);
});
}

@@ -59,6 +65,7 @@ public function index()

$this->data['crud'] = $this->crud;
$this->data['title'] = $this->crud->getTitle() ?? mb_ucfirst($this->crud->entity_name_plural);
$this->data['breadcrumbs'] = $this->crud->getOperationSetting('breadcrumbs');

// load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package
return view($this->crud->getListView(), $this->data);
6 changes: 6 additions & 0 deletions src/resources/views/crud/buttons/cancel.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@php
$cancelButtonUrl = empty($crud->getOperationSetting('cancelButtonUrl')) ? ($crud->hasAccess('list') ? url($crud->route) : url()->previous()) :
(is_callable($crud->getOperationSetting('cancelButtonUrl')) ? $crud->getOperationSetting('cancelButtonUrl')($crud) : $crud->getOperationSetting('cancelButtonUrl'));
@endphp

<a href="{{ $cancelButtonUrl }}" class="btn btn-secondary text-decoration-none"><span class="la la-ban"></span> &nbsp;{{ trans('backpack::crud.cancel') }}</a>
6 changes: 3 additions & 3 deletions src/resources/views/crud/inc/form_save_buttons.blade.php
Original file line number Diff line number Diff line change
@@ -18,15 +18,15 @@
<span class="d-none visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" aria-labelledby="bpSaveButtonsGroup">
@foreach( $saveAction['options'] as $value => $label)
@foreach($saveAction['options'] as $value => $label)
<li><button class="dropdown-item" type="button" data-value="{{ $value }}">{{ $label }}</button></li>
@endforeach
</ul>
</div>
@endif
@endif
@if(!$crud->hasOperationSetting('showCancelButton') || $crud->getOperationSetting('showCancelButton') == true)
<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>
@if(!$crud->hasOperationSetting('showCancelButton') || $crud->getOperationSetting('showCancelButton') === true)
@include('crud::buttons.cancel')
@endif

@if ($crud->get('update.showDeleteButton') && $crud->get('delete.configuration') && $crud->hasAccess('delete'))