Массовые действия и очистка корзины разом
Заодно поправил forceDelete() запроса: не применял область мягкого удаления
This commit is contained in:
1 parent
883943b24f
commit
ca606bb012
6 files changed
+185
-1
No files matched your search
@@ -36,14 +36,41 @@ use Rsgrinko\Proton\View\View;
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2><?= View::e($label) ?></h2>
|
||||
<div class="row">
|
||||
<h2 style="margin: 0;"><?= View::e($label) ?></h2>
|
||||
<span class="spacer"></span>
|
||||
|
||||
<?php if (($counts[$kind] ?? 0) > 0) { ?>
|
||||
<form method="post" action="<?= View::e(View::route('admin.trash.clear')) ?>">
|
||||
<?= View::csrf() ?>
|
||||
<input type="hidden" name="kind" value="<?= View::e($kind) ?>">
|
||||
<button type="submit" class="danger"
|
||||
data-confirm="Очистить корзину «<?= View::e($label) ?>» целиком? Удалит всё, не только эту страницу — обратной дороги нет.">
|
||||
Очистить корзину
|
||||
</button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if ($page['items'] === []) { ?>
|
||||
<p class="muted">Здесь пусто — ничего не удаляли или всё уже вернули.</p>
|
||||
<?php } else { ?>
|
||||
<form method="post" action="<?= View::e(View::route('admin.trash.bulk')) ?>">
|
||||
<?= View::csrf() ?>
|
||||
<input type="hidden" name="kind" value="<?= View::e($kind) ?>">
|
||||
|
||||
<?= View::partial('bulk', [
|
||||
'actions' => [
|
||||
'restore' => 'вернуть',
|
||||
'destroy' => 'удалить совсем',
|
||||
],
|
||||
'confirm' => 'Выполнить действие над отмеченными записями? Удаление совсем — без возврата.',
|
||||
]) ?>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table class="list">
|
||||
<tr class="head">
|
||||
<th></th>
|
||||
<th>Запись</th>
|
||||
<th>Удалена</th>
|
||||
<th></th>
|
||||
@@ -51,6 +78,7 @@ use Rsgrinko\Proton\View\View;
|
||||
|
||||
<?php foreach ($page['items'] as $record) { ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="ids[]" value="<?= $record->id() ?>" data-check-item></td>
|
||||
<td><?= View::e(($title)($record)) ?></td>
|
||||
<td class="muted small nowrap"><?= View::e(View::ago((string) $record->raw(Model::DELETED_AT))) ?></td>
|
||||
<td class="right">
|
||||
@@ -74,6 +102,7 @@ use Rsgrinko\Proton\View\View;
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?= View::partial('pagination', [
|
||||
'route' => 'admin.trash',
|
||||
|
||||
Reference in new issue
Block a user