Added author and upload date to post view
This commit is contained in:
parent
881d2a6b38
commit
51a80c22c5
4 changed files with 53 additions and 6 deletions
3
TODO
3
TODO
|
@ -4,13 +4,10 @@ first major release.
|
|||
everything related to posts:
|
||||
- single post view
|
||||
- basic information
|
||||
- uploader's picture
|
||||
- remember about support for anonymous uploads
|
||||
- safety
|
||||
- source
|
||||
- image dimensions
|
||||
- time of last edit
|
||||
- time of upload
|
||||
- time of last feature
|
||||
- how many times the post was featured
|
||||
- download
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
font-size: 90%;
|
||||
}
|
||||
|
||||
#post-view-wrapper #sidebar h1 {
|
||||
margin-top: 1.5em;
|
||||
font-weight: normal;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
#post-view-wrapper #sidebar h1:first-of-type {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
@ -70,3 +76,11 @@
|
|||
color: silver;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
#sidebar .author-box img {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
#sidebar .author-box .author-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,30 @@
|
|||
</li>
|
||||
<% }) %>
|
||||
</ul>
|
||||
|
||||
<h1>Details</h1>
|
||||
|
||||
<div class="author-box">
|
||||
<% if (post.user.name) { %>
|
||||
<a href="#/user/<%= post.user.name %>">
|
||||
<% } %>
|
||||
|
||||
<img class="author-avatar"
|
||||
src="/data/thumbnails/40x40/avatars/<%= post.user.name || '!' %>"
|
||||
alt="<%= post.user.name || 'Anonymous user' %>"/>
|
||||
|
||||
<span class="author-name">
|
||||
<%= post.user.name || 'Anonymous user' %>
|
||||
</span>
|
||||
|
||||
<% if (post.user.name) { %>
|
||||
</a>
|
||||
<% } %>
|
||||
|
||||
<br/>
|
||||
|
||||
<span class="date"><%= formatRelativeTime(post.uploadTime) %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="post-view">
|
||||
|
|
|
@ -27,7 +27,14 @@ final class UserAvatarController extends AbstractController
|
|||
|
||||
public function getAvatarByName($userName, $size)
|
||||
{
|
||||
$user = $this->userService->getByName($userName);
|
||||
try
|
||||
{
|
||||
$user = $this->userService->getByName($userName);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$this->serveBlankFile($size);
|
||||
}
|
||||
|
||||
switch ($user->getAvatarStyle())
|
||||
{
|
||||
|
@ -38,7 +45,7 @@ final class UserAvatarController extends AbstractController
|
|||
break;
|
||||
|
||||
case \Szurubooru\Entities\User::AVATAR_STYLE_BLANK:
|
||||
$this->serveFromFile($this->getBlankAvatarSourceContentPath(), $size);
|
||||
$this->serveBlankFile($size);
|
||||
break;
|
||||
|
||||
case \Szurubooru\Entities\User::AVATAR_STYLE_MANUAL:
|
||||
|
@ -46,7 +53,7 @@ final class UserAvatarController extends AbstractController
|
|||
break;
|
||||
|
||||
default:
|
||||
$this->serveFromFile($this->getBlankAvatarSourceContentPath(), $size);
|
||||
$this->serveBlankFile($size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +70,11 @@ final class UserAvatarController extends AbstractController
|
|||
$this->fileService->serve($thumbnailName);
|
||||
}
|
||||
|
||||
private function serveBlankFile($size)
|
||||
{
|
||||
$this->serveFromFile($this->getBlankAvatarSourceContentPath(), $size);
|
||||
}
|
||||
|
||||
private function getBlankAvatarSourceContentPath()
|
||||
{
|
||||
return 'avatars/blank.png';
|
||||
|
|
Loading…
Reference in a new issue