popular_threads.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=_('Popular Threads')) }}{% endblock %}
  4. {% block container %}
  5. <div class="page-header header-primary">
  6. <div class="container">
  7. {{ messages_list(messages) }}
  8. <h1>{% trans %}Popular Threads{% endtrans %}</h1>
  9. </div>
  10. </div>
  11. <div class="container container-primary">
  12. {% if threads %}
  13. <div class="forum-threads-list">
  14. <div class="header">
  15. <div class="row-fluid">
  16. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  17. <div class="span5 thread-activity">
  18. <div class="thread-replies">{% trans %}Replies{% endtrans %}</div>
  19. <div class="thread-last">{% trans %}Last Reply{% endtrans %}</div>
  20. </div>
  21. </div>
  22. </div>
  23. {% for thread in threads %}
  24. <div class="thread-row{% if thread.pk == 2 or not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  25. <div class="row-fluid">
  26. <div class="span7">
  27. {% if thread.is_read and not thread.pk == 2 %}
  28. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}"><i class="icon-asterisk"></i></a>
  29. {% else %}
  30. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}"><i class="icon-fire"></i></a>
  31. {% endif %}
  32. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  33. <span class="thread-details">
  34. {% trans user=thread_starter(thread), forum=thread_forum(thread) %}by {{ user }} in {{ forum }}{% endtrans %}
  35. </span>
  36. <ul class="unstyled thread-flags">
  37. {% if thread.replies_reported %}
  38. <li><i class="icon-warning-sign tooltip-top" title="{% trans %}This thread has reported replies{% endtrans %}"></i></li>
  39. {% endif %}
  40. {% if thread.replies_moderated %}
  41. <li><i class="icon-question-sign tooltip-top" title="{% trans %}This thread has unreviewed replies{% endtrans %}"></i></li>
  42. {% endif %}
  43. {% if thread.weight == 2 %}
  44. <li><i class="icon-star tooltip-top" title="{% trans %}This thread is an annoucement{% endtrans %}"></i></li>
  45. {% endif %}
  46. {% if thread.weight == 1 %}
  47. <li><i class="icon-star-empty tooltip-top" title="{% trans %}This thread is sticky{% endtrans %}"></i></li>
  48. {% endif %}
  49. {% if thread.moderated %}
  50. <li><i class="icon-eye-close tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}"></i></li>
  51. {% endif %}
  52. {% if thread.deleted %}
  53. <li><i class="icon-trash tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}"></i></li>
  54. {% endif %}
  55. {% if thread.closed %}
  56. <li><i class="icon-lock tooltip-top" title="{% trans %}This thread is closed{% endtrans %}"></i></li>
  57. {% endif %}
  58. </ul>
  59. </div>
  60. <div class="span5 thread-activity">
  61. <div class="thread-replies tooltip-top" title="{{ replies(thread.replies) }}">{{ thread.replies|intcomma }} <i class="icon-comment"></i></div>
  62. <div class="thread-last-reply">
  63. {% if settings.avatars_on_threads_list %}
  64. <span class="thread-last-avatar">
  65. {% if thread.last_poster_id %}
  66. <a href="{% url 'user' user=thread.last_poster.pk, username=thread.last_poster.username_slug %}"><img src="{{ thread.last_poster.get_avatar(30) }}" alt=""></a>
  67. {% else %}
  68. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  69. {% endif %}
  70. </span>
  71. {% endif %}
  72. {{ thread_reply(thread) }}, {{ thread.last|reldate|low }}
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. {% endfor %}
  78. </div>
  79. {% else %}
  80. <p class="lead">{% trans %}Looks like there are no popular threads... yet!{% endtrans %}</p>
  81. {% endif %}
  82. </div>
  83. {% endblock %}
  84. {% macro replies(thread_replies) -%}
  85. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  86. {{ replies }} reply
  87. {%- pluralize -%}
  88. {{ replies }} replies
  89. {%- endtrans %}
  90. {%- endmacro %}
  91. {% macro thread_starter(thread) -%}
  92. {% if thread.start_poster_id %}<a href="{% url 'user' user=thread.start_poster_id, username=thread.start_poster_slug %}" class="user-link">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}
  93. {%- endmacro %}
  94. {% macro thread_forum(thread) -%}
  95. <a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum.slug %}" class="forum-link">{{ thread.forum.name }}</a>
  96. {%- endmacro %}
  97. {% macro thread_reply(thread) -%}
  98. {% if thread.last_poster_id %}<a href="{% url 'user' user=thread.last_poster_id, username=thread.last_poster_slug %}" class="user-link">{{ thread.last_poster_name }}</a>{% else %}{{ thread.last_poster_name }}{% endif %}
  99. {%- endmacro %}
  100. {% macro pager() -%}
  101. {% if items_total > 0 and pagination['total'] > 1 %}
  102. <div class="pagination">
  103. <ul>
  104. <li class="count">{{ macros.pager_label(pagination) }}</li>
  105. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'popular_threads' page=pagination['prev'] %}{% else %}{% url 'popular_threads' %}{% endif %}" class="tooltip-top" title="{% trans %}Previous Page{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  106. {%- if pagination['next'] > 0 %}<li><a href="{% url 'popular_threads' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Next Page{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  107. </ul>
  108. </div>
  109. {% endif %}
  110. {%- endmacro %}