From 4b9618cd2163589c441fa12d078d62f76f002d69 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 27 Oct 2019 16:55:05 +0000 Subject: [PATCH] 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. --- resources/views/books/create.blade.php | 2 +- resources/views/books/edit.blade.php | 2 +- resources/views/books/form.blade.php | 13 ++----------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/resources/views/books/create.blade.php b/resources/views/books/create.blade.php index 6de81cd46..db3e90e51 100644 --- a/resources/views/books/create.blade.php +++ b/resources/views/books/create.blade.php @@ -28,7 +28,7 @@

{{ trans('entities.books_create') }}

- @include('books.form') + @include('books.form', ['returnLocation' => isset($bookshelf) ? $bookshelf->getUrl() : url('/books')])
diff --git a/resources/views/books/edit.blade.php b/resources/views/books/edit.blade.php index 400fd6e81..ac11b58e2 100644 --- a/resources/views/books/edit.blade.php +++ b/resources/views/books/edit.blade.php @@ -18,7 +18,7 @@

{{ trans('entities.books_edit') }}

- @include('books.form', ['model' => $book]) + @include('books.form', ['model' => $book, 'returnLocation' => $book->getUrl()])
diff --git a/resources/views/books/form.blade.php b/resources/views/books/form.blade.php index 91a3899de..a3235036e 100644 --- a/resources/views/books/form.blade.php +++ b/resources/views/books/form.blade.php @@ -31,20 +31,11 @@
- @include('components.tag-manager', ['entity' => isset($book)?$book:null, 'entityType' => 'chapter']) + @include('components.tag-manager', ['entity' => $book ?? null, 'entityType' => 'chapter'])
- getUrl(); - } else if (isset($book)) { - $cancelUrl = $book->getUrl(); - } else { - $cancelUrl = '/books'; - } - ?> - {{ trans('common.cancel') }} + {{ trans('common.cancel') }}
\ No newline at end of file