forums.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {% load humanize i18n misago_capture %}
  2. <ul class="list-group">
  3. {% for forum in forums %}
  4. <li class="list-group-item">
  5. {% if forum.role == 'redirect' %}
  6. <span class="forum-icon fa fa-link fa-fw tooltip-top" title="{% trans "Redirect forum" %}"></span>
  7. {% else %}
  8. <span class="forum-icon fa fa-comment{% if forum.is_read %}-o{% else %} new{% endif %} fa-fw tooltip-top" title="{% if forum.is_read %}{% trans "Forum has no new posts." %}{% else %}{% trans "Forum has new posts." %}{% endif %}"></span>
  9. {% endif %}
  10. <a href="{{ forum.get_absolute_url }}" class="item-title forum-name">{{ forum }}</a>
  11. <div class="sr-only forum-description">
  12. {% if forum.description %}
  13. {{ forum.description|linebreaks }}
  14. {% endif %}
  15. <ul class="list-unstyled">
  16. {% if forum.role == 'redirect' %}
  17. <li>
  18. {% trans "Clicks:" %} <strong>{{ forum.redirects|intcomma }}</strong>
  19. </li>
  20. {% elif forum.acl.can_browse %}
  21. <li>
  22. {% trans "Posts:" %} <strong>{{ forum.posts|intcomma }}</strong>
  23. </li>
  24. <li>
  25. {% trans "Threads:" %} <strong>{{ forum.threads|intcomma }}</strong>
  26. </li>
  27. {% else %}
  28. <li>
  29. {% trans "You don't have permission to browse this forum." %}
  30. </li>
  31. {% endif %}
  32. </ul>
  33. </div>
  34. <footer>
  35. {% if forum.role == 'redirect' %}
  36. <a href="{{ forum.get_absolute_url }}" class="item-title">{{ forum.redirect_host }}</a>
  37. <div class="text-muted">
  38. {% capture as clicks %}<strong>{{ forum.redirects|intcomma }}</strong>{% endcapture %}
  39. {% blocktrans trimmed with clicks=clicks|safe count counter=forum.redirects %}
  40. {{ clicks }} click
  41. {% plural %}
  42. {{ clicks }} clicks
  43. {% endblocktrans %}
  44. </div>
  45. {% elif forum.acl.can_browse %}
  46. {% if not forum.acl.can_see_all_threads %}
  47. <em class="text-muted">{% trans "Forum is private" %}</em>
  48. {% elif forum.last_thread_title %}
  49. <a href="{% url 'misago:thread_new' thread_slug=forum.last_thread_slug thread_id=forum.last_thread_id %}" class="item-title">{{ forum.last_thread_title }}</a>
  50. <div class="text-muted">
  51. {% capture trimmed as last_poster %}
  52. {% if forum.last_poster_id %}
  53. <a href="{% url USER_PROFILE_URL user_id=forum.last_poster_id user_slug=forum.last_poster_slug %}" class="item-title">{{ forum.last_poster_name }}</a>
  54. {% else %}
  55. <strong class="item-title">{{ forum.last_poster_name }}</strong>
  56. {% endif %}
  57. {% endcapture %}
  58. {% capture trimmed as last_post %}
  59. <abbr class="tooltip-top dynamic time-ago" title="{{ forum.last_post_on }}" data-timestamp="{{ forum.last_post_on|date:"c" }}">
  60. {{ forum.last_post_on|date }}
  61. </abbr>
  62. {% endcapture %}
  63. {% blocktrans trimmed with last_poster=last_poster|safe last_post=last_post|safe %}
  64. {{ last_poster }}, {{ last_post }}
  65. {% endblocktrans %}
  66. </div>
  67. {% else %}
  68. <em class="text-muted">{% trans "Forum is empty" %}</em>
  69. {% endif %}
  70. {% else %}
  71. <em class="text-muted">{% trans "Can't be browsed" %}</em>
  72. {% endif %}
  73. </footer>
  74. {% if forum.subforums %}
  75. <div class="dropdown pull-right">
  76. <button class="btn btn-default btn-sm dropdown-toggle tooltip-top" title="{% trans "Subforums list" %}" type="button" id="dropdownMenu1" data-toggle="dropdown">
  77. <span class="fa fa-reorder fa-lg"></span>
  78. </button>
  79. <ul class="dropdown-menu scrollable" role="menu" aria-labelledby="dropdownMenu1">
  80. {% for subforum in forum.subforums %}
  81. <li role="presentation">
  82. <a role="menuitem" tabindex="-1" href="{{ subforum.get_absolute_url }}">
  83. {% if subforum.role == 'redirect' %}
  84. <span class="forum-icon fa fa-link fa-fw"></span>
  85. {% else %}
  86. <span class="forum-icon fa fa-comment{% if subforum.is_read %}-o{% else %} new{% endif %} fa-fw "></span>
  87. {% endif %}
  88. {{ subforum }}
  89. </a>
  90. </li>
  91. {% endfor %}
  92. </ul>
  93. </div>
  94. {% endif %}
  95. </li>
  96. {% endfor %}
  97. </ul>