posts.html 3.2 KB

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