Showing
7 changed files
with
98 additions
and
17 deletions
| ... | @@ -209,7 +209,13 @@ class UserController extends Controller | ... | @@ -209,7 +209,13 @@ class UserController extends Controller |
| 209 | { | 209 | { |
| 210 | $user = $this->userRepo->getById($id); | 210 | $user = $this->userRepo->getById($id); |
| 211 | $userActivity = $this->userRepo->getActivity($user); | 211 | $userActivity = $this->userRepo->getActivity($user); |
| 212 | - $recentPages = $this->userRepo->getCreatedPages($user, 5, 0); | 212 | + $recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5, 0); |
| 213 | - return view('users/profile', ['user' => $user, 'activity' => $userActivity, 'recentPages' => $recentPages]); | 213 | + $assetCounts = $this->userRepo->getAssetCounts($user); |
| 214 | + return view('users/profile', [ | ||
| 215 | + 'user' => $user, | ||
| 216 | + 'activity' => $userActivity, | ||
| 217 | + 'recentlyCreated' => $recentlyCreated, | ||
| 218 | + 'assetCounts' => $assetCounts | ||
| 219 | + ]); | ||
| 214 | } | 220 | } |
| 215 | } | 221 | } | ... | ... |
| ... | @@ -5,6 +5,7 @@ use BookStack\Page; | ... | @@ -5,6 +5,7 @@ use BookStack\Page; |
| 5 | use BookStack\Role; | 5 | use BookStack\Role; |
| 6 | use BookStack\Services\EntityService; | 6 | use BookStack\Services\EntityService; |
| 7 | use BookStack\User; | 7 | use BookStack\User; |
| 8 | +use Carbon\Carbon; | ||
| 8 | use Setting; | 9 | use Setting; |
| 9 | 10 | ||
| 10 | class UserRepo | 11 | class UserRepo |
| ... | @@ -132,20 +133,26 @@ class UserRepo | ... | @@ -132,20 +133,26 @@ class UserRepo |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | /** | 135 | /** |
| 135 | - * Get the pages the the given user has created. | 136 | + * Get the recently created content for this given user. |
| 136 | * @param User $user | 137 | * @param User $user |
| 137 | * @param int $count | 138 | * @param int $count |
| 138 | - * @param int $page | ||
| 139 | * @return mixed | 139 | * @return mixed |
| 140 | */ | 140 | */ |
| 141 | - public function getCreatedPages(User $user, $count = 20, $page = 0) | 141 | + public function getRecentlyCreated(User $user, $count = 20) |
| 142 | { | 142 | { |
| 143 | - return $this->entityService->page->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') | 143 | + return [ |
| 144 | - ->skip($page * $count)->take($count)->get(); | 144 | + 'pages' => $this->entityService->page->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') |
| 145 | + ->take($count)->get(), | ||
| 146 | + 'chapters' => $this->entityService->chapter->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') | ||
| 147 | + ->take($count)->get(), | ||
| 148 | + 'books' => $this->entityService->book->where('created_by', '=', $user->id)->orderBy('created_at', 'desc') | ||
| 149 | + ->take($count)->get() | ||
| 150 | + ]; | ||
| 145 | } | 151 | } |
| 146 | 152 | ||
| 147 | /** | 153 | /** |
| 148 | * Get asset created counts for the give user. | 154 | * Get asset created counts for the give user. |
| 155 | + * @param User $user | ||
| 149 | * @return array | 156 | * @return array |
| 150 | */ | 157 | */ |
| 151 | public function getAssetCounts(User $user) | 158 | public function getAssetCounts(User $user) |
| ... | @@ -156,4 +163,5 @@ class UserRepo | ... | @@ -156,4 +163,5 @@ class UserRepo |
| 156 | 'books' => $this->entityService->book->where('created_by', '=', $user->id)->count(), | 163 | 'books' => $this->entityService->book->where('created_by', '=', $user->id)->count(), |
| 157 | ]; | 164 | ]; |
| 158 | } | 165 | } |
| 166 | + | ||
| 159 | } | 167 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -251,6 +251,13 @@ ol { | ... | @@ -251,6 +251,13 @@ ol { |
| 251 | text-align: right; | 251 | text-align: right; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | +.text-bigger { | ||
| 255 | + font-size: 1.1em; | ||
| 256 | +} | ||
| 257 | +.text-large { | ||
| 258 | + font-size: 1.6666em; | ||
| 259 | +} | ||
| 260 | + | ||
| 254 | /** | 261 | /** |
| 255 | * Grouping | 262 | * Grouping |
| 256 | */ | 263 | */ | ... | ... |
| ... | @@ -47,6 +47,13 @@ body.dragging, body.dragging * { | ... | @@ -47,6 +47,13 @@ body.dragging, body.dragging * { |
| 47 | width: 80px; | 47 | width: 80px; |
| 48 | height: 80px; | 48 | height: 80px; |
| 49 | } | 49 | } |
| 50 | + &.huge { | ||
| 51 | + width: 120px; | ||
| 52 | + height: 120px; | ||
| 53 | + } | ||
| 54 | + &.square { | ||
| 55 | + border-radius: 3px; | ||
| 56 | + } | ||
| 50 | } | 57 | } |
| 51 | 58 | ||
| 52 | // System wide notifications | 59 | // System wide notifications | ... | ... |
| ... | @@ -58,10 +58,13 @@ | ... | @@ -58,10 +58,13 @@ |
| 58 | </span> | 58 | </span> |
| 59 | <ul> | 59 | <ul> |
| 60 | <li> | 60 | <li> |
| 61 | - <a href="/settings/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-lg"></i>Edit Profile</a> | 61 | + <a href="/user/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-account zmdi-hc-fw zmdi-hc-lg"></i>View Profile</a> |
| 62 | </li> | 62 | </li> |
| 63 | <li> | 63 | <li> |
| 64 | - <a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-lg"></i>Logout</a> | 64 | + <a href="/settings/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-fw zmdi-hc-lg"></i>Edit Profile</a> |
| 65 | + </li> | ||
| 66 | + <li> | ||
| 67 | + <a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-fw zmdi-hc-lg"></i>Logout</a> | ||
| 65 | </li> | 68 | </li> |
| 66 | </ul> | 69 | </ul> |
| 67 | </div> | 70 | </div> | ... | ... |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | ||
| 10 | <div class="right" ng-non-bindable> | 10 | <div class="right" ng-non-bindable> |
| 11 | @if($activity->user) | 11 | @if($activity->user) |
| 12 | - {{$activity->user->name}} | 12 | + <a href="/user/{{ $activity->user->id }}">{{$activity->user->name}}</a> |
| 13 | @else | 13 | @else |
| 14 | A deleted user | 14 | A deleted user |
| 15 | @endif | 15 | @endif | ... | ... |
| ... | @@ -4,18 +4,68 @@ | ... | @@ -4,18 +4,68 @@ |
| 4 | 4 | ||
| 5 | <div class="container" ng-non-bindable> | 5 | <div class="container" ng-non-bindable> |
| 6 | <div class="row"> | 6 | <div class="row"> |
| 7 | - <div class="col-sm-8"> | 7 | + <div class="col-sm-7"> |
| 8 | 8 | ||
| 9 | <div class="padded-top large"></div> | 9 | <div class="padded-top large"></div> |
| 10 | - <img class="" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}"> | ||
| 11 | - <h3>{{ $user->name }}</h3> | ||
| 12 | - <p class="text-muted"> | ||
| 13 | - User for {{ $user->created_at->diffForHumans(null, true) }} | ||
| 14 | - </p> | ||
| 15 | 10 | ||
| 11 | + <div class="row"> | ||
| 12 | + <div class="col-md-7"> | ||
| 13 | + <div class="clearfix"> | ||
| 14 | + <div class="padded-right float left"> | ||
| 15 | + <img class="avatar square huge" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}"> | ||
| 16 | + </div> | ||
| 17 | + <div> | ||
| 18 | + <h3 style="margin-top: 0;">{{ $user->name }}</h3> | ||
| 19 | + <p class="text-muted"> | ||
| 20 | + User for {{ $user->created_at->diffForHumans(null, true) }} | ||
| 21 | + </p> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + <div class="col-md-5 text-bigger"> | ||
| 26 | + <div class="text-muted">Created Content</div> | ||
| 27 | + <div class="text-book"> | ||
| 28 | + <i class="zmdi zmdi-book zmdi-hc-fw"></i> {{ $assetCounts['books'] }} {{ str_plural('Book', $assetCounts['books']) }} | ||
| 29 | + </div> | ||
| 30 | + <div class="text-chapter"> | ||
| 31 | + <i class="zmdi zmdi-collection-bookmark zmdi-hc-fw"></i> {{ $assetCounts['chapters'] }} {{ str_plural('Chapter', $assetCounts['chapters']) }} | ||
| 32 | + </div> | ||
| 33 | + <div class="text-page"> | ||
| 34 | + <i class="zmdi zmdi-file-text zmdi-hc-fw"></i> {{ $assetCounts['pages'] }} {{ str_plural('Page', $assetCounts['pages']) }} | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + <hr class="even"> | ||
| 41 | + | ||
| 42 | + <h3>Recently Created Pages</h3> | ||
| 43 | + @if (count($recentlyCreated['pages']) > 0) | ||
| 44 | + @include('partials/entity-list', ['entities' => $recentlyCreated['pages']]) | ||
| 45 | + @else | ||
| 46 | + <p class="text-muted">{{ $user->name }} has not created any pages</p> | ||
| 47 | + @endif | ||
| 48 | + | ||
| 49 | + <hr class="even"> | ||
| 50 | + | ||
| 51 | + <h3>Recently Created Chapters</h3> | ||
| 52 | + @if (count($recentlyCreated['chapters']) > 0) | ||
| 53 | + @include('partials/entity-list', ['entities' => $recentlyCreated['chapters']]) | ||
| 54 | + @else | ||
| 55 | + <p class="text-muted">{{ $user->name }} has not created any chapters</p> | ||
| 56 | + @endif | ||
| 57 | + | ||
| 58 | + <hr class="even"> | ||
| 59 | + | ||
| 60 | + <h3>Recently Created Books</h3> | ||
| 61 | + @if (count($recentlyCreated['books']) > 0) | ||
| 62 | + @include('partials/entity-list', ['entities' => $recentlyCreated['books']]) | ||
| 63 | + @else | ||
| 64 | + <p class="text-muted">{{ $user->name }} has not created any books</p> | ||
| 65 | + @endif | ||
| 16 | </div> | 66 | </div> |
| 17 | 67 | ||
| 18 | - <div class="col-sm-4"> | 68 | + <div class="col-sm-4 col-sm-offset-1"> |
| 19 | <h3>Recent Activity</h3> | 69 | <h3>Recent Activity</h3> |
| 20 | @include('partials/activity-list', ['activity' => $activity]) | 70 | @include('partials/activity-list', ['activity' => $activity]) |
| 21 | </div> | 71 | </div> | ... | ... |
-
Please register or sign in to post a comment