mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Added content to user profile pages
This commit is contained in:
parent
4442a2e6d1
commit
4d9726dbdd
@ -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
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -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(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -251,6 +251,13 @@ ol {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-bigger {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.text-large {
|
||||
font-size: 1.6666em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grouping
|
||||
*/
|
||||
|
@ -47,6 +47,13 @@ body.dragging, body.dragging * {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
&.huge {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
&.square {
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
// System wide notifications
|
||||
|
@ -58,10 +58,13 @@
|
||||
</span>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/settings/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-lg"></i>Edit Profile</a>
|
||||
<a href="/user/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-account zmdi-hc-fw zmdi-hc-lg"></i>View Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-lg"></i>Logout</a>
|
||||
<a href="/settings/users/{{$currentUser->id}}" class="text-primary"><i class="zmdi zmdi-edit zmdi-hc-fw zmdi-hc-lg"></i>Edit Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/logout" class="text-neg"><i class="zmdi zmdi-run zmdi-hc-fw zmdi-hc-lg"></i>Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<div class="right" ng-non-bindable>
|
||||
@if($activity->user)
|
||||
{{$activity->user->name}}
|
||||
<a href="/user/{{ $activity->user->id }}">{{$activity->user->name}}</a>
|
||||
@else
|
||||
A deleted user
|
||||
@endif
|
||||
|
@ -4,18 +4,68 @@
|
||||
|
||||
<div class="container" ng-non-bindable>
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<div class="col-sm-7">
|
||||
|
||||
<div class="padded-top large"></div>
|
||||
<img class="" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}">
|
||||
<h3>{{ $user->name }}</h3>
|
||||
<p class="text-muted">
|
||||
User for {{ $user->created_at->diffForHumans(null, true) }}
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="clearfix">
|
||||
<div class="padded-right float left">
|
||||
<img class="avatar square huge" src="{{$user->getAvatar(120)}}" alt="{{ $user->name }}">
|
||||
</div>
|
||||
<div>
|
||||
<h3 style="margin-top: 0;">{{ $user->name }}</h3>
|
||||
<p class="text-muted">
|
||||
User for {{ $user->created_at->diffForHumans(null, true) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 text-bigger">
|
||||
<div class="text-muted">Created Content</div>
|
||||
<div class="text-book">
|
||||
<i class="zmdi zmdi-book zmdi-hc-fw"></i> {{ $assetCounts['books'] }} {{ str_plural('Book', $assetCounts['books']) }}
|
||||
</div>
|
||||
<div class="text-chapter">
|
||||
<i class="zmdi zmdi-collection-bookmark zmdi-hc-fw"></i> {{ $assetCounts['chapters'] }} {{ str_plural('Chapter', $assetCounts['chapters']) }}
|
||||
</div>
|
||||
<div class="text-page">
|
||||
<i class="zmdi zmdi-file-text zmdi-hc-fw"></i> {{ $assetCounts['pages'] }} {{ str_plural('Page', $assetCounts['pages']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr class="even">
|
||||
|
||||
<h3>Recently Created Pages</h3>
|
||||
@if (count($recentlyCreated['pages']) > 0)
|
||||
@include('partials/entity-list', ['entities' => $recentlyCreated['pages']])
|
||||
@else
|
||||
<p class="text-muted">{{ $user->name }} has not created any pages</p>
|
||||
@endif
|
||||
|
||||
<hr class="even">
|
||||
|
||||
<h3>Recently Created Chapters</h3>
|
||||
@if (count($recentlyCreated['chapters']) > 0)
|
||||
@include('partials/entity-list', ['entities' => $recentlyCreated['chapters']])
|
||||
@else
|
||||
<p class="text-muted">{{ $user->name }} has not created any chapters</p>
|
||||
@endif
|
||||
|
||||
<hr class="even">
|
||||
|
||||
<h3>Recently Created Books</h3>
|
||||
@if (count($recentlyCreated['books']) > 0)
|
||||
@include('partials/entity-list', ['entities' => $recentlyCreated['books']])
|
||||
@else
|
||||
<p class="text-muted">{{ $user->name }} has not created any books</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-4 col-sm-offset-1">
|
||||
<h3>Recent Activity</h3>
|
||||
@include('partials/activity-list', ['activity' => $activity])
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user