mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-18 10:28:43 +00:00
Merge pull request #3598 from BookStackApp/chapter_sort_book_option
Added 'Sort Book' action to chapters
This commit is contained in:
commit
4fa73be80e
3 changed files with 21 additions and 0 deletions
|
@ -171,6 +171,7 @@ return [
|
||||||
'chapters_permissions_active' => 'Chapter Permissions Active',
|
'chapters_permissions_active' => 'Chapter Permissions Active',
|
||||||
'chapters_permissions_success' => 'Chapter Permissions Updated',
|
'chapters_permissions_success' => 'Chapter Permissions Updated',
|
||||||
'chapters_search_this' => 'Search this chapter',
|
'chapters_search_this' => 'Search this chapter',
|
||||||
|
'chapter_sort_book' => 'Sort Book',
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
'page' => 'Page',
|
'page' => 'Page',
|
||||||
|
|
|
@ -147,6 +147,14 @@
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if($chapter->book && userCan('book-update', $chapter->book))
|
||||||
|
<hr class="primary-background"/>
|
||||||
|
<a href="{{ $chapter->book->getUrl('/sort') }}" class="icon-list-item">
|
||||||
|
<span>@icon('sort')</span>
|
||||||
|
<span>{{ trans('entities.chapter_sort_book') }}</span>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
<hr class="primary-background"/>
|
<hr class="primary-background"/>
|
||||||
|
|
||||||
@if(signedInUser())
|
@if(signedInUser())
|
||||||
|
|
|
@ -146,4 +146,16 @@ class ChapterTest extends TestCase
|
||||||
$newChapter2 = Chapter::query()->where('name', '=', 'My copied again chapter')->first();
|
$newChapter2 = Chapter::query()->where('name', '=', 'My copied again chapter')->first();
|
||||||
$this->assertEquals($chapter->pages()->count(), $newChapter2->pages()->count());
|
$this->assertEquals($chapter->pages()->count(), $newChapter2->pages()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_sort_book_action_visible_if_permissions_allow()
|
||||||
|
{
|
||||||
|
/** @var Chapter $chapter */
|
||||||
|
$chapter = Chapter::query()->first();
|
||||||
|
|
||||||
|
$resp = $this->actingAs($this->getViewer())->get($chapter->getUrl());
|
||||||
|
$this->withHtml($resp)->assertLinkNotExists($chapter->book->getUrl('sort'));
|
||||||
|
|
||||||
|
$resp = $this->asEditor()->get($chapter->getUrl());
|
||||||
|
$this->withHtml($resp)->assertLinkExists($chapter->book->getUrl('sort'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue