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