posts.html 3.1 KB

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