posts.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. <div class="stat-header">
  7. <div class="help-text">
  8. {% trans user=profile.username %}Graph presents {{ user }}'s posting activity from last 100 days.{% endtrans %}
  9. </div>
  10. <div id="user-graph"></div>
  11. <h2>{% if items_total -%}
  12. {%- trans count=items_total, total=items_total|intcomma, username=profile.username -%}
  13. {{ username }} has one post
  14. {%- pluralize -%}
  15. {{ username }} has {{ total }} posts
  16. {%- endtrans -%}
  17. {%- else -%}
  18. {% trans username=profile.username %}{{ username }} has no posts{% endtrans %}
  19. {%- endif %}</h2>
  20. </div>
  21. {% if items_total %}
  22. <div class="content-list user-posts">
  23. {% for item in items %}
  24. <div class="media">
  25. <a href="{{ url('user', user=profile.pk, username=profile.username_slug) }}" class="pull-left">
  26. <img class="media-object" src="{{ profile.get_avatar(52) }}">
  27. </a>
  28. <div class="media-body">
  29. <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>
  30. <div class="media-footer">{% if item.thread.start_post_id == item.pk -%}
  31. {% trans thread=thread(item), forum=forum(item.forum), date=item.date|reltimesince|low %}Thread {{ thread }} posted in {{ forum }} {{ date }}{% endtrans %}
  32. {%- else -%}
  33. {% trans thread=thread(item), forum=forum(item.forum), date=item.date|reltimesince|low %}Reply to {{ thread }} posted in {{ forum }} {{ date }}{% endtrans %}
  34. {%- endif %}</div>
  35. </div>
  36. </div>
  37. <hr>
  38. {% endfor %}
  39. {{ pager() }}
  40. </div>
  41. {% endif %}
  42. {% endblock %}
  43. {% macro pager() -%}
  44. {% if pagination['total'] > 1 %}
  45. <div class="pagination">
  46. <ul>
  47. <li class="count">{{ macros.pager_label(pagination) }}</li>
  48. {%- 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 -%}
  49. {%- 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 -%}
  50. {%- 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 -%}
  51. </ul>
  52. </div>
  53. {% endif %}
  54. {%- endmacro %}
  55. {% macro thread(item) -%}
  56. <a href="{{ url('thread_find', thread=item.thread.pk, slug=item.thread.slug, post=item.pk) }}">{{ item.thread.name }}</a>
  57. {%- endmacro %}
  58. {% macro forum(forum) -%}
  59. <a href="{{ url('forum', forum=forum.pk, slug=forum.slug) }}">{{ forum.name }}</a>
  60. {%- endmacro %}
  61. {% block javascripts %}
  62. {{ draw_graph() }}
  63. {% endblock %}