mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-11-03 02:13:16 +03: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:
		@@ -28,7 +28,7 @@
 | 
				
			|||||||
        <main class="content-wrap card">
 | 
					        <main class="content-wrap card">
 | 
				
			||||||
            <h1 class="list-heading">{{ trans('entities.books_create') }}</h1>
 | 
					            <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">
 | 
					            <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>
 | 
					            </form>
 | 
				
			||||||
        </main>
 | 
					        </main>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@
 | 
				
			|||||||
            <h1 class="list-heading">{{ trans('entities.books_edit') }}</h1>
 | 
					            <h1 class="list-heading">{{ trans('entities.books_edit') }}</h1>
 | 
				
			||||||
            <form action="{{ $book->getUrl() }}" method="POST" enctype="multipart/form-data">
 | 
					            <form action="{{ $book->getUrl() }}" method="POST" enctype="multipart/form-data">
 | 
				
			||||||
                <input type="hidden" name="_method" value="PUT">
 | 
					                <input type="hidden" name="_method" value="PUT">
 | 
				
			||||||
                @include('books.form', ['model' => $book])
 | 
					                @include('books.form', ['model' => $book, 'returnLocation' => $book->getUrl()])
 | 
				
			||||||
            </form>
 | 
					            </form>
 | 
				
			||||||
        </main>
 | 
					        </main>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,20 +31,11 @@
 | 
				
			|||||||
        <label for="tag-manager">{{ trans('entities.book_tags') }}</label>
 | 
					        <label for="tag-manager">{{ trans('entities.book_tags') }}</label>
 | 
				
			||||||
    </button>
 | 
					    </button>
 | 
				
			||||||
    <div class="collapse-content" collapsible-content>
 | 
					    <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>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="form-group text-right">
 | 
					<div class="form-group text-right">
 | 
				
			||||||
    <?php
 | 
					    <a href="{{ $returnLocation }}" class="button outline">{{ trans('common.cancel') }}</a>
 | 
				
			||||||
        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>
 | 
					    <button type="submit" class="button">{{ trans('entities.books_save') }}</button>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user