Added "edit post" links.
This commit is contained in:
parent
4b03d57c43
commit
50e5bbc094
@ -50,6 +50,10 @@ class PostController(BaseController):
|
||||
if id is None:
|
||||
h.redirect_to('/post/new')
|
||||
c.post = Session.query(Post).get(id)
|
||||
if len(c.post.tags):
|
||||
c.post.tags_list = u', '.join([tag.name for tag in c.post.tags])
|
||||
else:
|
||||
c.post.tags_list = u''
|
||||
c.page_title = 'Edit Post: %s' % c.post.title
|
||||
return render(u'/post/edit.mako')
|
||||
|
||||
|
@ -8,7 +8,12 @@
|
||||
${h.literal(h.teaser(post.body))}
|
||||
</div>
|
||||
<p class="meta">
|
||||
<span class="byline">Posted by ${post.user.nick} on ${post.created.strftime('%B %d, %Y')}</span>
|
||||
<span class="byline">
|
||||
Posted by ${post.user.nick} on ${post.created.strftime('%B %d, %Y')}
|
||||
% if c.current_user and c.current_user.id == post.user.id and c.current_user.has_permission(u'Edit My Posts'):
|
||||
[<a href="${h.url_for(controller=u'post', action=u'edit', id=post.id)}">Edit</a>]
|
||||
% endif
|
||||
</span>
|
||||
<a href="${h.url_for_post(post)}" class="read-more">Read more</a>
|
||||
% if len(post.comments) == 0:
|
||||
<a href="${h.url_for_post(post)}#comments" class="comments">No comments</a>
|
||||
|
@ -2,7 +2,12 @@
|
||||
<%include file="/flash.mako"/>
|
||||
<div class="post">
|
||||
<h2 class="title">${c.post.title}</h2>
|
||||
<div class="info">Posted by ${c.post.user.nick} on ${c.post.created.strftime('%B %d, %Y')}</div>
|
||||
<div class="info">
|
||||
Posted by ${c.post.user.nick} on ${c.post.created.strftime('%B %d, %Y')}
|
||||
% if c.current_user and c.current_user.id == c.post.user.id and c.current_user.has_permission(u'Edit My Posts'):
|
||||
[<a href="${h.url_for(controller=u'post', action=u'edit', id=c.post.id)}">Edit</a>]
|
||||
% endif
|
||||
</div>
|
||||
<div class="entry">
|
||||
${h.literal(c.post.body)}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user