new_threads.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% import "cranefly/macros.html" as macros with context %}
  4. {% block title %}{{ macros.page_title(title=_('New Threads')) }}{% endblock %}
  5. {% block container %}
  6. <div class="page-header header-primary">
  7. <div class="container">
  8. {{ messages_list(messages) }}
  9. <h1>{% trans %}New Threads{% endtrans %}</h1>
  10. </div>
  11. </div>
  12. <div class="container container-primary">
  13. {% if threads %}
  14. <div class="new-threads">
  15. <table class="table">
  16. <thead>
  17. <tr>
  18. <th>{% trans %}Thread{% endtrans %}</th>
  19. <th class="span6">{% trans %}Started{% endtrans %}</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {% for thread in threads %}
  24. <tr>
  25. <td>
  26. <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>
  27. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="thread-title">{{ thread.name }}</a>
  28. </td>
  29. <td class="thread-details">
  30. {% 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 %}
  31. </td>
  32. </tr>
  33. {% endfor %}
  34. </tbody>
  35. </table>
  36. </div>
  37. {{ pager() }}
  38. {% else %}
  39. <p class="lead">{% trans %}No new threads were started in last 48 hours.{% endtrans %}</p>
  40. {% endif %}
  41. </div>
  42. {% endblock %}
  43. {% macro forum(forum) -%}
  44. <a href="{% url 'forum' forum=forum.pk, slug=forum.slug %}">{{ forum.name }}</a>
  45. {%- endmacro %}
  46. {% macro username(id, username, slug) -%}
  47. {%- if id -%}
  48. <a href="{% url 'user' user=id, username=slug %}">{{ username }}</a>
  49. {%- else -%}
  50. {{ username }}
  51. {%- endif -%}
  52. {%- endmacro %}
  53. {% macro pager() -%}
  54. {% if items_total > 0 and pagination['total'] > 1 %}
  55. <div class="pagination">
  56. <ul>
  57. <li class="count">{{ macros.pager_label(pagination) }}</li>
  58. {%- 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 -%}
  59. {%- 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 -%}
  60. </ul>
  61. </div>
  62. {% endif %}
  63. {%- endmacro %}