mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Fix Book form (create) returning to the full books list on cancel
Fixes #1662 Added a small block of logic to determine the correct URL to attribute to the cancel button on a given page create form. If adding a book from a bookshelf, return to the bookshelf. If editing a book, return to the book. In all other cases, return to the full books list.
This commit is contained in:
@ -36,6 +36,15 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<a href="{{ isset($book) ? $book->getUrl() : url('/books') }}" class="button outline">{{ trans('common.cancel') }}</a>
|
||||
<?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>
|
||||
<button type="submit" class="button">{{ trans('entities.books_save') }}</button>
|
||||
</div>
|
Reference in New Issue
Block a user