mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-23 09:55:28 +08:00
Add notice to Page delete confirmation when in use as a template
This commit is contained in:
parent
99ae759eff
commit
ec3b06d83f
|
@ -3,6 +3,7 @@
|
|||
namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Actions\View;
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use BookStack\Entities\Repos\PageRepo;
|
||||
use BookStack\Entities\Tools\BookContents;
|
||||
|
@ -265,11 +266,13 @@ class PageController extends Controller
|
|||
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
||||
$this->checkOwnablePermission('page-delete', $page);
|
||||
$this->setPageTitle(trans('entities.pages_delete_named', ['pageName' => $page->getShortName()]));
|
||||
$times_used_as_template = Book::where('default_template', '=', $page->id)->count();
|
||||
|
||||
return view('pages.delete', [
|
||||
'book' => $page->book,
|
||||
'page' => $page,
|
||||
'current' => $page,
|
||||
'times_used_as_template' => $times_used_as_template,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ return [
|
|||
'pages_delete_draft' => 'Delete Draft Page',
|
||||
'pages_delete_success' => 'Page deleted',
|
||||
'pages_delete_draft_success' => 'Draft page deleted',
|
||||
'pages_delete_warning_template' => '{0}|{1}Be careful: this page is used as a template for :count book.|[2,*]Be careful: this page is used as a template for :count books.',
|
||||
'pages_delete_confirm' => 'Are you sure you want to delete this page?',
|
||||
'pages_delete_draft_confirm' => 'Are you sure you want to delete this draft page?',
|
||||
'pages_editing_named' => 'Editing Page :pageName',
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
<div class="card content-wrap auto-height">
|
||||
<h1 class="list-heading">{{ $page->draft ? trans('entities.pages_delete_draft') : trans('entities.pages_delete') }}</h1>
|
||||
|
||||
@if ($times_used_as_template > 0)
|
||||
<p>{{ trans_choice('entities.pages_delete_warning_template', $times_used_as_template) }}</p>
|
||||
@endif
|
||||
|
||||
<div class="grid half v-center">
|
||||
<div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user