mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Merge branch 'cw1998-fix/#1662'
This commit is contained in:
commit
1b350d622d
@ -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,11 +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">
|
||||
<a href="{{ isset($book) ? $book->getUrl() : url('/books') }}" 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>
|
@ -1,5 +1,6 @@
|
||||
<?php namespace Tests;
|
||||
|
||||
use BookStack\Entities\Bookshelf;
|
||||
use BookStack\Entities\Book;
|
||||
use BookStack\Entities\Chapter;
|
||||
use BookStack\Entities\Page;
|
||||
@ -289,4 +290,29 @@ class EntityTest extends BrowserKitTest
|
||||
$this->assertEquals('parta-partb-partc', $book->slug);
|
||||
}
|
||||
|
||||
public function test_shelf_cancel_creation_returns_to_correct_place()
|
||||
{
|
||||
$shelf = Bookshelf::first();
|
||||
|
||||
// Cancel button from shelf goes back to shelf
|
||||
$this->asEditor()->visit($shelf->getUrl('/create-book'))
|
||||
->see('Cancel')
|
||||
->click('Cancel')
|
||||
->seePageIs($shelf->getUrl());
|
||||
|
||||
// Cancel button from books goes back to books
|
||||
$this->asEditor()->visit('/create-book')
|
||||
->see('Cancel')
|
||||
->click('Cancel')
|
||||
->seePageIs('/books');
|
||||
|
||||
// Cancel button from book edit goes back to book
|
||||
$book = Book::first();
|
||||
|
||||
$this->asEditor()->visit($book->getUrl('/edit'))
|
||||
->see('Cancel')
|
||||
->click('Cancel')
|
||||
->seePageIs($book->getUrl());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user