Merge branch 'fix/#1662' of git://github.com/cw1998/BookStack into cw1998-fix/#1662
This commit is contained in:
		
						commit
						28184c6bfc
					
				| 
						 | 
					@ -36,6 +36,15 @@
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="form-group text-right">
 | 
					<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>
 | 
					    <button type="submit" class="button">{{ trans('entities.books_save') }}</button>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
<?php namespace Tests;
 | 
					<?php namespace Tests;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use BookStack\Entities\Bookshelf;
 | 
				
			||||||
use BookStack\Entities\Book;
 | 
					use BookStack\Entities\Book;
 | 
				
			||||||
use BookStack\Entities\Chapter;
 | 
					use BookStack\Entities\Chapter;
 | 
				
			||||||
use BookStack\Entities\Page;
 | 
					use BookStack\Entities\Page;
 | 
				
			||||||
| 
						 | 
					@ -289,4 +290,29 @@ class EntityTest extends BrowserKitTest
 | 
				
			||||||
        $this->assertEquals('parta-partb-partc', $book->slug);
 | 
					        $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