index.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 and forum.type != 'redirect' %}
  22. <div class="forum-details">
  23. {% 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)) %}
  24. {% if forum.last_thread_id -%}
  25. {% trans %}Latest{% endtrans %}: <a href="{% url 'thread_new' thread=forum.last_thread_id, slug=forum.last_thread_slug %}" class="tooltip-top" title="{{ forum.last_thread_name }}">{{ forum.last_thread_name|short_string(28) }}</a>
  26. {%- else -%}
  27. <em>{% trans %}This forum is empty{% endtrans %}</em>
  28. {%- endif %}
  29. {%- else -%}
  30. <em>{% trans %}This forum is protected{% endtrans %}</em>
  31. {%- endif %}
  32. </div>
  33. {% endif %}
  34. <div class="hide forum-meta">
  35. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  36. <div class="forum-stats">
  37. {% if forum.type != 'redirect' %}
  38. <span>{% trans %}Posts{% endtrans %}: <strong>{{ forum.posts|intcomma }}</strong></span>
  39. {% trans %}Threads{% endtrans %}: <strong>{{ forum.threads|intcomma }}</strong>
  40. {% else %}
  41. {% trans %}Clicks{% endtrans %}: <strong>{{ forum.redirects|intcomma }}</strong>
  42. {% endif %}
  43. </div>
  44. </div>
  45. </td>
  46. </tr>
  47. {% endfor %}
  48. </tbody>
  49. </table>
  50. </div>
  51. {% endif %}{% endfor %}
  52. </div>
  53. </div>
  54. <div class="span4 index-sidebar">
  55. {% if ranks_online %}
  56. <div class="index-ranks-list">
  57. {% for rank in ranks_online %}{% if rank.online %}
  58. <div class="inder-rank{% if rank.style %} index-rank-{{ rank.style }}{% endif %}">
  59. <h3>{% trans rank_name=_(rank.name) %}{{ rank_name }} Online{% endtrans %}</h3>
  60. <ul class="unstyled">
  61. {% for online in rank.online %}
  62. <li>
  63. <img src="{{ online.get_avatar(24) }}" alt="" class="avatar-small">
  64. <a href="{% url 'user' username=online.username_slug, user=online.pk %}">{{ online.username }}</a>
  65. {% if rank.title or online.title %}<span class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</span>{% endif %}
  66. </li>
  67. {% endfor %}
  68. </ul>
  69. </div>
  70. {% endif %}{% endfor %}
  71. </div>
  72. {% endif %}
  73. {% if popular_threads %}
  74. <div class="index-popular-threads">
  75. <h3>{% trans %}Popular Threads{% endtrans %}</h3>
  76. <ul class="unstyled">
  77. {% for thread in popular_threads %}
  78. <li>
  79. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="index-popular-thread">{{ thread.name|short_string(38) }}</a>
  80. <div class="muted"><a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum_slug %}">{{ thread.forum_name }}</a> - {{ thread.last|reltimesince }}</div>
  81. </li>
  82. {% endfor %}
  83. </ul>
  84. </div>
  85. {% endif %}
  86. <div class="index-stats">
  87. <ul class="unstyled">
  88. <li>
  89. <span class="tooltip-top" title="{% trans %}Posts{% endtrans %}"><i class="icon-comment"></i> {{ monitor.posts|int|intcomma }}</span>
  90. </li>
  91. <li>
  92. <span class="tooltip-top" title="{% trans %}Threads{% endtrans %}"><i class="icon-th-list"></i> {{ monitor.threads|int|intcomma }}</span>
  93. </li>
  94. <li>
  95. <span class="tooltip-top" title="{% trans %}Members{% endtrans %}"><i class="icon-user"></i> {{ monitor.users|int|intcomma }}</span>
  96. </li>
  97. <li>
  98. <span class="tooltip-top" title="{% trans %}Online{% endtrans %}"><i class="icon-map-marker"></i> {{ users_online|int|intcomma }}</span>
  99. </li>
  100. </ul>
  101. </div>
  102. {% if user.is_authenticated() %}
  103. <form action="{% url 'read_all' %}" method="post" class="index-forums-read-all">
  104. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  105. <button type="submit" class="btn btn-link"><i class="icon-ok"></i> {% trans %}Mark forums read{% endtrans %}</button>
  106. </form>
  107. {% endif %}
  108. </div>
  109. </div>
  110. {% endblock %}
  111. {% block javascripts -%}{{ super() }}
  112. <script type="text/javascript">
  113. $(function () {
  114. function populateForumTooltip(target) {
  115. return $('#forum-' + target + ' .forum-meta').html();
  116. };
  117. {% for category in forums_list %}{% for forum in category.subforums %}
  118. $('#forum-{{ forum.id }} .forum-title').tooltip({
  119. template: '<div class="tooltip forum-meta-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  120. placement: 'right',
  121. html: true,
  122. title: populateForumTooltip({{ forum.id }})
  123. });
  124. {% endfor %}{% endfor %}
  125. });
  126. </script>
  127. {%- endblock %}