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
2015-08-23 13:41:35 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
958ed627ddfd3d40ddba9ffdd0a21f654046d1d7
958ed627
1 parent
7b65ba49
Added user avatars. Fixes #20
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
21 deletions
app/User.php
resources/assets/sass/_tables.scss
resources/assets/sass/styles.scss
resources/views/base.blade.php
resources/views/pages/revisions.blade.php
resources/views/partials/activity-item.blade.php
resources/views/users/delete.blade.php
resources/views/users/edit.blade.php
resources/views/users/index.blade.php
app/User.php
View file @
958ed62
...
...
@@ -32,4 +32,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* @var array
*/
protected
$hidden
=
[
'password'
,
'remember_token'
];
/**
* Returns the user's avatar,
* Uses Gravatar as the avatar service.
* @param int $size
* @return string
*/
public
function
getAvatar
(
$size
=
50
)
{
$emailHash
=
md5
(
strtolower
(
trim
(
$this
->
email
)));
return
'//www.gravatar.com/avatar/'
.
$emailHash
.
'?s='
.
$size
.
'&d=identicon'
;
}
}
...
...
resources/assets/sass/_tables.scss
View file @
958ed62
...
...
@@ -8,6 +8,7 @@ table.table {
text-align
:
left
;
border
:
none
;
padding
:
$-xs
$-xs
;
vertical-align
:
middle
;
}
th
{
font-weight
:
bold
;
...
...
resources/assets/sass/styles.scss
View file @
958ed62
...
...
@@ -46,7 +46,7 @@ header {
}
.logo-container
{
padding
:
$-l
$-s
;
padding
:
$-l
$-s
0
$-s
;
color
:
#CCC
;
.logo
{
display
:
block
;
...
...
@@ -59,6 +59,15 @@ header {
}
}
.user-overview
{
margin-top
:
$-m
;
.user-name
{
display
:
inline-block
;
vertical-align
:
top
;
padding
:
$-m
$-s
;
}
}
.search-box
{
input
{
...
...
@@ -432,4 +441,15 @@ body.dragging, body.dragging * {
padding
:
$-s
0
;
color
:
#888
;
border-bottom
:
1px
solid
#EEE
;
font-size
:
0
.9em
;
.left
{
float
:
left
;
}
.left
+
.right
{
margin-left
:
30px
+
$-s
;
}
}
.avatar
{
border-radius
:
100%
;
}
\ No newline at end of file
...
...
resources/views/base.blade.php
View file @
958ed62
...
...
@@ -37,7 +37,12 @@
<div
class=
"padded row clearfix"
>
<div
class=
"col-md-12 logo-container"
>
<a
href=
"/"
class=
"logo"
>
BookStack
</a>
<div><i
class=
"zmdi zmdi-account"
></i>
{{ Auth::user()->name }}
</div>
<div
class=
"user-overview"
>
<img
class=
"avatar"
src=
"{{Auth::user()->getAvatar(50)}}"
alt=
"{{ Auth::user()->name }}"
>
<span
class=
"user-name"
>
{{ Auth::user()->name }}
</span>
</div>
</div>
</div>
</header>
...
...
resources/views/pages/revisions.blade.php
View file @
958ed62
...
...
@@ -20,14 +20,15 @@
<table
class=
"table"
>
<tr>
<th>
Name
</th>
<th>
Created By
</th>
<th
colspan=
"2"
>
Created By
</th>
<th>
Revision Date
</th>
<th>
Actions
</th>
</tr>
@foreach($page->revisions as $revision)
<tr>
<td>
{{$revision->name}}
</td>
<td>
{{$revision->createdBy->name}}
</td>
<td
style=
"line-height: 0;"
><img
class=
"avatar"
src=
"{{ $revision->createdBy->getAvatar(30) }}"
alt=
"{{$revision->createdBy->name}}"
></td>
<td>
{{$revision->createdBy->name}}
</td>
<td><small>
{{$revision->created_at->format('jS F, Y H:i:s')}} ({{$revision->created_at->diffForHumans()}})
</small></td>
<td>
<a
href=
"{{$revision->getUrl()}}"
target=
"_blank"
>
Preview
</a>
...
...
resources/views/partials/activity-item.blade.php
View file @
958ed62
{{--Requires an Activity item with the name $activity passed in--}}
@if($activity->user) {{$activity->user->name}} @endif
@if($activity->user)
<div
class=
"left"
>
<img
class=
"avatar"
src=
"{{ $activity->user->getAvatar(30) }}"
alt=
"{{$activity->user->name}}"
>
</div>
@endif
{{ $activity->getText() }}
<div
class=
"right"
>
@if($activity->user)
{{$activity->user->name}}
@endif
@if($activity->entity())
<a
href=
"{{ $activity->entity()->getUrl() }}"
>
{{ $activity->entity()->name }}
</a>
@endif
{{ $activity->getText() }}
@if($activity->entity())
<a
href=
"{{ $activity->entity()->getUrl() }}"
>
{{ $activity->entity()->name }}
</a>
@endif
@if($activity->extra) "{{$activity->extra}}" @endif
@if($activity->extra) "{{$activity->extra}}" @endif
<br>
<br>
<span
class=
"text-muted"
><small><i
class=
"zmdi zmdi-time"
></i>
{{ $activity->created_at->diffForHumans() }}
</small></span>
\ No newline at end of file
<span
class=
"text-muted"
><small><i
class=
"zmdi zmdi-time"
></i>
{{ $activity->created_at->diffForHumans() }}
</small></span>
</div>
...
...
resources/views/users/delete.blade.php
View file @
958ed62
...
...
@@ -10,7 +10,7 @@
<form
action=
"/users/{{$user->id}}"
method=
"POST"
>
{!! csrf_field() !!}
<input
type=
"hidden"
name=
"_method"
value=
"DELETE"
>
<a
href=
"/user/{{$user->id}}"
class=
"button muted"
>
Cancel
</a>
<a
href=
"/user
s
/{{$user->id}}"
class=
"button muted"
>
Cancel
</a>
<button
type=
"submit"
class=
"button neg"
>
Confirm
</button>
</form>
</div>
...
...
resources/views/users/edit.blade.php
View file @
958ed62
...
...
@@ -12,14 +12,29 @@
</div>
</div>
<div
class=
"page-content"
>
<h1>
Edit User
</h1>
<form
action=
"/users/{{$user->id}}"
method=
"post"
>
{!! csrf_field() !!}
<input
type=
"hidden"
name=
"_method"
value=
"put"
>
@include('users/form', ['model' => $user])
</form>
<div
class=
"row"
>
<div
class=
"page-content"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<h1>
Edit User
</h1>
<form
action=
"/users/{{$user->id}}"
method=
"post"
>
{!! csrf_field() !!}
<input
type=
"hidden"
name=
"_method"
value=
"put"
>
@include('users/form', ['model' => $user])
</form>
</div>
<div
class=
"col-md-6"
>
<h1>
</h1>
<div
class=
"shaded padded margin-top"
>
<p>
<img
class=
"avatar"
src=
"{{ $user->getAvatar(80) }}"
alt=
"{{ $user->name }}"
>
</p>
<p
class=
"text-muted"
>
You can change your profile picture at
<a
href=
"http://en.gravatar.com/"
>
Gravatar
</a>
.
</p>
</div>
</div>
</div>
</div>
</div>
@stop
...
...
resources/views/users/index.blade.php
View file @
958ed62
...
...
@@ -18,11 +18,13 @@
<h1>
Users
</h1>
<table
class=
"table"
>
<tr>
<th></th>
<th>
Name
</th>
<th>
Email
</th>
</tr>
@foreach($users as $user)
<tr>
<td
style=
"line-height: 0;"
><img
class=
"avatar"
src=
"{{$user->getAvatar(40)}}"
alt=
"{{$user->name}}"
></td>
<td><a
href=
"/users/{{$user->id}}"
>
{{$user->name}}
</a></td>
<td>
{{$user->email}}
</td>
</tr>
...
...
Please
register
or
sign in
to post a comment