index.html 9.2 KB

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