diff --git a/app/Auth/Queries/AllUsersPaginatedAndSorted.php b/app/Auth/Queries/AllUsersPaginatedAndSorted.php index 7b849eaf4..29e58fe09 100644 --- a/app/Auth/Queries/AllUsersPaginatedAndSorted.php +++ b/app/Auth/Queries/AllUsersPaginatedAndSorted.php @@ -19,6 +19,9 @@ class AllUsersPaginatedAndSorted public function run(int $count, array $sortData): LengthAwarePaginator { $sort = $sortData['sort']; + if ($sort === 'created_at') { + $sort = 'users.created_at'; + } $query = User::query()->select(['*']) ->scopes(['withLastActivityAt']) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 895481d02..9b089c29a 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -37,15 +37,15 @@ class UserController extends Controller { $this->checkPermission('users-manage'); $listDetails = [ - 'order' => $request->get('order', 'asc'), 'search' => $request->get('search', ''), - 'sort' => $request->get('sort', 'name'), + 'sort' => setting()->getForCurrentUser('users_sort', 'name'), + 'order' => setting()->getForCurrentUser('users_sort_order', 'asc'), ]; $users = (new AllUsersPaginatedAndSorted())->run(20, $listDetails); $this->setPageTitle(trans('settings.users')); - $users->appends($listDetails); + $users->appends(['search' => $listDetails['search']]); return view('users.index', [ 'users' => $users, @@ -251,7 +251,7 @@ class UserController extends Controller */ public function changeSort(Request $request, string $id, string $type) { - $validSortTypes = ['books', 'bookshelves', 'shelf_books']; + $validSortTypes = ['books', 'bookshelves', 'shelf_books', 'users']; if (!in_array($type, $validSortTypes)) { return redirect()->back(500); } @@ -318,7 +318,7 @@ class UserController extends Controller $this->checkPermissionOrCurrentUser('users-manage', $userId); $sort = $request->get('sort'); - if (!in_array($sort, ['name', 'created_at', 'updated_at', 'default'])) { + if (!in_array($sort, ['name', 'created_at', 'updated_at', 'default', 'email', 'last_activity_at'])) { $sort = 'name'; } diff --git a/resources/js/components/entity-permissions.js b/resources/js/components/entity-permissions.js index c67c85f19..0dec5ca09 100644 --- a/resources/js/components/entity-permissions.js +++ b/resources/js/components/entity-permissions.js @@ -62,7 +62,7 @@ class EntityPermissions { } removeRowOnButtonClick(button) { - const row = button.closest('.content-permissions-row'); + const row = button.closest('.item-list-row'); const roleId = button.dataset.roleId; const roleName = button.dataset.roleName; diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index 1ad271e7c..d4d6d3bae 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -172,6 +172,7 @@ return [ // Users 'users' => 'Users', + 'users_index_desc' => 'Create & manage individual user accounts within the system. User accounts are used for login and attribution of content & activity. Access permissions are primarily role-based but user content ownership, among other factors, may also affect permissions & access.', 'user_profile' => 'User Profile', 'users_add_new' => 'Add New User', 'users_search' => 'Search Users', diff --git a/resources/sass/_components.scss b/resources/sass/_components.scss index 9fdd5a611..667c26388 100644 --- a/resources/sass/_components.scss +++ b/resources/sass/_components.scss @@ -798,37 +798,6 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group { max-width: 500px; } -.content-permissions { - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); -} -.content-permissions-row { - border: 1.5px solid; - @include lightDark(border-color, #E2E2E2, #444); - border-bottom-width: 0; - label { - padding-bottom: 0; - } - &:hover { - @include lightDark(background-color, #F2F2F2, #333); - } -} -.content-permissions-row:first-child { - border-radius: 4px 4px 0 0; -} -.content-permissions-row:last-child { - border-radius: 0 0 4px 4px; - border-bottom-width: 1.5px; -} -.content-permissions-row:first-child:last-child { - border-radius: 4px; -} -.content-permissions-row-toggle-all { - visibility: hidden; -} -.content-permissions-row:hover .content-permissions-row-toggle-all { - visibility: visible; -} - .template-item { cursor: pointer; position: relative; @@ -969,4 +938,35 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group { .dropdown-search-dropdown .dropdown-search-list { max-height: 240px; } +} + +.item-list { + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); +} +.item-list-row { + border: 1.5px solid; + @include lightDark(border-color, #E2E2E2, #444); + border-bottom-width: 0; + label { + padding-bottom: 0; + } + &:hover { + @include lightDark(background-color, #F6F6F6, #333); + } +} +.item-list-row:first-child { + border-radius: 4px 4px 0 0; +} +.item-list-row:last-child { + border-radius: 0 0 4px 4px; + border-bottom-width: 1.5px; +} +.item-list-row:first-child:last-child { + border-radius: 4px; +} +.item-list-row-toggle-all { + visibility: hidden; +} +.item-list-row:hover .item-list-row-toggle-all { + visibility: visible; } \ No newline at end of file diff --git a/resources/sass/_layout.scss b/resources/sass/_layout.scss index cfb8397c9..d4413d32c 100644 --- a/resources/sass/_layout.scss +++ b/resources/sass/_layout.scss @@ -158,6 +158,18 @@ body.flexbox { } } +.flex-2 { + min-height: 0; + flex: 2; + max-width: 100%; +} + +.flex-3 { + min-height: 0; + flex: 3; + max-width: 100%; +} + .flex-none { flex: none; } @@ -178,6 +190,27 @@ body.flexbox { align-items: center; } +/** + * Min width utilities + */ +.min-width-xs { + min-width: 120px; +} +.min-width-s { + min-width: 160px; +} +.min-width-m { + min-width: 200px; +} +.min-width-l { + min-width: 240px; +} +.min-width-xl { + min-width: 280px; +} +.min-width-xxl { + min-width: 320px; +} /** * Display and float utilities diff --git a/resources/views/books/parts/list.blade.php b/resources/views/books/parts/list.blade.php index 30b076613..79d0554c5 100644 --- a/resources/views/books/parts/list.blade.php +++ b/resources/views/books/parts/list.blade.php @@ -3,7 +3,7 @@

{{ trans('entities.books') }}

- @include('entities.sort', ['options' => [ + @include('common.sort', ['options' => [ 'name' => trans('common.sort_name'), 'created_at' => trans('common.sort_created_at'), 'updated_at' => trans('common.sort_updated_at'), @@ -19,11 +19,11 @@ @endforeach
@else -
+
@foreach($books as $key => $book) @include('entities.grid-item', ['entity' => $book]) @endforeach -
+
@endif
{!! $books->render() !!} diff --git a/resources/views/entities/sort.blade.php b/resources/views/common/sort.blade.php similarity index 100% rename from resources/views/entities/sort.blade.php rename to resources/views/common/sort.blade.php diff --git a/resources/views/form/entity-permissions-row.blade.php b/resources/views/form/entity-permissions-row.blade.php index d2e6a4756..d4c6c4ac1 100644 --- a/resources/views/form/entity-permissions-row.blade.php +++ b/resources/views/form/entity-permissions-row.blade.php @@ -5,7 +5,7 @@ $permission - The entity permission containing the permissions. $inheriting - Boolean if the current row should be marked as inheriting default permissions. Used for "Everyone Else" role. --}} -
+
@icon($role->id === 0 ? 'groups' : 'role') @@ -16,7 +16,7 @@ $inheriting - Boolean if the current row should be marked as inheriting default @if($role->id !== 0) @endif diff --git a/resources/views/form/entity-permissions.blade.php b/resources/views/form/entity-permissions.blade.php index 724d0fb39..9bf309fb8 100644 --- a/resources/views/form/entity-permissions.blade.php +++ b/resources/views/form/entity-permissions.blade.php @@ -35,7 +35,7 @@
-
+
@foreach($data->permissionsWithRoles() as $permission) @include('form.entity-permissions-row', [ 'permission' => $permission, @@ -58,7 +58,7 @@
-
+
@include('form.entity-permissions-row', [ 'role' => $data->everyoneElseRole(), 'permission' => $data->everyoneElseEntityPermission(), diff --git a/resources/views/shelves/parts/list.blade.php b/resources/views/shelves/parts/list.blade.php index d78606ac7..4c841db64 100644 --- a/resources/views/shelves/parts/list.blade.php +++ b/resources/views/shelves/parts/list.blade.php @@ -1,10 +1,9 @@ -

{{ trans('entities.shelves') }}

- @include('entities.sort', ['options' => $sortOptions, 'order' => $order, 'sort' => $sort, 'type' => 'bookshelves']) + @include('common.sort', ['options' => $sortOptions, 'order' => $order, 'sort' => $sort, 'type' => 'bookshelves'])
@@ -31,7 +30,8 @@ @else

{{ trans('entities.shelves_empty') }}

@if(userCan('bookshelf-create-all')) - @icon('edit'){{ trans('entities.create_now') }} + @icon('edit'){{ trans('entities.create_now') }} @endif @endif diff --git a/resources/views/shelves/show.blade.php b/resources/views/shelves/show.blade.php index 37d288956..fe11ccfce 100644 --- a/resources/views/shelves/show.blade.php +++ b/resources/views/shelves/show.blade.php @@ -23,7 +23,7 @@

{{ $shelf->name }}

- @include('entities.sort', ['options' => [ + @include('common.sort', ['options' => [ 'default' => trans('common.sort_default'), 'name' => trans('common.sort_name'), 'created_at' => trans('common.sort_created_at'), diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php index 03eae2c00..daa41d7d7 100644 --- a/resources/views/users/index.blade.php +++ b/resources/views/users/index.blade.php @@ -9,37 +9,37 @@

{{ trans('settings.users') }}

-
-
-
- @foreach(collect($listDetails)->except('search') as $name => $val) - - @endforeach - -
-
{{ trans('settings.users_add_new') }}
- - - - - - - +

{{ trans('settings.users_index_desc') }}

+ +
+
+
+
+ + +
+
+
+ @include('common.sort', ['options' => [ + 'name' => trans('common.sort_name'), + 'email' => trans('auth.email'), + 'created_at' => trans('common.sort_created_at'), + 'updated_at' => trans('common.sort_updated_at'), + 'last_activity_at' => trans('settings.users_latest_activity'), + ], 'order' => $listDetails['order'], 'sort' => $listDetails['sort'], 'type' => 'users']) +
+
+ +
@foreach($users as $user) -
- - - - - + +
+
+ @foreach($user->roles as $index => $role) + id}") }}">{{$role->display_name}}@if($index !== count($user->roles) -1),@endif + @endforeach +
+
+ @if($user->last_activity_at) + {{ trans('settings.users_latest_activity') }} +
+ {{ $user->last_activity_at->diffForHumans() }} + @endif +
+
+ @endforeach -
- {{ trans('auth.name') }} - / - {{ trans('auth.email') }} - {{ trans('settings.role_user_roles') }} - {{ trans('settings.users_latest_activity') }} -
{{ $user->name }} + - @foreach($user->roles as $index => $role) - id}") }}">{{$role->display_name}}@if($index !== count($user->roles) -1),@endif - @endforeach - - @if($user->last_activity_at) - {{ $user->last_activity_at->diffForHumans() }} - @endif -
+
{{ $users->links() }}