category.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=category.name) }}{% endblock %}
  4. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  5. {{ macros.parents_list(parents) }}
  6. <li class="active">{{ category.name }}
  7. {%- endblock %}
  8. {% block container %}
  9. <div class="page-header header-primary">
  10. <div class="container">
  11. {{ messages_list(messages) }}
  12. <ul class="breadcrumb" {{ macros.itemprop_bread() }}>
  13. {{ self.breadcrumb() }}</li>
  14. </ul>
  15. <h1>{{ category.name }}</h1>
  16. </div>
  17. </div>
  18. <div class="container container-primary">
  19. {% if category.description %}
  20. <div class="markdown lead page-description">
  21. {{ category.description_preparsed|markdown_final|safe }}
  22. </div>
  23. {% endif %}
  24. {% if category.subforums %}
  25. <div id="subforums" class="category-forums-list{% if category.style %} category-forums-{{ category.style }}{% endif %}">
  26. <table class="table">
  27. <tbody>
  28. {% for forum in category.subforums %}
  29. <tr>
  30. <td class="forum-icon"><span class="forum-icon-wrap{% if forum.type == 'redirect' %} forum-icon-redirect{% elif not forum.is_read %} forum-icon-new{% endif %}"><i class="icon-{% if forum.type == 'redirect' %}circle-arrow-right{% else %}comment{% endif %} icon-white"></i></span></td>
  31. <td id="forum-{{ forum.id }}" class="forum-main">
  32. <h3 class="forum-title{% if not forum.is_read %} forum-title-new{% endif %}"><a href="{{ forum.type|url(slug=forum.slug, forum=forum.id) }}">{{ forum.name }}</a></h3>
  33. {% if forum.show_details %}
  34. <div class="forum-details">
  35. {% if forum.type != 'redirect' %}
  36. {% if acl.forums.can_browse(forum) and (acl.threads.can_read_threads(forum) == 2 or (acl.threads.can_read_threads(forum) == 1 and forum.last_poster_id == user.pk)) %}
  37. {% if forum.last_thread_id -%}
  38. <div class="thread-name">
  39. <a href="{% url 'thread_new' thread=forum.last_thread_id, slug=forum.last_thread_slug %}"{% if forum.last_thread_name|length > 36 %} class="tooltip-top" title="{{ forum.last_thread_name }}"{% endif %}>{{ forum.last_thread_name|short_string(36) }}</a>
  40. </div>
  41. <div class="muted">{% if forum.last_poster_id %}<a href="{% url 'user' user=forum.last_poster_id, username=forum.last_poster_slug %}" class="last-poster">{{ forum.last_poster_name }}</a>{% else %}<span class="last-poster">{{ forum.last_poster_name }}</span>{% endif %} - {{ forum.last_thread_date|reltimesince }}</div>
  42. {%- else -%}
  43. <em>{% trans %}This forum is empty{% endtrans %}</em>
  44. {%- endif %}
  45. {%- else -%}
  46. <em>{% trans %}This forum is protected{% endtrans %}</em>
  47. {%- endif %}
  48. {%- else -%}
  49. <div class="thread-name">
  50. <a href="{% url 'redirect' slug=forum.slug, forum=forum.id %}">{{ forum.redirect_domain() }}</a>
  51. </div>
  52. <div class="muted">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'span', 'class="last-poster"') %}{{ clicks }} clicks{% endtrans %}</div>
  53. {%- endif %}
  54. </div>
  55. {% endif %}
  56. {% if forum.subforums %}
  57. <div class="dropdown">
  58. <a href="{{ forum.type|url(slug=forum.slug, forum=forum.id) }}#subforums" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-chevron-down"></i> {% trans %}Subforums{% endtrans %}</a>
  59. <div class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  60. <div class="dropdown-shadow">
  61. <ul>
  62. {% for subforum in forum.subforums %}
  63. <li><a href="{{ subforum.type|url(slug=subforum.slug, forum=subforum.id) }}"><i class="icon-{% if subforum.type == 'redirect' %}circle-arrow-right{% else %}comment{% endif %}"></i> {{ subforum.name }}</a></li>
  64. {% endfor %}
  65. </ul>
  66. </div>
  67. </div>
  68. </div>
  69. {% endif%}
  70. <div class="hide forum-meta">
  71. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  72. <div class="forum-stats">
  73. {% if forum.type != 'redirect' %}
  74. <span>{% trans %}Posts{% endtrans %}: <strong>{{ forum.posts|intcomma }}</strong></span>
  75. {% trans %}Threads{% endtrans %}: <strong>{{ forum.threads|intcomma }}</strong>
  76. {% else %}
  77. {% trans %}Clicks{% endtrans %}: <strong>{{ forum.redirects|intcomma }}</strong>
  78. {% endif %}
  79. </div>
  80. </div>
  81. </td>
  82. </tr>
  83. {% endfor %}
  84. </tbody>
  85. </table>
  86. </div>
  87. {% else %}
  88. <p class="lead">{% trans %}Looks like there are no forums to display in this category.{% endtrans %}</p>
  89. {% endif %}
  90. </div>
  91. {% endblock %}
  92. {% block javascripts -%}{{ super() }}
  93. <script type="text/javascript">
  94. $(function () {
  95. function populateForumTooltip(target) {
  96. return $('#forum-' + target + ' .forum-meta').html();
  97. };
  98. {% for forum in category.subforums %}
  99. $('#forum-{{ forum.id }} .forum-title').tooltip({
  100. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  101. placement: 'right',
  102. html: true,
  103. title: populateForumTooltip({{ forum.id }})
  104. });
  105. {% endfor %}
  106. });
  107. </script>
  108. {%- endblock %}