szurubooru/public_html/templates/post.tpl

270 lines
5.7 KiB
Smarty
Raw Normal View History

<% var permaLink = (window.location.origin + '/' + window.location.pathname + '/data/posts/' + post.name).replace(/([^:])\/+/g, '$1/') %>
2014-10-05 10:09:02 +02:00
<div id="post-current-search-wrapper">
<div id="post-current-search">
<div class="left">
<a class="enabled">
<i class="fa fa-chevron-left"></i>
Next
</a>
</div>
<div class="search">
<a href="#/posts/query=<%= query.query %>;order=<%= query.order %>">
Current search: <%= query.query || '-' %>
2014-10-05 10:09:02 +02:00
</a>
</div>
<div class="right">
<a class="enabled">
Previous
<i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
</div>
2014-09-21 10:56:37 +02:00
<div id="post-view-wrapper">
<div id="sidebar">
2014-09-23 19:00:40 +02:00
<ul class="essential">
<li>
<a class="download" href="<%= permaLink %>">
2014-09-23 19:00:40 +02:00
<i class="fa fa-download"></i>
<br/>
<%= post.contentExtension + ', ' + formatFileSize(post.originalFileSize) %>
</a>
</li>
2014-09-27 21:33:31 +02:00
<% if (isLoggedIn) { %>
<li>
<% if (hasFav) { %>
2014-10-05 21:04:33 +02:00
<a class="delete-favorite">
2014-09-27 21:33:31 +02:00
<i class="fa fa-heart"></i>
</a>
<% } else { %>
2014-10-05 21:04:33 +02:00
<a class="add-favorite">
2014-09-27 21:33:31 +02:00
<i class="fa fa-heart-o"></i>
</a>
<% } %>
</li>
2014-09-28 15:21:25 +02:00
<li>
2014-10-05 21:04:33 +02:00
<a class="score-up <% print(ownScore === 1 ? 'active' : '') %>">
2014-09-28 15:21:25 +02:00
<% if (ownScore === 1) { %>
<i class="fa fa-thumbs-up"></i>
<% } else { %>
<i class="fa fa-thumbs-o-up"></i>
<% } %>
</a>
</li>
<li>
2014-10-05 21:04:33 +02:00
<a class="score-down <% print(ownScore === -1 ? 'active' : '') %>">
2014-09-28 15:21:25 +02:00
<% if (ownScore === -1) { %>
<i class="fa fa-thumbs-down"></i>
<% } else { %>
<i class="fa fa-thumbs-o-down"></i>
<% } %>
</a>
</li>
2014-09-27 21:33:31 +02:00
<% } %>
2014-09-23 19:00:40 +02:00
</ul>
2014-09-21 10:56:37 +02:00
<h1>Tags (<%= _.size(post.tags) %>)</h1>
<ul class="tags">
<% _.each(post.tags, function(tag) { %>
<li>
2014-09-27 10:59:37 +02:00
<a href="#/posts/query=<%= tag.name %>">
2014-09-21 10:56:37 +02:00
<%= tag.name %>
<span class="usages"><%= (tag.usages) %></span>
</a>
</li>
<% }) %>
</ul>
<h1>Details</h1>
<div class="author-box">
<% if (post.user.name) { %>
<a href="#/user/<%= post.user.name %>">
<% } %>
2014-10-05 11:05:34 +02:00
<img width="40" height="40" 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>
2014-09-23 19:00:40 +02:00
<ul class="other-info">
<li>
Rating:
<span class="safety-<%= post.safety %>">
<%= post.safety %>
</span>
</li>
<% if (post.originalFileSize) { %>
<li>
File size:
<%= formatFileSize(post.originalFileSize) %>
</li>
<% } %>
<% if (post.contentType == 'image') { %>
<li>
Image size:
<%= post.imageWidth + 'x' + post.imageHeight %>
</li>
<% } %>
<% if (post.lastEditTime !== post.uploadTime) { %>
<li>
Edited:
<%= formatRelativeTime(post.lastEditTime) %>
</li>
<% } %>
2014-09-24 23:24:51 +02:00
<% if (post.featureCount > 0) { %>
<li>
Featured: <%= post.featureCount %> <%= post.featureCount < 2 ? 'time' : 'times' %>
<small>(<%= formatRelativeTime(post.lastFeatureTime) %>)</small>
</li>
<% } %>
2014-09-23 19:00:40 +02:00
<% if (post.source) { %>
<li><!--
--><% var link = post.source.match(/^(\/\/|https?:\/\/)/); %><!--
-->Source:&nbsp;<!--
--><% if (link) { %><!--
--><a href="<%= post.source %>"><!--
--><% } %><!--
--><%= post.source.trim() %><!--
--><% if (link) { %><!--
--></a><!--
--><% } %><!--
--></li>
2014-09-23 19:00:40 +02:00
<% } %>
2014-09-28 15:21:25 +02:00
<li>
Score: <%= post.score %>
</li>
2014-09-23 19:00:40 +02:00
</ul>
2014-09-23 20:18:12 +02:00
2014-09-27 21:33:31 +02:00
<% if (_.any(postFavorites)) { %>
<p>Favorites:</p>
<ul class="favorites">
<% _.each(postFavorites, function(user) { %>
<li>
<a href="#/user/<%= user.name %>">
<img class="fav-avatar"
src="/data/thumbnails/25x25/avatars/<%= user.name || '!' %>"
alt="<%= user.name || 'Anonymous user' %>"/>
</a>
</li>
<% }) %>
</ul>
<% } %>
2014-09-25 23:53:47 +02:00
<% if (_.any(post.relations)) { %>
<h1>Related posts</h1>
<ul class="related">
<% _.each(post.relations, function(relatedPost) { %>
<li>
<a href="#/post/<%= relatedPost.id %>">
<%= relatedPost.idMarkdown %>
</a>
</li>
<% }) %>
</ul>
<% } %>
<% if (_.any(privileges) || _.any(editPrivileges) || post.contentType === 'image') { %>
2014-09-23 20:18:12 +02:00
<h1>Options</h1>
<ul class="operations">
2014-09-25 19:11:41 +02:00
<% if (_.any(editPrivileges)) { %>
<li>
2014-10-05 21:04:33 +02:00
<a class="edit">
2014-09-25 19:11:41 +02:00
Edit
</a>
</li>
<% } %>
2014-09-23 20:18:12 +02:00
<% if (privileges.canDeletePosts) { %>
<li>
2014-10-05 21:04:33 +02:00
<a class="delete">
2014-09-23 20:18:12 +02:00
Delete
</a>
</li>
<% } %>
2014-09-24 23:24:51 +02:00
<% if (privileges.canFeaturePosts) { %>
<li>
2014-10-05 21:04:33 +02:00
<a class="feature">
2014-09-24 23:24:51 +02:00
Feature
</a>
</li>
<% } %>
2014-09-26 20:41:28 +02:00
<% if (privileges.canViewHistory) { %>
<li>
2014-10-05 21:04:33 +02:00
<a class="history">
2014-09-26 20:41:28 +02:00
History
</a>
</li>
<% } %>
<% if (post.contentType === 'image') { %>
<li>
<a href="http://iqdb.org/?url=<%= permaLink %>">
Search on IQDB
</a>
</li>
<li>
<a href="https://www.google.com/searchbyimage?&image_url=<%= permaLink %>">
Search on Google Images
</a>
</li>
<% } %>
2014-09-23 20:18:12 +02:00
</ul>
<% } %>
2014-09-21 10:56:37 +02:00
</div>
<div id="post-view">
2014-09-24 23:24:51 +02:00
<div class="messages"></div>
2014-09-25 19:11:41 +02:00
<div class="post-edit-wrapper">
<%= postEditTemplate({post: post, privileges: editPrivileges}) %>
</div>
2014-09-21 10:56:37 +02:00
<%= postContentTemplate({post: post}) %>
2014-09-26 20:41:28 +02:00
<% if (privileges.canViewHistory) { %>
<div class="post-history-wrapper">
<%= historyTemplate({
history: postHistory,
formatRelativeTime: formatRelativeTime
}) %>
</div>
<% } %>
2014-10-05 21:06:43 +02:00
<div id="post-comments-target">
</div>
2014-09-21 10:56:37 +02:00
</div>
</div>