index.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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="thread-name">
  38. <a href="{% url 'redirect' slug=forum.slug, forum=forum.id %}">{{ forum.redirect_domain() }}</a>
  39. </div>
  40. <div class="muted">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'span', 'class="last-poster"') %}{{ clicks }} clicks{% endtrans %}</div>
  41. {%- endif %}
  42. </div>
  43. {% endif %}
  44. {% if forum.subforums %}
  45. <div class="dropdown">
  46. <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>
  47. <div class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  48. <div class="dropdown-shadow">
  49. <ul>
  50. {% for subforum in forum.subforums %}
  51. <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>
  52. {% endfor %}
  53. </ul>
  54. </div>
  55. </div>
  56. </div>
  57. {% endif%}
  58. <div class="hide forum-meta">
  59. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  60. <div class="forum-stats">
  61. {% if forum.type != 'redirect' %}
  62. <span>{% trans %}Posts{% endtrans %}: <strong>{{ forum.posts|intcomma }}</strong></span>
  63. {% trans %}Threads{% endtrans %}: <strong>{{ forum.threads|intcomma }}</strong>
  64. {% else %}
  65. {% trans %}Clicks{% endtrans %}: <strong>{{ forum.redirects|intcomma }}</strong>
  66. {% endif %}
  67. </div>
  68. </div>
  69. </td>
  70. </tr>
  71. {% endfor %}
  72. </tbody>
  73. </table>
  74. </div>
  75. {% endif %}{% endfor %}
  76. </div>
  77. </div>
  78. <div class="span4 index-sidebar">
  79. {% if ranks_online %}
  80. <div class="index-ranks-list">
  81. {% for rank in ranks_online %}{% if rank.online %}
  82. <div class="inder-rank{% if rank.style %} index-rank-{{ rank.style }}{% endif %}">
  83. <h3>{% if rank.slug %}<a href="{% url 'users' slug=rank.slug %}">{% endif %}{% trans rank_name=_(rank.name) %}{{ rank_name }} Online{% endtrans %}{% if rank.slug %}</a>{% endif %}</h3>
  84. <ul class="unstyled">
  85. {% for online in rank.online %}
  86. <li>
  87. <img src="{{ online.get_avatar(24) }}" alt="" class="avatar-small">
  88. <a href="{% url 'user' username=online.username_slug, user=online.pk %}" class="user-name">{{ online.username }}</a>
  89. {% if rank.title or online.title %}
  90. {% if rank.slug -%}
  91. <a href="{% url 'users' slug=rank.slug %}" class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</a>
  92. {%- else -%}
  93. <span class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</span>
  94. {% endif %}
  95. {% endif %}
  96. </li>
  97. {% endfor %}
  98. </ul>
  99. </div>
  100. {% endif %}{% endfor %}
  101. </div>
  102. {% endif %}
  103. {% if popular_threads %}
  104. <div class="index-popular-threads">
  105. <h3>{% trans %}Popular Threads{% endtrans %}</h3>
  106. <ul class="unstyled">
  107. {% for thread in popular_threads %}
  108. <li>
  109. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="index-popular-thread">{{ thread.name|short_string(38) }}</a>
  110. <div class="muted"><a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum_slug %}">{{ thread.forum_name }}</a> - {{ thread.last|reltimesince }}</div>
  111. </li>
  112. {% endfor %}
  113. </ul>
  114. </div>
  115. {% endif %}
  116. <div class="index-stats">
  117. <ul class="unstyled">
  118. <li>
  119. <span class="tooltip-top" title="{% trans %}Posts{% endtrans %}"><i class="icon-comment"></i> {{ monitor.posts|int|intcomma }}</span>
  120. </li>
  121. <li>
  122. <span class="tooltip-top" title="{% trans %}Threads{% endtrans %}"><i class="icon-th-list"></i> {{ monitor.threads|int|intcomma }}</span>
  123. </li>
  124. <li>
  125. <span class="tooltip-top" title="{% trans %}Members{% endtrans %}"><i class="icon-user"></i> {{ monitor.users|int|intcomma }}</span>
  126. </li>
  127. <li>
  128. <span class="tooltip-top" title="{% trans %}Online{% endtrans %}"><i class="icon-map-marker"></i> {{ users_online.members|int|intcomma }} <span class="muted">{{ users_online.all|int|intcomma }}</spam></span>
  129. </li>
  130. </ul>
  131. </div>
  132. {% if user.is_authenticated() %}
  133. <form action="{% url 'read_all' %}" method="post" class="index-forums-read-all">
  134. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  135. <button type="submit" class="btn btn-link"><i class="icon-ok"></i> {% trans %}Mark forums read{% endtrans %}</button>
  136. </form>
  137. {% endif %}
  138. </div>
  139. </div>
  140. {% endblock %}
  141. {% block javascripts -%}{{ super() }}
  142. <script type="text/javascript">
  143. $(function () {
  144. function populateForumTooltip(target) {
  145. return $('#forum-' + target + ' .forum-meta').html();
  146. };
  147. {% for category in forums_list %}{% for forum in category.subforums %}
  148. $('#forum-{{ forum.id }} .forum-title').tooltip({
  149. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  150. placement: 'right',
  151. html: true,
  152. title: populateForumTooltip({{ forum.id }})
  153. });
  154. {% endfor %}{% endfor %}
  155. });
  156. </script>
  157. {%- endblock %}