1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added per-item recycle-bin delete and restore

This commit is contained in:
Dan Brown
2020-11-02 22:47:48 +00:00
parent ff7cbd14fc
commit 9e033709a7
14 changed files with 291 additions and 38 deletions

View File

@ -89,10 +89,18 @@ return [
'recycle_bin_deleted_item' => 'Deleted Item',
'recycle_bin_deleted_by' => 'Deleted By',
'recycle_bin_deleted_at' => 'Deletion Time',
'recycle_bin_permanently_delete' => 'Permanently Delete',
'recycle_bin_restore' => 'Restore',
'recycle_bin_contents_empty' => 'The recycle bin is currently empty',
'recycle_bin_empty' => 'Empty Recycle Bin',
'recycle_bin_empty_confirm' => 'This will permanently destroy all items in the recycle bin including content contained within each item. Are you sure you want to empty the recycle bin?',
'recycle_bin_empty_notification' => 'Deleted :count total items from the recycle bin.',
'recycle_bin_destroy_confirm' => 'This action will permanently delete this item, along with any child elements listed below, from the system and you will not be able to restore this content. Are you sure you want to permanently delete this item?',
'recycle_bin_destroy_list' => 'Items to be Destroyed',
'recycle_bin_restore_list' => 'Items to be Restored',
'recycle_bin_restore_confirm' => 'This action will restore the deleted item, including any child elements, to their original location. If the original location has since been deleted, and is now in the recycle bin, the parent item will also need to be restored.',
'recycle_bin_restore_deleted_parent' => 'The parent of this item has also been deleted. These will remain deleted until that parent is also restored.',
'recycle_bin_destroy_notification' => 'Deleted :count total items from the recycle bin.',
'recycle_bin_restore_notification' => 'Restored :count total items from the recycle bin.',
// Audit Log
'audit' => 'Audit Log',

View File

@ -150,22 +150,25 @@ body.flexbox {
.justify-flex-end {
justify-content: flex-end;
}
.justify-center {
justify-content: center;
}
/**
* Display and float utilities
*/
.block {
display: block;
display: block !important;
position: relative;
}
.inline {
display: inline;
display: inline !important;
}
.block.inline {
display: inline-block;
display: inline-block !important;
}
.hidden {

View File

@ -0,0 +1,7 @@
<?php $type = $entity->getType(); ?>
<div class="{{$type}} {{$type === 'page' && $entity->draft ? 'draft' : ''}} {{$classes ?? ''}} entity-list-item no-hover">
<span role="presentation" class="icon text-{{$type}} {{$type === 'page' && $entity->draft ? 'draft' : ''}}">@icon($type)</span>
<div class="content">
<div class="entity-list-item-name break-text">{{ $entity->name }}</div>
</div>
</div>

View File

@ -0,0 +1,11 @@
@include('partials.entity-display-item', ['entity' => $entity])
@if($entity->isA('book'))
@foreach($entity->chapters()->withTrashed()->get() as $chapter)
@include('partials.entity-display-item', ['entity' => $chapter])
@endforeach
@endif
@if($entity->isA('book') || $entity->isA('chapter'))
@foreach($entity->pages()->withTrashed()->get() as $page)
@include('partials.entity-display-item', ['entity' => $page])
@endforeach
@endif

View File

@ -0,0 +1,31 @@
@extends('simple-layout')
@section('body')
<div class="container small">
<div class="grid left-focus v-center no-row-gap">
<div class="py-m">
@include('settings.navbar', ['selected' => 'maintenance'])
</div>
</div>
<div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.recycle_bin_permanently_delete') }}</h2>
<p class="text-muted">{{ trans('settings.recycle_bin_destroy_confirm') }}</p>
<form action="{{ url('/settings/recycle-bin/' . $deletion->id) }}" method="post">
{!! method_field('DELETE') !!}
{!! csrf_field() !!}
<a href="{{ url('/settings/recycle-bin') }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button">{{ trans('common.delete_confirm') }}</button>
</form>
@if($deletion->deletable instanceof \BookStack\Entities\Entity)
<hr class="mt-m">
<h5>{{ trans('settings.recycle_bin_destroy_list') }}</h5>
@include('settings.recycle-bin.deletable-entity-list', ['entity' => $deletion->deletable])
@endif
</div>
</div>
@stop

View File

@ -44,10 +44,11 @@
<th>{{ trans('settings.recycle_bin_deleted_item') }}</th>
<th>{{ trans('settings.recycle_bin_deleted_by') }}</th>
<th>{{ trans('settings.recycle_bin_deleted_at') }}</th>
<th></th>
</tr>
@if(count($deletions) === 0)
<tr>
<td colspan="3">
<td colspan="4">
<p class="text-muted"><em>{{ trans('settings.recycle_bin_contents_empty') }}</em></p>
</td>
</tr>
@ -55,12 +56,15 @@
@foreach($deletions as $deletion)
<tr>
<td>
<div class="table-entity-item mb-m">
<div class="table-entity-item">
<span role="presentation" class="icon text-{{$deletion->deletable->getType()}}">@icon($deletion->deletable->getType())</span>
<div class="text-{{ $deletion->deletable->getType() }}">
{{ $deletion->deletable->name }}
</div>
</div>
@if($deletion->deletable instanceof \BookStack\Entities\Book || $deletion->deletable instanceof \BookStack\Entities\Chapter)
<div class="mb-m"></div>
@endif
@if($deletion->deletable instanceof \BookStack\Entities\Book)
<div class="pl-xl block inline">
<div class="text-chapter">
@ -77,7 +81,16 @@
@endif
</td>
<td>@include('partials.table-user', ['user' => $deletion->deleter, 'user_id' => $deletion->deleted_by])</td>
<td>{{ $deletion->created_at }}</td>
<td width="200">{{ $deletion->created_at }}</td>
<td width="150" class="text-right">
<div component="dropdown" class="dropdown-container">
<button type="button" refs="dropdown@toggle" class="button outline">{{ trans('common.actions') }}</button>
<ul refs="dropdown@menu" class="dropdown-menu">
<li><a class="block" href="{{ url('/settings/recycle-bin/'.$deletion->id.'/restore') }}">{{ trans('settings.recycle_bin_restore') }}</a></li>
<li><a class="block" href="{{ url('/settings/recycle-bin/'.$deletion->id.'/destroy') }}">{{ trans('settings.recycle_bin_permanently_delete') }}</a></li>
</ul>
</div>
</td>
</tr>
@endforeach
</table>

View File

@ -0,0 +1,33 @@
@extends('simple-layout')
@section('body')
<div class="container small">
<div class="grid left-focus v-center no-row-gap">
<div class="py-m">
@include('settings.navbar', ['selected' => 'maintenance'])
</div>
</div>
<div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.recycle_bin_restore') }}</h2>
<p class="text-muted">{{ trans('settings.recycle_bin_restore_confirm') }}</p>
<form action="{{ url('/settings/recycle-bin/' . $deletion->id . '/restore') }}" method="post">
{!! csrf_field() !!}
<a href="{{ url('/settings/recycle-bin') }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button">{{ trans('settings.recycle_bin_restore') }}</button>
</form>
@if($deletion->deletable instanceof \BookStack\Entities\Entity)
<hr class="mt-m">
<h5>{{ trans('settings.recycle_bin_restore_list') }}</h5>
@if($deletion->deletable->getParent() && $deletion->deletable->getParent()->trashed())
<p class="text-neg">{{ trans('settings.recycle_bin_restore_deleted_parent') }}</p>
@endif
@include('settings.recycle-bin.deletable-entity-list', ['entity' => $deletion->deletable])
@endif
</div>
</div>
@stop