56 lines
1.4 KiB
Markdown
Executable File
56 lines
1.4 KiB
Markdown
Executable File
# Dcat-Admin
|
|
|
|
Fork From [jqhph/dcat-admin](https://github.com/jqhph/dcat-admin)
|
|
|
|
## 改动
|
|
|
|
- 文件: `dcat-admin/src/Form/Footer.php`, 将 `reset` 按钮默认设置为 `false`
|
|
|
|
```php
|
|
protected $buttons = ['reset' => false, 'submit' => true, 'back' => true];
|
|
|
|
public function disableBack(bool $disable = true)
|
|
{
|
|
$this->buttons['back'] = !$disable;
|
|
}
|
|
```
|
|
|
|
- 添加 Form 表单的 `back` 按钮, 文件: `dcat-admin/resources/views/form/footer.blade.php`
|
|
|
|
```php
|
|
@if(! empty($buttons['back']))
|
|
<div class="btn-group pull-left">
|
|
<a href="javascript:window.history.back()" class="btn btn-white"><i class="feather icon-arrow-left"></i> {{ trans('admin.back') }}</a>
|
|
</div>
|
|
@endif
|
|
```
|
|
|
|
- 文件: `dcat-admin/src/Show/Tools.php`, 添加 `back` 按钮, `list` 默认设置为 `false`, 修改按钮的渲染方式(去掉外层的 `btn-group` 标签, 添加类名 `mr-1`)
|
|
|
|
```php
|
|
protected $tools = ['back', 'list', 'edit', 'delete'];
|
|
|
|
protected $showBack = true;
|
|
|
|
public function disableBack(bool $disable = true)
|
|
{
|
|
$this->showBack = !$disable;
|
|
return $this;
|
|
}
|
|
|
|
protected function renderBack()
|
|
{
|
|
if (! $this->showBack) {
|
|
return;
|
|
}
|
|
|
|
$back = trans('admin.back');
|
|
|
|
return <<<HTML
|
|
<a href="javascript:window.history.back()" class="btn btn-sm btn-primary mr-1">
|
|
<i class="feather icon-arrow-left"></i><span class="d-none d-sm-inline"> {$back}</span>
|
|
</a>
|
|
HTML;
|
|
}
|
|
```
|