new_threads.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. <table class="table">
  15. <thead>
  16. <tr>
  17. <th>{% trans %}Thread{% endtrans %}</th>
  18. <th class="span1">{% trans %}Rating{% endtrans %}</th>
  19. <th class="span5">{% trans %}Activity{% endtrans %}</th>
  20. {% if user.is_authenticated() and list_form %}
  21. <th class="check-cell"><label class="checkbox"><input type="checkbox" class="checkbox-master"></label></th>
  22. {% endif %}
  23. </tr>
  24. </thead>
  25. <tbody>
  26. {% for thread in threads %}
  27. <tr>
  28. <td>
  29. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="thread-icon{% if not thread.is_read %} thread-new{% endif %} tooltip-top" title="{% if not thread.is_read -%}
  30. {% trans %}Click to see first unread post{% endtrans %}
  31. {%- else -%}
  32. {% trans %}Click to see last post{% endtrans %}
  33. {%- endif %}"><i class="icon-comment"></i></a>
  34. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-name">{{ thread.name }}</a>
  35. <span class="thread-details">
  36. {% trans user=thread_starter(thread), forum=thread_forum(thread), start=thread.start|reldate|low %}by {{ user }} in {{ forum }} {{ start }}{% endtrans %}
  37. </span>
  38. <ul class="unstyled thread-flags">
  39. {% if thread.weight == 2 %}
  40. <li><i class="icon-star tooltip-top" title="{% trans %}This thread is an annoucement{% endtrans %}"></i></li>
  41. {% endif %}
  42. {% if thread.weight == 1 %}
  43. <li><i class="icon-star-empty tooltip-top" title="{% trans %}This thread is sticky{% endtrans %}"></i></li>
  44. {% endif %}
  45. {% if thread.closed %}
  46. <li><i class="icon-lock tooltip-top" title="{% trans %}This thread is closed{% endtrans %}"></i></li>
  47. {% endif %}
  48. </ul>
  49. </td>
  50. <td>
  51. <div class="thread-rating{% if (thread.upvotes-thread.downvotes) > 0 %} thread-rating-positive{% elif (thread.upvotes-thread.downvotes) < 0 %} thread-rating-negative{% endif %}">
  52. {% if (thread.upvotes-thread.downvotes) > 0 %}+{% elif (thread.upvotes-thread.downvotes) < 0 %}-{% endif %}{{ (thread.upvotes-thread.downvotes)|abs|intcomma }}
  53. </div>
  54. </td>
  55. <td>
  56. <div class="thread-last-reply">
  57. {{ replies(thread.replies) }} - {% trans user=thread_reply(thread), last=thread.last|reldate|low %}last by {{ user }} {{ last }}{% endtrans %}
  58. </div>
  59. </td>
  60. </tr>
  61. {% endfor %}
  62. </tbody>
  63. </table>
  64. </div>
  65. {{ pager() }}
  66. {% else %}
  67. <p class="lead">{% trans %}No new threads were started in last 48 hours.{% endtrans %}</p>
  68. {% endif %}
  69. </div>
  70. {% endblock %}
  71. {% macro replies(thread_replies) -%}
  72. {% trans count=thread_replies, replies=('<strong>' ~ (thread_replies|intcomma) ~ '</strong>')|safe -%}
  73. {{ replies }} reply
  74. {%- pluralize -%}
  75. {{ replies }} replies
  76. {%- endtrans %}
  77. {%- endmacro %}
  78. {% macro thread_starter(thread) -%}
  79. {% 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 %}
  80. {%- endmacro %}
  81. {% macro thread_forum(thread) -%}
  82. <a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum.slug %}" class="forum-link">{{ thread.forum.name }}</a>
  83. {%- endmacro %}
  84. {% macro thread_reply(thread) -%}
  85. {% 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 %}
  86. {%- endmacro %}
  87. {% macro pager() -%}
  88. {% if items_total > 0 and pagination['total'] > 1 %}
  89. <div class="pagination">
  90. <ul>
  91. <li class="count">{{ macros.pager_label(pagination) }}</li>
  92. {%- 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 -%}
  93. {%- 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 -%}
  94. </ul>
  95. </div>
  96. {% endif %}
  97. {%- endmacro %}