A Python content management system designed for kirsle.net featuring a blog, comments and photo albums. https://rophako.kirsle.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3KB

  1. {# Reusable template for showing a blog post content #}
  2. {% macro blog_entry(post, from=None) %}
  3. {% if from == "index" %}
  4. <a href="{{ url_for('blog.entry', fid=post['fid']) }}" class="blog-title-index">
  5. {{ post["subject"] }}
  6. </a><p>
  7. {% endif %}
  8. <div class="blog-author">
  9. <a href="#">{# TODO #}
  10. {% if post["avatar"] %}
  11. <img src="/static/avatars/{{ post['avatar'] }}">
  12. {% else %}
  13. <img src="/static/avatars/default.png">
  14. {% endif %}
  15. </a><br>
  16. <a href="#">
  17. {{ post["profile"]["username"] }}
  18. </a>
  19. </div>
  20. <div class="blog-timestamp">
  21. Posted by <a href="#">{{ post["profile"]["name"] }}</a>
  22. on <span title="{{ post['time'] }}">{{ post["pretty_time"] }}</span>
  23. </div>
  24. {{ post["body"] | safe }}
  25. <p>
  26. <div class="clear">
  27. <strong>Categories:</strong>
  28. {% if post["categories"]|length == 0 %}
  29. <a href="{{ url_for('blog.category', category=Uncategorized) }}">Uncategorized</a>{# TODO hardcoded name #}
  30. {% else %}
  31. <ul class="blog-categories">
  32. {% for tag in post["categories"] %}
  33. <li><a href="{{ url_for('blog.category', category=tag) }}">{{ tag }}</a></li>
  34. {% endfor %}
  35. </ul>
  36. {% endif %}
  37. <p>
  38. [
  39. {% if from == "index" %}
  40. {% if post["comments"] %}{# Allowed comments #}
  41. <a href="{{ url_for('blog.entry', fid=post['fid']) }}#comments">{{ post["comment_count"] }} comment{% if post["comment_count"] != 1 %}s{% endif %}</a>
  42. |
  43. <a href="{{ url_for('blog.entry', fid=post['fid']) }}#addcomment">Add comment</a>
  44. |
  45. {% endif %}
  46. <a href="{{ url_for('blog.entry', fid=post['fid']) }}">Permalink</a>
  47. {% else %}
  48. <a href="{{ url_for('blog.index') }}">Blog</a>
  49. {% endif %}
  50. {% if session["login"] %}
  51. |
  52. <a href="{{ url_for('blog.update', id=post['post_id']) }}">Edit</a>
  53. |
  54. <a href="{{ url_for('blog.delete', id=post['post_id']) }}">Delete</a>
  55. {% endif %}
  56. ]
  57. </div>
  58. {% endmacro %}