Fixed post list disregarding viewPosts privilege
This commit is contained in:
parent
b14f02810e
commit
4e6fe634e1
5 changed files with 40 additions and 21 deletions
|
@ -68,7 +68,7 @@
|
|||
.post-small {
|
||||
position: relative;
|
||||
}
|
||||
.post-small a {
|
||||
.post-small .link {
|
||||
display: inline-block;
|
||||
margin: 0.2em;
|
||||
border: 1px solid #999;
|
||||
|
@ -82,20 +82,20 @@
|
|||
}
|
||||
|
||||
|
||||
.post-small a:focus,
|
||||
.post-small a:hover {
|
||||
.post-small .link:focus,
|
||||
.post-small .link:hover {
|
||||
background: #64C2ED;
|
||||
border-color: #64C2ED;
|
||||
box-shadow: 0 0 0 2px #64C2ED;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.post-small a:focus img:not(.loading),
|
||||
.post-small a:hover img:not(.loading) {
|
||||
.post-small .link:focus img:not(.loading),
|
||||
.post-small .link:hover img:not(.loading) {
|
||||
opacity: .8 !important;
|
||||
}
|
||||
|
||||
.post-small a .info {
|
||||
.post-small .link .info {
|
||||
display: none;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
|
@ -105,22 +105,22 @@
|
|||
background: #64C2ED;
|
||||
color: black;
|
||||
}
|
||||
.post-small a .info ul {
|
||||
.post-small .link .info ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.post-small a .info li {
|
||||
.post-small .link .info li {
|
||||
display: inline-block;
|
||||
margin: 0.1em 0.5em;
|
||||
padding: 0;
|
||||
}
|
||||
.post-small a:focus .info,
|
||||
.post-small a:hover .info {
|
||||
.post-small .link:focus .info,
|
||||
.post-small .link:hover .info {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-small:not(.post-type-image) a::before {
|
||||
.post-small:not(.post-type-image) .link::before {
|
||||
display: block;
|
||||
content: '';
|
||||
z-index: 2;
|
||||
|
@ -133,7 +133,7 @@
|
|||
border-left: 50px solid transparent;
|
||||
}
|
||||
|
||||
.post-small:not(.post-type-image) a::after {
|
||||
.post-small:not(.post-type-image) .link::after {
|
||||
display: block;
|
||||
content: '...';
|
||||
z-index: 3;
|
||||
|
@ -148,14 +148,14 @@
|
|||
color: white;
|
||||
font-size: 15px;
|
||||
}
|
||||
.post-small.post-type-youtube a::after {
|
||||
.post-small.post-type-youtube .link::after {
|
||||
font-size: 13px;
|
||||
content: 'youtube';
|
||||
}
|
||||
.post-small.post-type-video a::after {
|
||||
.post-small.post-type-video .link::after {
|
||||
content: 'video';
|
||||
}
|
||||
.post-small.post-type-flash a::after {
|
||||
.post-small.post-type-flash .link::after {
|
||||
content: 'flash';
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,23 @@ App.Presenters.GlobalCommentListPresenter = function(
|
|||
_,
|
||||
jQuery,
|
||||
util,
|
||||
auth,
|
||||
promise,
|
||||
pagerPresenter,
|
||||
topNavigationPresenter) {
|
||||
|
||||
var $el;
|
||||
var privileges;
|
||||
var templates = {};
|
||||
|
||||
function init(params, loaded) {
|
||||
$el = jQuery('#content');
|
||||
topNavigationPresenter.select('comments');
|
||||
|
||||
privileges = {
|
||||
canViewPosts: auth.hasPrivilege(auth.privileges.viewPosts),
|
||||
};
|
||||
|
||||
promise.wait(
|
||||
util.promiseTemplate('global-comment-list'),
|
||||
util.promiseTemplate('global-comment-list-item'),
|
||||
|
@ -69,6 +75,7 @@ App.Presenters.GlobalCommentListPresenter = function(
|
|||
util: util,
|
||||
post: post,
|
||||
postTemplate: templates.post,
|
||||
canViewPosts: privileges.canViewPosts,
|
||||
}) + '</li>');
|
||||
|
||||
util.loadImagesNicely($post.find('img'));
|
||||
|
@ -95,4 +102,4 @@ App.Presenters.GlobalCommentListPresenter = function(
|
|||
|
||||
};
|
||||
|
||||
App.DI.register('globalCommentListPresenter', ['_', 'jQuery', 'util', 'promise', 'pagerPresenter', 'topNavigationPresenter'], App.Presenters.GlobalCommentListPresenter);
|
||||
App.DI.register('globalCommentListPresenter', ['_', 'jQuery', 'util', 'auth', 'promise', 'pagerPresenter', 'topNavigationPresenter'], App.Presenters.GlobalCommentListPresenter);
|
||||
|
|
|
@ -29,6 +29,7 @@ App.Presenters.PostListPresenter = function(
|
|||
params.query = params.query || {};
|
||||
|
||||
privileges.canMassTag = auth.hasPrivilege(auth.privileges.massTag);
|
||||
privileges.canViewPosts = auth.hasPrivilege(auth.privileges.viewPosts);
|
||||
|
||||
promise.wait(
|
||||
util.promiseTemplate('post-list'),
|
||||
|
@ -165,6 +166,7 @@ App.Presenters.PostListPresenter = function(
|
|||
util: util,
|
||||
query: params.query,
|
||||
post: post,
|
||||
canViewPosts: privileges.canViewPosts,
|
||||
}) + '</li>');
|
||||
$post.data('post', post);
|
||||
util.loadImagesNicely($post.find('img'));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="post-comment">
|
||||
<div class="post">
|
||||
<%= postTemplate({post: post, util: util}) %>
|
||||
<%= postTemplate({post: post, util: util, canViewPosts: canViewPosts}) %>
|
||||
</div>
|
||||
|
||||
<div class="post-comments-target">
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<div class="post-small post-type-<%= post.contentType %> ">
|
||||
<a class="link"
|
||||
href="<%= util.appendComplexRouteParam('#/post/' + post.id, typeof(query) !== 'undefined' ? query : {}) %>"
|
||||
title="<%= _.map(post.tags, function(tag) { return '#' + tag.name; }).join(', ') %>">
|
||||
|
||||
<% if (canViewPosts) { %>
|
||||
<a class="link"
|
||||
href="<%= util.appendComplexRouteParam('#/post/' + post.id, typeof(query) !== 'undefined' ? query : {}) %>"
|
||||
title="<%= _.map(post.tags, function(tag) { return '#' + tag.name; }).join(', ') %>">
|
||||
<% } else { %>
|
||||
<span class="link">
|
||||
<% } %>
|
||||
|
||||
<img width="160" height="160" class="thumb" src="/data/thumbnails/160x160/posts/<%= post.name %>" alt="<%= post.idMarkdown %>"/>
|
||||
|
||||
|
@ -31,7 +36,12 @@
|
|||
</ul>
|
||||
</div>
|
||||
<% } %>
|
||||
</a>
|
||||
|
||||
<% if (canViewPosts) { %>
|
||||
</a>
|
||||
<% } else { %>
|
||||
</span>
|
||||
<% } %>
|
||||
|
||||
<div class="action">
|
||||
<button>Action</button>
|
||||
|
|
Loading…
Reference in a new issue