Added user avatars. Fixes #20
This commit is contained in:
parent
7b65ba49f6
commit
958ed627dd
12
app/User.php
12
app/User.php
|
@ -32,4 +32,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $hidden = ['password', 'remember_token'];
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ table.table {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border: none;
|
border: none;
|
||||||
padding: $-xs $-xs;
|
padding: $-xs $-xs;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
th {
|
th {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -46,7 +46,7 @@ header {
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-container {
|
.logo-container {
|
||||||
padding: $-l $-s;
|
padding: $-l $-s 0 $-s;
|
||||||
color: #CCC;
|
color: #CCC;
|
||||||
.logo {
|
.logo {
|
||||||
display: block;
|
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 {
|
.search-box {
|
||||||
input {
|
input {
|
||||||
|
@ -432,4 +441,15 @@ body.dragging, body.dragging * {
|
||||||
padding: $-s 0;
|
padding: $-s 0;
|
||||||
color: #888;
|
color: #888;
|
||||||
border-bottom: 1px solid #EEE;
|
border-bottom: 1px solid #EEE;
|
||||||
|
font-size: 0.9em;
|
||||||
|
.left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.left + .right {
|
||||||
|
margin-left: 30px + $-s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
border-radius: 100%;
|
||||||
}
|
}
|
|
@ -37,7 +37,12 @@
|
||||||
<div class="padded row clearfix">
|
<div class="padded row clearfix">
|
||||||
<div class="col-md-12 logo-container">
|
<div class="col-md-12 logo-container">
|
||||||
<a href="/" class="logo">BookStack</a>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -20,13 +20,14 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Created By</th>
|
<th colspan="2">Created By</th>
|
||||||
<th>Revision Date</th>
|
<th>Revision Date</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($page->revisions as $revision)
|
@foreach($page->revisions as $revision)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$revision->name}}</td>
|
<td>{{$revision->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> {{$revision->createdBy->name}}</td>
|
||||||
<td><small>{{$revision->created_at->format('jS F, Y H:i:s')}} ({{$revision->created_at->diffForHumans()}})</small></td>
|
<td><small>{{$revision->created_at->format('jS F, Y H:i:s')}} ({{$revision->created_at->diffForHumans()}})</small></td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
|
|
||||||
{{--Requires an Activity item with the name $activity passed in--}}
|
{{--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
|
||||||
|
|
||||||
|
<div class="right">
|
||||||
|
@if($activity->user)
|
||||||
|
{{$activity->user->name}}
|
||||||
|
@endif
|
||||||
|
|
||||||
{{ $activity->getText() }}
|
{{ $activity->getText() }}
|
||||||
|
|
||||||
|
@ -14,3 +23,4 @@
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<span class="text-muted"><small><i class="zmdi zmdi-time"></i>{{ $activity->created_at->diffForHumans() }}</small></span>
|
<span class="text-muted"><small><i class="zmdi zmdi-time"></i>{{ $activity->created_at->diffForHumans() }}</small></span>
|
||||||
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<form action="/users/{{$user->id}}" method="POST">
|
<form action="/users/{{$user->id}}" method="POST">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
<input type="hidden" name="_method" value="DELETE">
|
<input type="hidden" name="_method" value="DELETE">
|
||||||
<a href="/user/{{$user->id}}" class="button muted">Cancel</a>
|
<a href="/users/{{$user->id}}" class="button muted">Cancel</a>
|
||||||
<button type="submit" class="button neg">Confirm</button>
|
<button type="submit" class="button neg">Confirm</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,14 +12,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
<h1>Edit User</h1>
|
<h1>Edit User</h1>
|
||||||
|
|
||||||
<form action="/users/{{$user->id}}" method="post">
|
<form action="/users/{{$user->id}}" method="post">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
<input type="hidden" name="_method" value="put">
|
<input type="hidden" name="_method" value="put">
|
||||||
@include('users/form', ['model' => $user])
|
@include('users/form', ['model' => $user])
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</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
|
@stop
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
<h1>Users</h1>
|
<h1>Users</h1>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th></th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($users as $user)
|
@foreach($users as $user)
|
||||||
<tr>
|
<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><a href="/users/{{$user->id}}">{{$user->name}}</a></td>
|
||||||
<td>{{$user->email}}</td>
|
<td>{{$user->email}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue