diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index fb2620bf4..c5f3cd02a 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -123,7 +123,7 @@ class HomeController extends Controller */ public function customHeadContent() { - return view('partials/custom-head-content'); + return view('partials.custom-head-content'); } /** @@ -138,7 +138,7 @@ class HomeController extends Controller $allowRobots = $sitePublic; } return response() - ->view('common/robots', ['allowRobots' => $allowRobots]) + ->view('common.robots', ['allowRobots' => $allowRobots]) ->header('Content-Type', 'text/plain'); } @@ -147,6 +147,6 @@ class HomeController extends Controller */ public function getNotFound() { - return response()->view('errors/404', [], 404); + return response()->view('errors.404', [], 404); } } diff --git a/resources/views/components/image-manager.blade.php b/resources/views/components/image-manager.blade.php index 2d1755e46..ef45c0001 100644 --- a/resources/views/components/image-manager.blade.php +++ b/resources/views/components/image-manager.blade.php @@ -1,4 +1,4 @@ -<div id="image-manager" image-type="{{ $imageType }}" uploaded-to="{{ $uploaded_to or 0 }}"> +<div id="image-manager" image-type="{{ $imageType }}" uploaded-to="{{ $uploaded_to ?? 0 }}"> <div overlay v-cloak @click="hide"> <div class="popup-body" @click.stop=""> diff --git a/resources/views/components/image-picker.blade.php b/resources/views/components/image-picker.blade.php index 630006d82..27fa26528 100644 --- a/resources/views/components/image-picker.blade.php +++ b/resources/views/components/image-picker.blade.php @@ -1,4 +1,4 @@ -<div class="image-picker" image-picker="{{$name}}" data-default-image="{{ $defaultImage }}" data-resize-height="{{ $resizeHeight }}" data-resize-width="{{ $resizeWidth }}" data-current-id="{{ $currentId or '' }}" data-resize-crop="{{ $resizeCrop or '' }}"> +<div class="image-picker" image-picker="{{$name}}" data-default-image="{{ $defaultImage }}" data-resize-height="{{ $resizeHeight }}" data-resize-width="{{ $resizeWidth }}" data-current-id="{{ $currentId ?? '' }}" data-resize-crop="{{ $resizeCrop ?? '' }}"> <div class="grid half"> <div class="text-center"> diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php index 9c431828a..e13e1fce9 100644 --- a/resources/views/errors/404.blade.php +++ b/resources/views/errors/404.blade.php @@ -1,36 +1,45 @@ @extends('simple-layout') @section('content') -<div class="container"> +<div class="container mt-l"> - <p> </p> - - <div class="card"> - <h3>@icon('danger') {{ $message or trans('errors.404_page_not_found') }}</h3> - <div class="body"> - <h5>{{ trans('errors.sorry_page_not_found') }}</h5> - <p><a href="{{ baseUrl('/') }}" class="button outline">{{ trans('errors.return_home') }}</a></p> + <div class="card mb-xl px-l pb-xl pt-l"> + <div class="grid half v-center"> + <div> + <h1 class="list-heading">{{ $message ?? trans('errors.404_page_not_found') }}</h1> + <h5>{{ trans('errors.sorry_page_not_found') }}</h5> + </div> + <div class="text-right"> + <a href="{{ baseUrl('/') }}" class="button outline">{{ trans('errors.return_home') }}</a> + </div> </div> + </div> @if (setting('app-public') || !user()->isDefault()) - <div class="row"> - <div class="col-md-4"> - <div class="card"> - <h3 class="text-muted">@icon('page') {{ trans('entities.pages_popular') }}</h3> - @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, [\BookStack\Entities\Page::class]), 'style' => 'compact']) + <div class="grid third gap-xxl"> + <div> + <div class="card mb-xl"> + <h3>{{ trans('entities.pages_popular') }}</h3> + <div class="px-m"> + @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, 'page'), 'style' => 'compact']) + </div> </div> </div> - <div class="col-md-4"> - <div class="card"> - <h3 class="text-muted">@icon('book') {{ trans('entities.books_popular') }}</h3> - @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, [\BookStack\Entities\Book::class]), 'style' => 'compact']) + <div> + <div class="card mb-xl"> + <h3>{{ trans('entities.books_popular') }}</h3> + <div class="px-m"> + @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, 'book'), 'style' => 'compact']) + </div> </div> </div> - <div class="col-md-4"> - <div class="card"> - <h3 class="text-muted">@icon('chapter') {{ trans('entities.chapters_popular') }}</h3> - @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, [\BookStack\Entities\Chapter::class]), 'style' => 'compact']) + <div> + <div class="card mb-xl"> + <h3>{{ trans('entities.chapters_popular') }}</h3> + <div class="px-m"> + @include('partials.entity-list', ['entities' => Views::getPopular(10, 0, 'chapter'), 'style' => 'compact']) + </div> </div> </div> </div> diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php index a01234d81..3745f2292 100644 --- a/resources/views/errors/500.blade.php +++ b/resources/views/errors/500.blade.php @@ -6,7 +6,7 @@ <div class="card"> <h3 class="text-muted">{{ trans('errors.error_occurred') }}</h3> <div class="body"> - <h5>{{ $message or 'An unknown error occurred' }}</h5> + <h5>{{ $message ?? 'An unknown error occurred' }}</h5> <p><a href="{{ baseUrl('/') }}" class="button outline">{{ trans('errors.return_home') }}</a></p> </div> </div> diff --git a/resources/views/pages/form-toolbox.blade.php b/resources/views/pages/form-toolbox.blade.php index 6b3ad3a92..71c96ff54 100644 --- a/resources/views/pages/form-toolbox.blade.php +++ b/resources/views/pages/form-toolbox.blade.php @@ -17,7 +17,7 @@ </div> @if(userCan('attachment-create-all')) - <div toolbox-tab-content="files" id="attachment-manager" page-id="{{ $page->id or 0 }}"> + <div toolbox-tab-content="files" id="attachment-manager" page-id="{{ $page->id ?? 0 }}"> <h4>{{ trans('entities.attachments') }}</h4> <div class="padded files"> diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php index 20152895a..911156fe1 100644 --- a/resources/views/pages/form.blade.php +++ b/resources/views/pages/form.blade.php @@ -3,10 +3,10 @@ drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}" drawio-enabled="{{ config('services.drawio') ? 'true' : 'false' }}" editor-type="{{ setting('app-editor') }}" - page-id="{{ $model->id or 0 }}" + page-id="{{ $model->id ?? 0 }}" text-direction="{{ config('app.rtl') ? 'rtl' : 'ltr' }}" - page-new-draft="{{ $model->draft or 0 }}" - page-update-draft="{{ $model->isDraft or 0 }}"> + page-new-draft="{{ $model->draft ?? 0 }}" + page-update-draft="{{ $model->isDraft ?? 0 }}"> {{ csrf_field() }} diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php index 4114d4af9..3eb50a412 100644 --- a/tests/Entity/EntitySearchTest.php +++ b/tests/Entity/EntitySearchTest.php @@ -197,11 +197,11 @@ class EntitySearchTest extends TestCase $pageSearch = $this->get('/ajax/search/entities?term=' . urlencode($page->name)); $pageSearch->assertSee($page->name); - $pageSearch->assertSee($chapter->getShortName()); - $pageSearch->assertSee($page->book->getShortName()); + $pageSearch->assertSee($chapter->getShortName(42)); + $pageSearch->assertSee($page->book->getShortName(42)); $chapterSearch = $this->get('/ajax/search/entities?term=' . urlencode($chapter->name)); $chapterSearch->assertSee($chapter->name); - $chapterSearch->assertSee($chapter->book->getShortName()); + $chapterSearch->assertSee($chapter->book->getShortName(42)); } } diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.php index ef9597d32..a3fb1cfe1 100644 --- a/tests/Entity/EntityTest.php +++ b/tests/Entity/EntityTest.php @@ -65,9 +65,7 @@ class EntityTest extends BrowserKitTest ->click('Sort') ->seePageIs($bookToSort->getUrl() . '/sort') ->seeStatusCode(200) - ->see($bookToSort->name) - // Ensure page shows other books - ->see($books[1]->name); + ->see($bookToSort->name); } public function test_book_sort_item_returns_book_content() @@ -224,15 +222,6 @@ class EntityTest extends BrowserKitTest ->click('Revisions')->seeStatusCode(200); } - public function test_recently_created_pages_view() - { - $user = $this->getEditor(); - $content = $this->createEntityChainBelongingToUser($user); - - $this->asAdmin()->visit('/pages/recently-created') - ->seeInNthElement('.entity-list .page', 0, $content['page']->name); - } - public function test_recently_updated_pages_view() { $user = $this->getEditor(); diff --git a/tests/Entity/PageDraftTest.php b/tests/Entity/PageDraftTest.php index 1ebd5860b..f15651f39 100644 --- a/tests/Entity/PageDraftTest.php +++ b/tests/Entity/PageDraftTest.php @@ -87,13 +87,13 @@ class PageDraftTest extends BrowserKitTest ->visit($book->getUrl() . '/create-page') ->visit($chapter->getUrl() . '/create-page') ->visit($book->getUrl()) - ->seeInElement('.page-list', 'New Page'); + ->seeInElement('.book-contents', 'New Page'); $this->asAdmin() ->visit($book->getUrl()) - ->dontSeeInElement('.page-list', 'New Page') + ->dontSeeInElement('.book-contents', 'New Page') ->visit($chapter->getUrl()) - ->dontSeeInElement('.page-list', 'New Page'); + ->dontSeeInElement('.book-contents', 'New Page'); } } diff --git a/tests/HomepageTest.php b/tests/HomepageTest.php index 86cae7893..2c8b8d5c0 100644 --- a/tests/HomepageTest.php +++ b/tests/HomepageTest.php @@ -62,7 +62,7 @@ class HomepageTest extends TestCase $this->asEditor(); $homeVisit = $this->get('/'); $homeVisit->assertSee('Books'); - $homeVisit->assertSee('book-grid-item grid-card'); + $homeVisit->assertSee('grid-card'); $homeVisit->assertSee('grid-card-content'); $homeVisit->assertSee('grid-card-footer'); $homeVisit->assertSee('featured-image-container'); diff --git a/tests/Permissions/RestrictionsTest.php b/tests/Permissions/RestrictionsTest.php index 351132ffe..a7f681a37 100644 --- a/tests/Permissions/RestrictionsTest.php +++ b/tests/Permissions/RestrictionsTest.php @@ -131,12 +131,12 @@ class RestrictionsTest extends BrowserKitTest $bookUrl = $book->getUrl(); $this->actingAs($this->viewer) ->visit($bookUrl) - ->dontSeeInElement('.action-buttons', 'New Page') - ->dontSeeInElement('.action-buttons', 'New Chapter'); + ->dontSeeInElement('.actions', 'New Page') + ->dontSeeInElement('.actions', 'New Chapter'); $this->actingAs($this->user) ->visit($bookUrl) - ->seeInElement('.action-buttons', 'New Page') - ->seeInElement('.action-buttons', 'New Chapter'); + ->seeInElement('.actions', 'New Page') + ->seeInElement('.actions', 'New Chapter'); $this->setEntityRestrictions($book, ['view', 'delete', 'update']); @@ -144,8 +144,8 @@ class RestrictionsTest extends BrowserKitTest ->see('You do not have permission')->seePageIs('/'); $this->forceVisit($bookUrl . '/create-page') ->see('You do not have permission')->seePageIs('/'); - $this->visit($bookUrl)->dontSeeInElement('.action-buttons', 'New Page') - ->dontSeeInElement('.action-buttons', 'New Chapter'); + $this->visit($bookUrl)->dontSeeInElement('.actions', 'New Page') + ->dontSeeInElement('.actions', 'New Chapter'); $this->setEntityRestrictions($book, ['view', 'create']); @@ -159,8 +159,8 @@ class RestrictionsTest extends BrowserKitTest ->type('test content', 'html') ->press('Save Page') ->seePageIs($bookUrl . '/page/test-page'); - $this->visit($bookUrl)->seeInElement('.action-buttons', 'New Page') - ->seeInElement('.action-buttons', 'New Chapter'); + $this->visit($bookUrl)->seeInElement('.actions', 'New Page') + ->seeInElement('.actions', 'New Chapter'); } public function test_book_update_restriction() @@ -255,13 +255,13 @@ class RestrictionsTest extends BrowserKitTest $chapterUrl = $chapter->getUrl(); $this->actingAs($this->user) ->visit($chapterUrl) - ->seeInElement('.action-buttons', 'New Page'); + ->seeInElement('.actions', 'New Page'); $this->setEntityRestrictions($chapter, ['view', 'delete', 'update']); $this->forceVisit($chapterUrl . '/create-page') ->see('You do not have permission')->seePageIs('/'); - $this->visit($chapterUrl)->dontSeeInElement('.action-buttons', 'New Page'); + $this->visit($chapterUrl)->dontSeeInElement('.actions', 'New Page'); $this->setEntityRestrictions($chapter, ['view', 'create']); @@ -272,7 +272,7 @@ class RestrictionsTest extends BrowserKitTest ->press('Save Page') ->seePageIs($chapter->book->getUrl() . '/page/test-page'); - $this->visit($chapterUrl)->seeInElement('.action-buttons', 'New Page'); + $this->visit($chapterUrl)->seeInElement('.actions', 'New Page'); } public function test_chapter_update_restriction() @@ -535,8 +535,8 @@ class RestrictionsTest extends BrowserKitTest $bookUrl = $book->getUrl(); $this->actingAs($this->viewer) ->visit($bookUrl) - ->dontSeeInElement('.action-buttons', 'New Page') - ->dontSeeInElement('.action-buttons', 'New Chapter'); + ->dontSeeInElement('.actions', 'New Page') + ->dontSeeInElement('.actions', 'New Chapter'); $this->setEntityRestrictions($book, ['view', 'delete', 'update']); @@ -544,8 +544,8 @@ class RestrictionsTest extends BrowserKitTest ->see('You do not have permission')->seePageIs('/'); $this->forceVisit($bookUrl . '/create-page') ->see('You do not have permission')->seePageIs('/'); - $this->visit($bookUrl)->dontSeeInElement('.action-buttons', 'New Page') - ->dontSeeInElement('.action-buttons', 'New Chapter'); + $this->visit($bookUrl)->dontSeeInElement('.actions', 'New Page') + ->dontSeeInElement('.actions', 'New Chapter'); $this->setEntityRestrictions($book, ['view', 'create']); @@ -559,8 +559,8 @@ class RestrictionsTest extends BrowserKitTest ->type('test content', 'html') ->press('Save Page') ->seePageIs($bookUrl . '/page/test-page'); - $this->visit($bookUrl)->seeInElement('.action-buttons', 'New Page') - ->seeInElement('.action-buttons', 'New Chapter'); + $this->visit($bookUrl)->seeInElement('.actions', 'New Page') + ->seeInElement('.actions', 'New Chapter'); } public function test_book_update_restriction_override() @@ -645,11 +645,9 @@ class RestrictionsTest extends BrowserKitTest { $firstBook = Book::first(); $secondBook = Book::find(2); - $thirdBook = Book::find(3); $this->setEntityRestrictions($firstBook, ['view', 'update']); $this->setEntityRestrictions($secondBook, ['view']); - $this->setEntityRestrictions($thirdBook, ['view', 'update']); // Test sort page visibility $this->actingAs($this->user)->visit($secondBook->getUrl() . '/sort') @@ -657,9 +655,7 @@ class RestrictionsTest extends BrowserKitTest ->seePageIs('/'); // Check sort page on first book - $this->actingAs($this->user)->visit($firstBook->getUrl() . '/sort') - ->see($thirdBook->name) - ->dontSee($secondBook->name); + $this->actingAs($this->user)->visit($firstBook->getUrl() . '/sort'); } public function test_book_sort_permission() { diff --git a/tests/Permissions/RolesTest.php b/tests/Permissions/RolesTest.php index da2abb0bd..423db1bf0 100644 --- a/tests/Permissions/RolesTest.php +++ b/tests/Permissions/RolesTest.php @@ -632,8 +632,8 @@ class RolesTest extends BrowserKitTest { $user = \BookStack\Auth\User::first(); $this->asAdmin()->visit('/settings/users/' . $user->id) - ->seeElement('#roles-admin') - ->seeElement('#roles-public'); + ->seeElement('[name="roles[admin]"]') + ->seeElement('[name="roles[public]"]'); } public function test_public_role_visible_in_role_listing() diff --git a/tests/UserProfileTest.php b/tests/UserProfileTest.php index 0c29f63c5..a7c7505a8 100644 --- a/tests/UserProfileTest.php +++ b/tests/UserProfileTest.php @@ -59,9 +59,9 @@ class UserProfileTest extends BrowserKitTest \Activity::add($entities['page'], 'page_create', $entities['book']->id); $this->asAdmin()->visit('/user/' . $newUser->id) - ->seeInElement('#recent-activity', 'updated book') - ->seeInElement('#recent-activity', 'created page') - ->seeInElement('#recent-activity', $entities['page']->name); + ->seeInElement('#recent-user-activity', 'updated book') + ->seeInElement('#recent-user-activity', 'created page') + ->seeInElement('#recent-user-activity', $entities['page']->name); } public function test_clicking_user_name_in_activity_leads_to_profile_page() @@ -103,7 +103,7 @@ class UserProfileTest extends BrowserKitTest $this->actingAs($editor) ->visit('/books') ->pageNotHasElement('.featured-image-container') - ->pageHasElement('.content .entity-list-item'); + ->pageHasElement('.content-wrap .entity-list-item'); } public function test_books_view_is_grid()