index.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 class="forum-main">
  20. <h3{% if not forum.is_read %} class="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. {{ redirect_stats(forum) }}
  25. {% else %}
  26. {{ forum_stats(forum) }}
  27. {% endif %}
  28. </div>
  29. {% endif %}
  30. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  31. </td>
  32. </tr>
  33. {% endfor %}
  34. </tbody>
  35. </table>
  36. </div>
  37. {% endif %}{% endfor %}
  38. </div>
  39. </div>
  40. <div class="span4 index-sidebar">
  41. {% if ranks_online %}
  42. <div class="index-ranks-list">
  43. {% for rank in ranks_online %}{% if rank.online %}
  44. <div class="inder-rank{% if rank.style %} index-rank-{{ rank.style }}{% endif %}">
  45. <h3>{% trans rank_name=_(rank.name) %}{{ rank_name }} Online{% endtrans %}</h3>
  46. <ul class="unstyled">
  47. {% for online in rank.online %}
  48. <li>
  49. <img src="{{ online.get_avatar(24) }}" alt="" class="avatar-small">
  50. <a href="{% url 'user' username=online.username_slug, user=online.pk %}">{{ online.username }}</a>
  51. {% if rank.title or online.title %}<span class="label">{% if online.title %}{{ online.title }}{% else %}{{ _(rank.title) }}{% endif %}</span>{% endif %}
  52. </li>
  53. {% endfor %}
  54. </ul>
  55. </div>
  56. {% endif %}{% endfor %}
  57. </div>
  58. {% endif %}
  59. {% if popular_threads %}
  60. <div class="index-popular-threads">
  61. <h3>{% trans %}Popular Threads{% endtrans %}</h3>
  62. <ul class="unstyled">
  63. {% for thread in popular_threads %}
  64. <li>
  65. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="index-popular-thread">{{ thread.name }}</a>
  66. <div class="muted"><a href="{% url 'forum' forum=thread.forum_id, slug=thread.forum_slug %}">{{ thread.forum_name }}</a> - {{ thread.last|reltimesince }}</div>
  67. </li>
  68. {% endfor %}
  69. </ul>
  70. </div>
  71. {% endif %}
  72. <div class="index-stats">
  73. <ul class="unstyled">
  74. <li>
  75. <span class="tooltip-top" title="{% trans %}Posts{% endtrans %}"><i class="icon-comment"></i> {{ monitor.posts|int|intcomma }}</span>
  76. </li>
  77. <li>
  78. <span class="tooltip-top" title="{% trans %}Threads{% endtrans %}"><i class="icon-th-list"></i> {{ monitor.threads|int|intcomma }}</span>
  79. </li>
  80. <li>
  81. <span class="tooltip-top" title="{% trans %}Members{% endtrans %}"><i class="icon-user"></i> {{ monitor.users|int|intcomma }}</span>
  82. </li>
  83. <li>
  84. <span class="tooltip-top" title="{% trans %}Online{% endtrans %}"><i class="icon-map-marker"></i> {{ users_online|int|intcomma }}</span>
  85. </li>
  86. </ul>
  87. </div>
  88. {% if user.is_authenticated() %}
  89. <form action="{% url 'read_all' %}" method="post" class="index-forums-read-all">
  90. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  91. <button type="submit" class="btn btn-link"><i class="icon-ok"></i> {% trans %}Mark forums read{% endtrans %}</button>
  92. </form>
  93. {% endif %}
  94. </div>
  95. </div>
  96. {% endblock %}
  97. {% macro forum_stats(forum) -%}
  98. {% if forum.last_thread_id and not forum.attr('hidethread') -%}
  99. {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta), thread=forum_thread(forum) -%}
  100. {{ posts }} post - last in {{ thread }}
  101. {%- pluralize -%}
  102. {{ posts }} posts - last in {{ thread }}
  103. {%- endtrans %}
  104. {%- else -%}
  105. {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta) -%}
  106. {{ posts }} post
  107. {%- pluralize -%}
  108. {{ posts }} posts
  109. {%- endtrans %}
  110. {%- endif %}
  111. {%- endmacro %}
  112. {% macro forum_thread(forum) -%}
  113. <a href="{% url 'thread_new' thread=forum.last_thread_id, slug=forum.last_thread_slug %}">{{ forum.last_thread_name }}</a>
  114. {%- endmacro %}
  115. {% macro redirect_stats(forum) -%}
  116. {% trans count=forum.redirects, redirects=fancy_number(forum.redirects, forum.redirects_delta) -%}
  117. {{ redirects }} click
  118. {%- pluralize -%}
  119. {{ redirects }} clicks
  120. {%- endtrans %}
  121. {%- endmacro %}
  122. {% macro fancy_number(number, delta) -%}
  123. <strong{% if delta < number %} class="stat-increment"{% endif %}>{{ number|intcomma }}</strong>
  124. {%- endmacro %}