diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5a5f34e4a..fb2620bf4 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -19,7 +19,6 @@ class HomeController extends Controller parent::__construct(); } - /** * Display the homepage. * @return Response @@ -45,17 +44,36 @@ class HomeController extends Controller 'draftPages' => $draftPages, ]; + // Add required list ordering & sorting for books & shelves views. + if ($homepageOption === 'bookshelves' || $homepageOption === 'books') { + $key = $homepageOption; + $view = setting()->getUser($this->currentUser, $key . '_view_type', config('app.views.' . $key)); + $sort = setting()->getUser($this->currentUser, $key . '_sort', 'name'); + $order = setting()->getUser($this->currentUser, $key . '_sort_order', 'asc'); + + $sortOptions = [ + 'name' => trans('common.sort_name'), + 'created_at' => trans('common.sort_created_at'), + 'updated_at' => trans('common.sort_updated_at'), + ]; + + $commonData = array_merge($commonData, [ + 'view' => $view, + 'sort' => $sort, + 'order' => $order, + 'sortOptions' => $sortOptions, + ]); + } + if ($homepageOption === 'bookshelves') { - $shelves = $this->entityRepo->getAllPaginated('bookshelf', 18); - $shelvesViewType = setting()->getUser($this->currentUser, 'bookshelves_view_type', config('app.views.bookshelves', 'grid')); - $data = array_merge($commonData, ['shelves' => $shelves, 'shelvesViewType' => $shelvesViewType]); + $shelves = $this->entityRepo->getAllPaginated('bookshelf', 18, $commonData['sort'], $commonData['order']); + $data = array_merge($commonData, ['shelves' => $shelves]); return view('common.home-shelves', $data); } if ($homepageOption === 'books') { - $books = $this->entityRepo->getAllPaginated('book', 18); - $booksViewType = setting()->getUser($this->currentUser, 'books_view_type', config('app.views.books', 'list')); - $data = array_merge($commonData, ['books' => $books, 'booksViewType' => $booksViewType]); + $books = $this->entityRepo->getAllPaginated('book', 18, $commonData['sort'], $commonData['order']); + $data = array_merge($commonData, ['books' => $books]); return view('common.home-book', $data); } diff --git a/resources/assets/sass/_grid.scss b/resources/assets/sass/_grid.scss index 8c93b12d5..b8bd2cc04 100644 --- a/resources/assets/sass/_grid.scss +++ b/resources/assets/sass/_grid.scss @@ -231,7 +231,7 @@ div[class^="col-"] img { grid-template-columns: 2fr 1fr; } &.right-focus { - grid-template-columns: 1fr 2fr; + grid-template-columns: 1fr 3fr; } &.gap-xl { grid-column-gap: $-xl; diff --git a/resources/assets/sass/_lists.scss b/resources/assets/sass/_lists.scss index 3b3afad9d..43ec13cf6 100644 --- a/resources/assets/sass/_lists.scss +++ b/resources/assets/sass/_lists.scss @@ -371,6 +371,7 @@ ul.pagination { border: 0; width: 100%; position: relative; + word-break: break-word; h4 a { color: #666; } diff --git a/resources/views/common/home-book.blade.php b/resources/views/common/home-book.blade.php index 2849d5ecd..139c77c07 100644 --- a/resources/views/common/home-book.blade.php +++ b/resources/views/common/home-book.blade.php @@ -1,18 +1,26 @@ -@extends('sidebar-layout') - -@section('toolbar') -
-
- @icon('expand-text'){{ trans('common.toggle_details') }} - @include('books/view-toggle', ['booksViewType' => $booksViewType]) -
-
-@stop - -@section('sidebar') - @include('common/home-sidebar') -@stop +@extends('simple-layout') @section('body') - @include('books/list', ['books' => $books, 'bookViewType' => $booksViewType]) +
+
+
+ +
+
{{ trans('common.actions') }}
+
+ @include('partials.view-toggle', ['view' => $view, 'type' => 'book']) + + @icon('expand-text') + {{ trans('common.toggle_details') }} + +
+
+ + @include('common.home-sidebar') +
+
+ @include('books.list', ['books' => $books, 'view' => $view]) +
+
+
@stop \ No newline at end of file diff --git a/resources/views/common/home-custom.blade.php b/resources/views/common/home-custom.blade.php index 89154ee13..0ef3c2e25 100644 --- a/resources/views/common/home-custom.blade.php +++ b/resources/views/common/home-custom.blade.php @@ -1,19 +1,29 @@ -@extends('sidebar-layout') - -@section('toolbar') -
-
- @icon('expand-text'){{ trans('common.toggle_details') }} -
-
-@stop - -@section('sidebar') - @include('common/home-sidebar') -@stop +@extends('simple-layout') @section('body') -
- @include('pages/page-display', ['page' => $customHomepage]) +
+
+
+ + + + @include('common.home-sidebar') +
+
+
+
+ @include('pages.page-display', ['page' => $customHomepage]) +
+
+
+
-@stop +@stop \ No newline at end of file diff --git a/resources/views/common/home-shelves.blade.php b/resources/views/common/home-shelves.blade.php index 3ae055b33..8cb99b907 100644 --- a/resources/views/common/home-shelves.blade.php +++ b/resources/views/common/home-shelves.blade.php @@ -1,18 +1,26 @@ -@extends('sidebar-layout') - -@section('toolbar') -
-
- @icon('expand-text'){{ trans('common.toggle_details') }} - @include('shelves/view-toggle', ['shelvesViewType' => $shelvesViewType]) -
-
-@stop - -@section('sidebar') - @include('common/home-sidebar') -@stop +@extends('simple-layout') @section('body') - @include('shelves/list', ['shelves' => $shelves, 'shelvesViewType' => $shelvesViewType]) +
+
+
+ +
+
{{ trans('common.actions') }}
+
+ @include('partials.view-toggle', ['view' => $view, 'type' => 'shelf']) + + @icon('expand-text') + {{ trans('common.toggle_details') }} + +
+
+ + @include('common.home-sidebar') +
+
+ @include('shelves.list', ['shelves' => $shelves, 'view' => $view]) +
+
+
@stop \ No newline at end of file diff --git a/resources/views/common/home-sidebar.blade.php b/resources/views/common/home-sidebar.blade.php index 221029481..07eda2cff 100644 --- a/resources/views/common/home-sidebar.blade.php +++ b/resources/views/common/home-sidebar.blade.php @@ -1,23 +1,23 @@ @if(count($draftPages) > 0) -
-

@icon('edit') {{ trans('entities.my_recent_drafts') }}

- @include('partials/entity-list', ['entities' => $draftPages, 'style' => 'compact']) +
+
{{ trans('entities.my_recent_drafts') }}
+ @include('partials.entity-list', ['entities' => $draftPages, 'style' => 'compact'])
@endif -
-

@icon($signedIn ? 'view' : 'star-circle') {{ trans('entities.' . ($signedIn ? 'my_recently_viewed' : 'books_recent')) }}

- @include('partials/entity-list', [ +
+
{{ trans('entities.' . ($signedIn ? 'my_recently_viewed' : 'books_recent')) }}
+ @include('partials.entity-list', [ 'entities' => $recents, 'style' => 'compact', 'emptyText' => $signedIn ? trans('entities.no_pages_viewed') : trans('entities.books_empty') ])
-
-

@icon('file') {{ trans('entities.recently_updated_pages') }}

+
+
{{ trans('entities.recently_updated_pages') }}
- @include('partials/entity-list', [ + @include('partials.entity-list', [ 'entities' => $recentlyUpdatedPages, 'style' => 'compact', 'emptyText' => trans('entities.no_pages_recently_updated') @@ -25,7 +25,7 @@
-
-

@icon('time') {{ trans('entities.recent_activity') }}

- @include('partials/activity-list', ['activity' => $activity]) +
+
{{ trans('entities.recent_activity') }}
+ @include('partials.activity-list', ['activity' => $activity])
\ No newline at end of file diff --git a/resources/views/components/entity-selector.blade.php b/resources/views/components/entity-selector.blade.php index f11505473..6f8d04696 100644 --- a/resources/views/components/entity-selector.blade.php +++ b/resources/views/components/entity-selector.blade.php @@ -1,10 +1,10 @@
-
+
@include('partials.loading-icon')
- @if($showAdd) + @if($showAdd ?? false)