Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-02-17 22:11:48 +0000
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
4d9726dbdd4a3eef054a78d378a942eec5a1a388
4d9726db
1 parent
4442a2e6
Added content to user profile pages
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
17 deletions
app/Http/Controllers/UserController.php
app/Repos/UserRepo.php
resources/assets/sass/_text.scss
resources/assets/sass/styles.scss
resources/views/base.blade.php
resources/views/partials/activity-item.blade.php
resources/views/users/profile.blade.php
app/Http/Controllers/UserController.php
View file @
4d9726d
...
...
@@ -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
]);
}
}
...
...
app/Repos/UserRepo.php
View file @
4d9726d
...
...
@@ -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
get
CreatedPages
(
User
$user
,
$count
=
20
,
$page
=
0
)
public
function
get
RecentlyCreated
(
User
$user
,
$count
=
2
0
)
{
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
...
...
resources/assets/sass/_text.scss
View file @
4d9726d
...
...
@@ -251,6 +251,13 @@ ol {
text-align
:
right
;
}
.text-bigger
{
font-size
:
1
.1em
;
}
.text-large
{
font-size
:
1
.6666em
;
}
/**
* Grouping
*/
...
...
resources/assets/sass/styles.scss
View file @
4d9726d
...
...
@@ -47,6 +47,13 @@ body.dragging, body.dragging * {
width
:
80px
;
height
:
80px
;
}
&
.huge
{
width
:
120px
;
height
:
120px
;
}
&
.square
{
border-radius
:
3px
;
}
}
// System wide notifications
...
...
resources/views/base.blade.php
View file @
4d9726d
...
...
@@ -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>
...
...
resources/views/partials/activity-item.blade.php
View file @
4d9726d
...
...
@@ -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
...
...
resources/views/users/profile.blade.php
View file @
4d9726d
...
...
@@ -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>
...
...
Please
register
or
sign in
to post a comment