Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3866fcd
Uploaders - Refactor and fixes (#5478)
pxpm Nov 7, 2024
9563486
trigger testing forkflow on PR
tabacitu Nov 25, 2024
2cc9e15
Clean up uploaders (#5725)
pxpm Dec 5, 2024
9af9422
allow datatable url configuration (#5713)
pxpm Dec 5, 2024
5d25253
use next branch for basset
pxpm Jan 7, 2025
d8fa673
require alpha version
pxpm Jan 22, 2025
5660f77
bump basset version
pxpm Jan 22, 2025
c021919
Lifecycle hooks for CRUD operations (#5687)
pxpm Feb 7, 2025
68993d5
"Agnostic" filters - decouple filters from datatables (#5714)
pxpm Feb 7, 2025
1231c6f
bump basset version
pxpm Feb 27, 2025
3ba0834
Update composer.json
pxpm Mar 6, 2025
e467bd0
Apply fixes from StyleCI
StyleCIBot Mar 24, 2025
a4c3b6e
datatable component (#5688)
pxpm Jun 9, 2025
2b23901
move the list heading to the datatable component (#5808)
pxpm Jun 10, 2025
5e93f49
add Datagrid and Datalist components (#5810)
tabacitu Jun 19, 2025
ad7e0c5
Form component (no ajax form) (#5814)
pxpm Jun 24, 2025
aee3688
dataform component fixes (#5816)
pxpm Jun 24, 2025
054e07b
Added general chip blade file and chip widget (#5815)
tabacitu Jun 25, 2025
8f8b6c2
Fix Form issues, Add *name* argument to forms (#5817)
pxpm Jun 25, 2025
0347f16
Drop support for Laravel 10 and 11 (#5819)
tabacitu Jun 27, 2025
48d3756
Fix hooks at setup level (#5818)
pxpm Jun 27, 2025
46b2342
install dev-next version of generators
pxpm Jun 27, 2025
4ab8e30
require basset beta version (#5821)
tabacitu Jun 28, 2025
7737ac1
fix scripts on table
pxpm Jul 1, 2025
f6d40ed
fix the keyboard shortcuts on forms
pxpm Jul 1, 2025
0b84d52
ensure proper crud identification
pxpm Jul 4, 2025
1ed62af
fix hooks
pxpm Jul 7, 2025
eff3fb9
fix crud field javacript issue
pxpm Jul 8, 2025
5c61a8d
pass the form id to form content
pxpm Jul 14, 2025
bff65ce
add error page translations
pxpm Jul 14, 2025
5c884c1
fix export buttons
pxpm Jul 15, 2025
45d75c5
wip
pxpm Jun 12, 2025
c8bbf36
wip
pxpm Jun 12, 2025
09aede2
wip
pxpm Jul 15, 2025
071c1d7
map the ui files
pxpm Jul 16, 2025
74c08b3
fix table without export buttons
pxpm Jul 16, 2025
9e15c15
always focus on error field
pxpm Jul 17, 2025
8d6d488
delete button redirect
pxpm Jul 17, 2025
8f36048
Apply fixes from StyleCI
StyleCIBot Jul 17, 2025
27ad78e
Fix padding in name
jcastroa87 Jul 20, 2025
ccb6a5a
Fix checkbox padding
jcastroa87 Jul 20, 2025
247391b
Background of select2
jcastroa87 Jul 20, 2025
648fcb3
multiple fixes
pxpm Jul 22, 2025
1e53e94
fix form error highlight
pxpm Jul 29, 2025
ca253f5
wip
pxpm Aug 11, 2025
be42c3f
Add toggle to JSON
zachweix Aug 5, 2025
471b7e2
allow user to choose locale and timezone
zachweix Aug 5, 2025
a47818d
fixes bulk actions
pxpm Aug 25, 2025
6ebeef2
fix the filter navbar
pxpm Aug 26, 2025
4a518ee
fix line buttons dropdown
pxpm Aug 26, 2025
79e63c9
wip
pxpm Sep 3, 2025
172986c
wip
pxpm Sep 3, 2025
1d6e3bd
wip
pxpm Sep 3, 2025
e32d5ec
wip
pxpm Sep 3, 2025
b214b0e
wip
pxpm Sep 3, 2025
b4d9fec
DataFormModal component (#5863)
pxpm Oct 29, 2025
2f54113
wip
pxpm Oct 30, 2025
d841d00
wip
pxpm Nov 3, 2025
ade6a39
wip
pxpm Nov 6, 2025
dde6894
Save action classes (#5878)
pxpm Nov 7, 2025
561772b
add cancel button option to modal form (#5881)
pxpm Nov 11, 2025
05ae2fd
fix problem with checklist_dependency field in Update operation
tabacitu Nov 19, 2025
64e2c0b
fix indentation
tabacitu Nov 21, 2025
82ed076
Update src/app/Console/Commands/Install.php
tabacitu Nov 21, 2025
943e1f2
Update composer.json
tabacitu Nov 21, 2025
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
Prev Previous commit
Next Next commit
Save action classes (#5878)
Enable the usage of classes to describe the save actions. This allow more flexibility and easy to extend and/or configure behaviour.
  • Loading branch information
pxpm committed Nov 21, 2025
commit dde6894005f68f48614e8da964110ed4ee849fa5
56 changes: 56 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/AbstractSaveAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Http\Request;

abstract class AbstractSaveAction implements SaveActionInterface
{
protected ?int $order = null;

public function __construct(?int $order = null)
{
if ($order !== null) {
$this->order = $order;
}
}

public function getOrder(): ?int
{
return $this->order;
}

public function setOrder(int $order): void
{
$this->order = $order;
}

public function isVisible(CrudPanel $crud): bool
{
return true;
}

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
return null;
}

public function getReferrerUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
return null;
}

public function toArray(): array
{
return [
'name' => $this->getName(),
'button_text' => $this->getButtonText(),
'visible' => fn (CrudPanel $crud) => $this->isVisible($crud),
'redirect' => fn (CrudPanel $crud, Request $request, $itemId = null) => $this->getRedirectUrl($crud, $request, $itemId),
'referrer_url' => fn (CrudPanel $crud, Request $request, $itemId = null) => $this->getReferrerUrl($crud, $request, $itemId),
'order' => $this->getOrder(),
'_handler' => $this,
];
}
}
24 changes: 24 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/SaveActionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Request;

interface SaveActionInterface extends Arrayable
{
public function getName(): string;

public function getButtonText(): string;

public function isVisible(CrudPanel $crud): bool;

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string;

public function getReferrerUrl(CrudPanel $crud, Request $request, $itemId = null): ?string;

public function getOrder(): ?int;

public function setOrder(int $order): void;
}
31 changes: 31 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/SaveAndBack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Http\Request;

class SaveAndBack extends AbstractSaveAction
{
protected ?int $order = 1;

public function getName(): string
{
return 'save_and_back';
}

public function getButtonText(): string
{
return trans('backpack::crud.save_action_save_and_back');
}

public function isVisible(CrudPanel $crud): bool
{
return $crud->hasAccess('list');
}

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
return $request->has('_http_referrer') ? $request->get('_http_referrer') : $crud->route;
}
}
58 changes: 58 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/SaveAndEdit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Http\Request;

class SaveAndEdit extends AbstractSaveAction
{
protected ?int $order = 2;

public function getName(): string
{
return 'save_and_edit';
}

public function getButtonText(): string
{
return trans('backpack::crud.save_action_save_and_edit');
}

public function isVisible(CrudPanel $crud): bool
{
return $crud->hasAccess('update');
}

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
$itemId = $itemId ?: $request->get('id');

if (! $itemId) {
return $crud->route;
}

$redirectUrl = rtrim($crud->route, '/').'/'.$itemId.'/edit';

if ($request->has('_locale')) {
$redirectUrl .= '?_locale='.$request->get('_locale');
}

if ($request->has('_current_tab')) {
$redirectUrl .= '#'.$request->get('_current_tab');
}

return $redirectUrl;
}

public function getReferrerUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
$itemId = $itemId ?: $request->get('id');

if (! $itemId) {
return null;
}

return url(rtrim($crud->route, '/').'/'.$itemId.'/edit');
}
}
31 changes: 31 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/SaveAndList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Http\Request;

class SaveAndList extends AbstractSaveAction
{
protected ?int $order = 5;

public function getName(): string
{
return 'save_and_list';
}

public function getButtonText(): string
{
return trans('backpack::crud.save_action_save_and_list');
}

public function isVisible(CrudPanel $crud): bool
{
return $crud->hasAccess('list');
}

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
return $crud->route;
}
}
31 changes: 31 additions & 0 deletions src/app/Library/CrudPanel/SaveActions/SaveAndNew.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Backpack\CRUD\app\Library\CrudPanel\SaveActions;

use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Illuminate\Http\Request;

class SaveAndNew extends AbstractSaveAction
{
protected ?int $order = 3;

public function getName(): string
{
return 'save_and_new';
}

public function getButtonText(): string
{
return trans('backpack::crud.save_action_save_and_new');
}

public function isVisible(CrudPanel $crud): bool
{
return $crud->hasAccess('create');
}

public function getRedirectUrl(CrudPanel $crud, Request $request, $itemId = null): ?string
{
return $crud->route.'/create';
}
}
Loading