index.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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>{% trans rank_name=_(rank.name) %}{{ rank_name }} Online{% endtrans %}</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 %}">{{ online.username }}</a>
  89. {% if rank.title or online.title %}<span class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</span>{% endif %}
  90. </li>
  91. {% endfor %}
  92. </ul>
  93. </div>
  94. {% endif %}{% endfor %}
  95. </div>
  96. {% endif %}
  97. {% if popular_threads %}
  98. <div class="index-popular-threads">
  99. <h3>{% trans %}Popular Threads{% endtrans %}</h3>
  100. <ul class="unstyled">
  101. {% for thread in popular_threads %}
  102. <li>
  103. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="index-popular-thread">{{ thread.name|short_string(38) }}</a>
  104. <div class="muted"><a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum_slug %}">{{ thread.forum_name }}</a> - {{ thread.last|reltimesince }}</div>
  105. </li>
  106. {% endfor %}
  107. </ul>
  108. </div>
  109. {% endif %}
  110. <div class="index-stats">
  111. <ul class="unstyled">
  112. <li>
  113. <span class="tooltip-top" title="{% trans %}Posts{% endtrans %}"><i class="icon-comment"></i> {{ monitor.posts|int|intcomma }}</span>
  114. </li>
  115. <li>
  116. <span class="tooltip-top" title="{% trans %}Threads{% endtrans %}"><i class="icon-th-list"></i> {{ monitor.threads|int|intcomma }}</span>
  117. </li>
  118. <li>
  119. <span class="tooltip-top" title="{% trans %}Members{% endtrans %}"><i class="icon-user"></i> {{ monitor.users|int|intcomma }}</span>
  120. </li>
  121. <li>
  122. <span class="tooltip-top" title="{% trans %}Online{% endtrans %}"><i class="icon-map-marker"></i> {{ users_online|int|intcomma }}</span>
  123. </li>
  124. </ul>
  125. </div>
  126. {% if user.is_authenticated() %}
  127. <form action="{% url 'read_all' %}" method="post" class="index-forums-read-all">
  128. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  129. <button type="submit" class="btn btn-link"><i class="icon-ok"></i> {% trans %}Mark forums read{% endtrans %}</button>
  130. </form>
  131. {% endif %}
  132. </div>
  133. </div>
  134. {% endblock %}
  135. {% block javascripts -%}{{ super() }}
  136. <script type="text/javascript">
  137. $(function () {
  138. function populateForumTooltip(target) {
  139. return $('#forum-' + target + ' .forum-meta').html();
  140. };
  141. {% for category in forums_list %}{% for forum in category.subforums %}
  142. $('#forum-{{ forum.id }} .forum-title').tooltip({
  143. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  144. placement: 'right',
  145. html: true,
  146. title: populateForumTooltip({{ forum.id }})
  147. });
  148. {% endfor %}{% endfor %}
  149. });
  150. </script>
  151. {%- endblock %}