new_threads.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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="new-threads">
  14. <table class="table">
  15. <thead>
  16. <tr>
  17. <th>{% trans %}Thread{% endtrans %}</th>
  18. <th class="span6">{% trans %}Started{% endtrans %}</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {% for thread in threads %}
  23. <tr>
  24. <td>
  25. <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="label thread-reply{% if thread.has_reply %} has-reply{% endif %} tooltip-top" title="{% if thread.has_reply %}{% trans %}You've replied to this thread{% endtrans %}{% else %}{% trans %}This thread waits for your voice{% endtrans %}{% endif %}"><i class="icon-comment"></i></a>
  26. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-title">{{ thread.name }}</a>
  27. </td>
  28. <td class="thread-details">
  29. {% trans forum=forum(thread.forum), starter=username(thread.start_poster_id, thread.start_poster_name, thread.start_poster_slug), start=thread.start|reltimesince %}{{ start }} - by {{ starter }} - {{ forum }}{% endtrans %}
  30. </td>
  31. </tr>
  32. {% endfor %}
  33. </tbody>
  34. </table>
  35. </div>
  36. {{ pager() }}
  37. {% else %}
  38. <p class="lead">{% trans %}No new threads were started in last 48 hours.{% endtrans %}</p>
  39. {% endif %}
  40. </div>
  41. {% endblock %}
  42. {% macro forum(forum) -%}
  43. <a href="{% url 'forum' forum=forum.pk, slug=forum.slug %}">{{ forum.name }}</a>
  44. {%- endmacro %}
  45. {% macro username(id, username, slug) -%}
  46. {%- if id -%}
  47. <a href="{% url 'user' user=id, username=slug %}">{{ username }}</a>
  48. {%- else -%}
  49. {{ username }}
  50. {%- endif -%}
  51. {%- endmacro %}
  52. {% macro pager() -%}
  53. {% if items_total > 0 and pagination['total'] > 1 %}
  54. <div class="pagination">
  55. <ul>
  56. <li class="count">{{ macros.pager_label(pagination) }}</li>
  57. {%- 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 -%}
  58. {%- 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 -%}
  59. </ul>
  60. </div>
  61. {% endif %}
  62. {%- endmacro %}