mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-24 11:52:34 +01:00
Update book form so cancel URL is explicitly passed in
- Added to prevent future possibility of 'shelf' var being introduced in scope and therefore causing a side-effect of redirect logic.
This commit is contained in:
parent
28184c6bfc
commit
4b9618cd21
@ -28,7 +28,7 @@
|
||||
<main class="content-wrap card">
|
||||
<h1 class="list-heading">{{ trans('entities.books_create') }}</h1>
|
||||
<form action="{{ isset($bookshelf) ? $bookshelf->getUrl('/create-book') : url('/books') }}" method="POST" enctype="multipart/form-data">
|
||||
@include('books.form')
|
||||
@include('books.form', ['returnLocation' => isset($bookshelf) ? $bookshelf->getUrl() : url('/books')])
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<h1 class="list-heading">{{ trans('entities.books_edit') }}</h1>
|
||||
<form action="{{ $book->getUrl() }}" method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
@include('books.form', ['model' => $book])
|
||||
@include('books.form', ['model' => $book, 'returnLocation' => $book->getUrl()])
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
@ -31,20 +31,11 @@
|
||||
<label for="tag-manager">{{ trans('entities.book_tags') }}</label>
|
||||
</button>
|
||||
<div class="collapse-content" collapsible-content>
|
||||
@include('components.tag-manager', ['entity' => isset($book)?$book:null, 'entityType' => 'chapter'])
|
||||
@include('components.tag-manager', ['entity' => $book ?? null, 'entityType' => 'chapter'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<?php
|
||||
if (isset($bookshelf)) {
|
||||
$cancelUrl = $bookshelf->getUrl();
|
||||
} else if (isset($book)) {
|
||||
$cancelUrl = $book->getUrl();
|
||||
} else {
|
||||
$cancelUrl = '/books';
|
||||
}
|
||||
?>
|
||||
<a href="{{ $cancelUrl }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<a href="{{ $returnLocation }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<button type="submit" class="button">{{ trans('entities.books_save') }}</button>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user