index.html 9.6 KB

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