summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quoins/controllers.py7
-rw-r--r--quoins/model/blog.py8
-rw-r--r--quoins/templates/delete_post.html6
-rw-r--r--quoins/templates/post.html8
4 files changed, 14 insertions, 15 deletions
diff --git a/quoins/controllers.py b/quoins/controllers.py
index bf27ddd..f627c61 100644
--- a/quoins/controllers.py
+++ b/quoins/controllers.py
@@ -335,6 +335,8 @@ class BlogController(TGController):
335 u = tg.url(os.path.join(self.path, 'post', str(obj.id))) 335 u = tg.url(os.path.join(self.path, 'post', str(obj.id)))
336 elif isinstance(obj, Media): 336 elif isinstance(obj, Media):
337 u = tg.url(os.path.join(self.path, 'media', str(obj.post.id), str(obj.name))) 337 u = tg.url(os.path.join(self.path, 'media', str(obj.post.id), str(obj.name)))
338 elif isinstance(obj, TGUser):
339 u = tg.url(os.path.join(self.path, 'author', str(obj.user_name)))
338 return u 340 return u
339 341
340 def absolute_url(self, obj=None): 342 def absolute_url(self, obj=None):
@@ -346,6 +348,11 @@ class BlogController(TGController):
346 port = ':'+port 348 port = ':'+port
347 return 'http://%s%s%s'%(tg.config.get('server.webhost'), port, u) 349 return 'http://%s%s%s'%(tg.config.get('server.webhost'), port, u)
348 350
351 def comment_author_url(self, comment):
352 if comment.author and (not comment.url):
353 return self.url(comment.author)
354 return comment.url
355
349 def get_html(self, data): 356 def get_html(self, data):
350 return HTML(data) 357 return HTML(data)
351 358
diff --git a/quoins/model/blog.py b/quoins/model/blog.py
index c1689ee..ee99d83 100644
--- a/quoins/model/blog.py
+++ b/quoins/model/blog.py
@@ -201,14 +201,6 @@ class BaseComment(object):
201 return 'Anonymous' 201 return 'Anonymous'
202 author_name = property(get_author_name) 202 author_name = property(get_author_name)
203 203
204 def get_author_url(self):
205 if hasattr(self, 'author') and self.author:
206 return self.author.url
207 if self.url:
208 return self.url
209 return None
210 author_url = property(get_author_url)
211
212class Comment(BaseComment): 204class Comment(BaseComment):
213 pass 205 pass
214 206
diff --git a/quoins/templates/delete_post.html b/quoins/templates/delete_post.html
index e237dad..94df1d3 100644
--- a/quoins/templates/delete_post.html
+++ b/quoins/templates/delete_post.html
@@ -57,10 +57,10 @@
57 </a> 57 </a>
58 </span> 58 </span>
59 &nbsp; 59 &nbsp;
60 <span class="blog-comment-user" py:if="comment.author_url"> 60 <span class="blog-comment-user" py:if="quoins.comment_author_url(comment)">
61 <a href="${comment.author_url}" rel="nofollow">${comment.author_name}</a> 61 <a href="${quoins.comment_author_url(comment)}" rel="nofollow">${comment.author_name}</a>
62 </span> 62 </span>
63 <span class="blog-comment-user" py:if="not comment.author_url"> 63 <span class="blog-comment-user" py:if="not quoins.comment_author_url(comment)">
64 ${comment.author_name} 64 ${comment.author_name}
65 </span> 65 </span>
66 <br /> 66 <br />
diff --git a/quoins/templates/post.html b/quoins/templates/post.html
index 72ee748..d290f3b 100644
--- a/quoins/templates/post.html
+++ b/quoins/templates/post.html
@@ -51,10 +51,10 @@
51 </a> 51 </a>
52 </span> 52 </span>
53 &nbsp; 53 &nbsp;
54 <span class="blog-comment-user" py:if="comment.author_url"> 54 <span class="blog-comment-user" py:if="quoins.comment_author_url(comment)">
55 <a href="${comment.author_url}" rel="nofollow">${comment.author_name}</a> 55 <a href="${quoins.comment_author_url(comment)}" rel="nofollow">${comment.author_name}</a>
56 </span> 56 </span>
57 <span class="blog-comment-user" py:if="not comment.author_url"> 57 <span class="blog-comment-user" py:if="not quoins.comment_author_url(comment)">
58 ${comment.author_name} 58 ${comment.author_name}
59 </span> 59 </span>
60 <br /> 60 <br />
@@ -62,7 +62,7 @@
62 ${comment.created.strftime('%B %d, %Y at %I:%M %p')} 62 ${comment.created.strftime('%B %d, %Y at %I:%M %p')}
63 </span> 63 </span>
64 64
65 <span py:if="tg.identity and 'blog-post' in [x.permission_name for x in tg.identity.user.permissions]"> 65 <span py:if="'blog-post' in [x.permission_name for x in tg.identity.user.permissions]">
66 &nbsp; &nbsp; 66 &nbsp; &nbsp;
67 <a href="${quoins.url('/delete_comment/%s'%comment.id)}"> 67 <a href="${quoins.url('/delete_comment/%s'%comment.id)}">
68 Delete comment 68 Delete comment