diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index f166ce2e8..55ca5be19 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -209,7 +209,13 @@ class UserController extends Controller { $user = $this->userRepo->getById($id); $userActivity = $this->userRepo->getActivity($user); - $recentPages = $this->userRepo->getCreatedPages($user, 5, 0); - return view('users/profile', ['user' => $user, 'activity' => $userActivity, 'recentPages' => $recentPages]); + $recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5, 0); + $assetCounts = $this->userRepo->getAssetCounts($user); + return view('users/profile', [ + 'user' => $user, + 'activity' => $userActivity, + 'recentlyCreated' => $recentlyCreated, + 'assetCounts' => $assetCounts + ]); } } diff --git a/app/Repos/UserRepo.php b/app/Repos/UserRepo.php index 380eb24c9..d430616f5 100644 --- a/app/Repos/UserRepo.php +++ b/app/Repos/UserRepo.php @@ -5,6 +5,7 @@ use BookStack\Page; use BookStack\Role; use BookStack\Services\EntityService; use BookStack\User; +use Carbon\Carbon; use Setting; class UserRepo @@ -132,20 +133,26 @@ class UserRepo } /** - * Get the pages the the given user has created. + * Get the recently created content for this given user. * @param User $user * @param int $count - * @param int $page * @return mixed */ - public function getCreatedPages(User $user, $count = 20, $page = 0) + public function getRecentlyCreated(User $user, $count = 20) { - return $this->entityService->page->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') - ->skip($page * $count)->take($count)->get(); + return [ + 'pages' => $this->entityService->page->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') + ->take($count)->get(), + 'chapters' => $this->entityService->chapter->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') + ->take($count)->get(), + 'books' => $this->entityService->book->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') + ->take($count)->get() + ]; } /** * Get asset created counts for the give user. + * @param User $user * @return array */ public function getAssetCounts(User $user) @@ -156,4 +163,5 @@ class UserRepo 'books' => $this->entityService->book->where('created_by', '=', $user->id)->count(), ]; } + } \ No newline at end of file diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 499896631..4f14837a0 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -251,6 +251,13 @@ ol { text-align: right; } +.text-bigger { + font-size: 1.1em; +} +.text-large { + font-size: 1.6666em; +} + /** * Grouping */ diff --git a/resources/assets/sass/styles.scss b/resources/assets/sass/styles.scss index 6b1c1400d..4e6823fc0 100644 --- a/resources/assets/sass/styles.scss +++ b/resources/assets/sass/styles.scss @@ -47,6 +47,13 @@ body.dragging, body.dragging * { width: 80px; height: 80px; } + &.huge { + width: 120px; + height: 120px; + } + &.square { + border-radius: 3px; + } } // System wide notifications diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php index b00ccc042..0df49485e 100644 --- a/resources/views/base.blade.php +++ b/resources/views/base.blade.php @@ -58,10 +58,13 @@ diff --git a/resources/views/partials/activity-item.blade.php b/resources/views/partials/activity-item.blade.php index 1471bdb50..f94fad5e1 100644 --- a/resources/views/partials/activity-item.blade.php +++ b/resources/views/partials/activity-item.blade.php @@ -9,7 +9,7 @@
@if($activity->user) - {{$activity->user->name}} + {{$activity->user->name}} @else A deleted user @endif diff --git a/resources/views/users/profile.blade.php b/resources/views/users/profile.blade.php index 747fdafeb..20b16894e 100644 --- a/resources/views/users/profile.blade.php +++ b/resources/views/users/profile.blade.php @@ -4,18 +4,68 @@
-
+
- {{ $user->name }} -

{{ $user->name }}

-

- User for {{ $user->created_at->diffForHumans(null, true) }} -

+
+
+
+
+ {{ $user->name }} +
+
+

{{ $user->name }}

+

+ User for {{ $user->created_at->diffForHumans(null, true) }} +

+
+
+
+
+
Created Content
+
+ {{ $assetCounts['books'] }} {{ str_plural('Book', $assetCounts['books']) }} +
+
+ {{ $assetCounts['chapters'] }} {{ str_plural('Chapter', $assetCounts['chapters']) }} +
+
+ {{ $assetCounts['pages'] }} {{ str_plural('Page', $assetCounts['pages']) }} +
+
+
+ + +
+ +

Recently Created Pages

+ @if (count($recentlyCreated['pages']) > 0) + @include('partials/entity-list', ['entities' => $recentlyCreated['pages']]) + @else +

{{ $user->name }} has not created any pages

+ @endif + +
+ +

Recently Created Chapters

+ @if (count($recentlyCreated['chapters']) > 0) + @include('partials/entity-list', ['entities' => $recentlyCreated['chapters']]) + @else +

{{ $user->name }} has not created any chapters

+ @endif + +
+ +

Recently Created Books

+ @if (count($recentlyCreated['books']) > 0) + @include('partials/entity-list', ['entities' => $recentlyCreated['books']]) + @else +

{{ $user->name }} has not created any books

+ @endif
-
+

Recent Activity

@include('partials/activity-list', ['activity' => $activity])