client/posts: display edit link for tagless posts

This commit is contained in:
rr- 2016-07-28 22:05:35 +02:00
parent 1ed7ad4173
commit ef4806e142
2 changed files with 31 additions and 21 deletions

View File

@ -62,6 +62,7 @@
<nav class='tags'> <nav class='tags'>
<h1>Tags (<%- ctx.post.tags.length %>)</h1> <h1>Tags (<%- ctx.post.tags.length %>)</h1>
<% if (ctx.post.tags.length) { %>
<ul><!-- <ul><!--
--><% for (let tag of ctx.post.tags) { %><!-- --><% for (let tag of ctx.post.tags) { %><!--
--><li><!-- --><li><!--
@ -83,5 +84,13 @@
--></li><!-- --></li><!--
--><% } %><!-- --><% } %><!--
--></ul> --></ul>
<% } else { %>
<p>
No tags yet!
<% if (ctx.canEditPosts) { %>
<a href='<%= ctx.getPostEditUrl(ctx.post.id, ctx.parameters) %>'>Add some.</a>
<% } %>
</p>
<% } %>
</nav> </nav>
</div> </div>

View File

@ -24,6 +24,7 @@ class PostReadonlySidebarControl extends events.EventTarget {
getTagCategory: this._getTagCategory, getTagCategory: this._getTagCategory,
getTagUsages: this._getTagUsages, getTagUsages: this._getTagUsages,
canListPosts: api.hasPrivilege('posts:list'), canListPosts: api.hasPrivilege('posts:list'),
canEditPosts: api.hasPrivilege('posts:edit'),
canViewTags: api.hasPrivilege('tags:view'), canViewTags: api.hasPrivilege('tags:view'),
})); }));