posts.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {% extends "cranefly/profiles/profile.html" %}
  2. {% load i18n %}
  3. {% load humanize %}
  4. {% load url from future %}
  5. {% import "_forms.html" as form_theme with context %}
  6. {% import "cranefly/macros.html" as macros with context %}
  7. {% block title %}{{ macros.page_title(_('Posts'), profile.username) }}{% endblock %}
  8. {% block tab %}
  9. <h2>{% if items_total -%}
  10. {%- trans count=items_total, total=items_total|intcomma, username=profile.username -%}
  11. {{ username }} has one post
  12. {%- pluralize -%}
  13. {{ username }} has {{ total }} posts
  14. {%- endtrans -%}
  15. {%- else -%}
  16. {% trans username=profile.username %}{{ username }} has no posts{% endtrans %}
  17. {%- endif %}</h2>
  18. {% if items_total %}
  19. <div class="content-list user-posts">
  20. {% for item in items %}
  21. <div class="media">
  22. <a href="{% url 'user' user=profile.pk, username=profile.username_slug %}" class="pull-left">
  23. <img class="media-object" src="{{ profile.get_avatar(52) }}">
  24. </a>
  25. <div class="media-body">
  26. <a href="{% url 'thread_find' thread=item.thread.pk, slug=item.thread.slug, post=item.pk %}" class="post-preview">{{ item.post_preparsed|markdown_short(300) }}</a>
  27. <div class="media-footer">{% if item.thread.start_post_id == item.pk -%}
  28. {% trans thread=thread(item), forum=forum(item.forum), date=item.date|reldate|low %}Thread {{ thread }} posted in {{ forum }} {{ date }}{% endtrans %}
  29. {%- else -%}
  30. {% trans thread=thread(item), forum=forum(item.forum), date=item.date|reldate|low %}Reply to {{ thread }} posted in {{ forum }} {{ date }}{% endtrans %}
  31. {%- endif %}</div>
  32. </div>
  33. </div>
  34. <hr>
  35. {% endfor %}
  36. {{ pager() }}
  37. </div>
  38. {% endif %}
  39. {% endblock %}
  40. {% macro pager() -%}
  41. {% if pagination['total'] > 1 %}
  42. <div class="pagination">
  43. <ul>
  44. <li class="count">{{ macros.pager_label(pagination) }}</li>
  45. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'user_posts' user=profile.id, username=profile.username_slug %}" class="tooltip-top" title="{% trans %}Lastest Posts{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}Latest{% endtrans %}</a></li>{% endif -%}
  46. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'user_posts' user=profile.id, username=profile.username_slug, page=pagination['prev'] %}{% else %}{% url 'user_posts' user=profile.id, username=profile.username_slug %}{% endif %}" class="tooltip-top" title="{% trans %}Newer Posts{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  47. {%- if pagination['next'] > 0 %}<li><a href="{% url 'user_posts' user=profile.id, username=profile.username_slug, page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Older Posts{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  48. </ul>
  49. </div>
  50. {% endif %}
  51. {%- endmacro %}
  52. {% macro thread(item) -%}
  53. <a href="{% url 'thread_find' thread=item.thread.pk, slug=item.thread.slug, post=item.pk %}">{{ item.thread.name }}</a>
  54. {%- endmacro %}
  55. {% macro forum(forum) -%}
  56. <a href="{% url 'forum' forum=forum.pk, slug=forum.slug %}">{{ forum.name }}</a>
  57. {%- endmacro %}