index.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{% if settings.board_index_title %}{{ settings.board_index_title }}{% else %}{{ settings.board_name }}{% endif %}{% endblock %}
  4. {% block meta %}{% if settings.board_index_meta %}
  5. <meta name="description" content="{{ settings.board_index_meta }}">
  6. {%- endif %}{%- endblock %}
  7. {% block content %}
  8. <div class="row">
  9. <div class="span8">
  10. <div class="index-forums-list">
  11. {% for category in forums_list %}{% if category.subforums %}
  12. <div class="index-category{% if category.style %} index-category-{{ category.style }}{% endif %}">
  13. <table class="table">
  14. <caption>{{ category.name }}{% if category.description %} <small>{{ category.description }}</small>{% endif %}</caption>
  15. <tbody>
  16. {% for forum in category.subforums %}
  17. <tr>
  18. <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>
  19. <td id="forum-{{ forum.id }}" class="forum-main">
  20. <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>
  21. {% if forum.show_details %}
  22. <div class="forum-details">
  23. {% if forum.type != 'redirect' %}
  24. {% 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)) %}
  25. {% if forum.last_thread_id -%}
  26. <div class="thread-name">
  27. <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>
  28. </div>
  29. <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>
  30. {%- else -%}
  31. <em>{% trans %}This forum is empty{% endtrans %}</em>
  32. {%- endif %}
  33. {%- else -%}
  34. <em>{% trans %}This forum is protected{% endtrans %}</em>
  35. {%- endif %}
  36. {%- else -%}
  37. <div class="forum-clicks">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'strong') %}{{ clicks }} clicks{% endtrans %}</div>
  38. {%- endif %}
  39. </div>
  40. {% endif %}
  41. {% if forum.subforums %}
  42. <div class="dropdown">
  43. <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>
  44. <div class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  45. <div class="dropdown-shadow">
  46. <ul>
  47. {% for subforum in forum.subforums %}
  48. <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>
  49. {% endfor %}
  50. </ul>
  51. </div>
  52. </div>
  53. </div>
  54. {% endif%}
  55. <div class="hide forum-meta">
  56. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  57. <div class="forum-stats">
  58. {% if forum.type != 'redirect' %}
  59. <span>{% trans %}Posts{% endtrans %}: <strong>{{ forum.posts|intcomma }}</strong></span>
  60. {% trans %}Threads{% endtrans %}: <strong>{{ forum.threads|intcomma }}</strong>
  61. {% else %}
  62. {% trans %}Clicks{% endtrans %}: <strong>{{ forum.redirects|intcomma }}</strong>
  63. {% endif %}
  64. </div>
  65. </div>
  66. </td>
  67. </tr>
  68. {% endfor %}
  69. </tbody>
  70. </table>
  71. </div>
  72. {% endif %}{% endfor %}
  73. </div>
  74. </div>
  75. <div class="span4 index-sidebar">
  76. {% if ranks_online %}
  77. <div class="index-ranks-list">
  78. {% for rank in ranks_online %}{% if rank.online %}
  79. <div class="inder-rank{% if rank.style %} index-rank-{{ rank.style }}{% endif %}">
  80. <h3>{% trans rank_name=_(rank.name) %}{{ rank_name }} Online{% endtrans %}</h3>
  81. <ul class="unstyled">
  82. {% for online in rank.online %}
  83. <li>
  84. <img src="{{ online.get_avatar(24) }}" alt="" class="avatar-small">
  85. <a href="{% url 'user' username=online.username_slug, user=online.pk %}">{{ online.username }}</a>
  86. {% if rank.title or online.title %}<span class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</span>{% endif %}
  87. </li>
  88. {% endfor %}
  89. </ul>
  90. </div>
  91. {% endif %}{% endfor %}
  92. </div>
  93. {% endif %}
  94. {% if popular_threads %}
  95. <div class="index-popular-threads">
  96. <h3>{% trans %}Popular Threads{% endtrans %}</h3>
  97. <ul class="unstyled">
  98. {% for thread in popular_threads %}
  99. <li>
  100. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="index-popular-thread">{{ thread.name|short_string(38) }}</a>
  101. <div class="muted"><a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum_slug %}">{{ thread.forum_name }}</a> - {{ thread.last|reltimesince }}</div>
  102. </li>
  103. {% endfor %}
  104. </ul>
  105. </div>
  106. {% endif %}
  107. <div class="index-stats">
  108. <ul class="unstyled">
  109. <li>
  110. <span class="tooltip-top" title="{% trans %}Posts{% endtrans %}"><i class="icon-comment"></i> {{ monitor.posts|int|intcomma }}</span>
  111. </li>
  112. <li>
  113. <span class="tooltip-top" title="{% trans %}Threads{% endtrans %}"><i class="icon-th-list"></i> {{ monitor.threads|int|intcomma }}</span>
  114. </li>
  115. <li>
  116. <span class="tooltip-top" title="{% trans %}Members{% endtrans %}"><i class="icon-user"></i> {{ monitor.users|int|intcomma }}</span>
  117. </li>
  118. <li>
  119. <span class="tooltip-top" title="{% trans %}Online{% endtrans %}"><i class="icon-map-marker"></i> {{ users_online|int|intcomma }}</span>
  120. </li>
  121. </ul>
  122. </div>
  123. {% if user.is_authenticated() %}
  124. <form action="{% url 'read_all' %}" method="post" class="index-forums-read-all">
  125. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  126. <button type="submit" class="btn btn-link"><i class="icon-ok"></i> {% trans %}Mark forums read{% endtrans %}</button>
  127. </form>
  128. {% endif %}
  129. </div>
  130. </div>
  131. {% endblock %}
  132. {% block javascripts -%}{{ super() }}
  133. <script type="text/javascript">
  134. $(function () {
  135. function populateForumTooltip(target) {
  136. return $('#forum-' + target + ' .forum-meta').html();
  137. };
  138. {% for category in forums_list %}{% for forum in category.subforums %}
  139. $('#forum-{{ forum.id }} .forum-title').tooltip({
  140. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  141. placement: 'right',
  142. html: true,
  143. title: populateForumTooltip({{ forum.id }})
  144. });
  145. {% endfor %}{% endfor %}
  146. });
  147. </script>
  148. {%- endblock %}