new_threads.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=_('New Threads')) }}{% endblock %}
  4. {% block container %}
  5. <div class="page-header header-primary">
  6. <div class="container">
  7. {{ messages_list(messages) }}
  8. <h1>{% trans %}New 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. {{ pager() }}
  80. {% else %}
  81. <p class="lead">{% trans %}No new threads were started in last 48 hours.{% endtrans %}</p>
  82. {% endif %}
  83. </div>
  84. {% endblock %}
  85. {% macro replies(thread_replies) -%}
  86. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  87. {{ replies }} reply
  88. {%- pluralize -%}
  89. {{ replies }} replies
  90. {%- endtrans %}
  91. {%- endmacro %}
  92. {% macro thread_starter(thread) -%}
  93. {% 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 %}
  94. {%- endmacro %}
  95. {% macro thread_forum(thread) -%}
  96. <a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum.slug %}" class="forum-link">{{ thread.forum.name }}</a>
  97. {%- endmacro %}
  98. {% macro thread_reply(thread) -%}
  99. {% 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 %}
  100. {%- endmacro %}
  101. {% macro pager() -%}
  102. {% if items_total > 0 and pagination['total'] > 1 %}
  103. <div class="pagination">
  104. <ul>
  105. <li class="count">{{ macros.pager_label(pagination) }}</li>
  106. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'new_threads' page=pagination['prev'] %}{% else %}{% url 'new_threads' %}{% endif %}" class="tooltip-top" title="{% trans %}Previous Page{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  107. {%- if pagination['next'] > 0 %}<li><a href="{% url 'new_threads' page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Next Page{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  108. </ul>
  109. </div>
  110. {% endif %}
  111. {%- endmacro %}