mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-05 01:24:38 +08:00
Started work on the recycle bin interface
This commit is contained in:
@ -14,7 +14,6 @@ class HomeController extends Controller
|
||||
|
||||
/**
|
||||
* Display the homepage.
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@ -22,9 +21,12 @@ class HomeController extends Controller
|
||||
$draftPages = [];
|
||||
|
||||
if ($this->isSignedIn()) {
|
||||
$draftPages = Page::visible()->where('draft', '=', true)
|
||||
$draftPages = Page::visible()
|
||||
->where('draft', '=', true)
|
||||
->where('created_by', '=', user()->id)
|
||||
->orderBy('updated_at', 'desc')->take(6)->get();
|
||||
->orderBy('updated_at', 'desc')
|
||||
->take(6)
|
||||
->get();
|
||||
}
|
||||
|
||||
$recentFactor = count($draftPages) > 0 ? 0.5 : 1;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Entities\Managers\TrashCan;
|
||||
use BookStack\Notifications\TestEmail;
|
||||
use BookStack\Uploads\ImageService;
|
||||
use Illuminate\Http\Request;
|
||||
@ -19,7 +20,13 @@ class MaintenanceController extends Controller
|
||||
// Get application version
|
||||
$version = trim(file_get_contents(base_path('version')));
|
||||
|
||||
return view('settings.maintenance', ['version' => $version]);
|
||||
// Recycle bin details
|
||||
$recycleStats = (new TrashCan())->getTrashedCounts();
|
||||
|
||||
return view('settings.maintenance', [
|
||||
'version' => $version,
|
||||
'recycleStats' => $recycleStats,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
35
app/Http/Controllers/RecycleBinController.php
Normal file
35
app/Http/Controllers/RecycleBinController.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Entities\Deletion;
|
||||
use BookStack\Entities\Managers\TrashCan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RecycleBinController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the top-level listing for the recycle bin.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->checkPermission('settings-manage');
|
||||
$this->checkPermission('restrictions-manage-all');
|
||||
|
||||
$deletions = Deletion::query()->with(['deletable', 'deleter'])->paginate(10);
|
||||
|
||||
return view('settings.recycle-bin', [
|
||||
'deletions' => $deletions,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty out the recycle bin.
|
||||
*/
|
||||
public function empty()
|
||||
{
|
||||
$this->checkPermission('settings-manage');
|
||||
$this->checkPermission('restrictions-manage-all');
|
||||
|
||||
(new TrashCan())->destroyFromAllDeletions();
|
||||
return redirect('/settings/recycle-bin');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user