category.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=category.name) }}{% endblock %}
  4. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  5. {% for parent in parents %}
  6. <li><a href="{{ parent.type|url(forum=parent.pk, slug=parent.slug) }}">{{ parent.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. {% endfor %}
  8. <li class="active">{{ category.name }}
  9. {%- endblock %}
  10. {% block container %}
  11. <div class="page-header header-primary">
  12. <div class="container">
  13. {{ messages_list(messages) }}
  14. <ul class="breadcrumb" {{ macros.itemprop_bread() }}>
  15. {{ self.breadcrumb() }}</li>
  16. </ul>
  17. <h1>{{ category.name }}</h1>
  18. </div>
  19. </div>
  20. <div class="container container-primary">
  21. {% if category.description %}
  22. <div class="markdown lead page-description">
  23. {{ category.description_preparsed|markdown_final|safe }}
  24. </div>
  25. {% endif %}
  26. {% if category.subforums %}
  27. <div class="category-forums-list{% if category.style %} category-forums-{{ category.style }}{% endif %}">
  28. <table class="table">
  29. <tbody>
  30. {% for forum in category.subforums %}
  31. <tr>
  32. <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>
  33. <td class="forum-main">
  34. <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>
  35. {% if forum.show_details %}
  36. <div class="forum-details">
  37. {% if forum.type == 'redirect' %}
  38. {{ redirect_stats(forum) }}
  39. {% else %}
  40. {{ forum_stats(forum) }}
  41. {% endif %}
  42. </div>
  43. {% endif %}
  44. {% if forum.description %}<p class="forum-description">{{ forum.description }}</p>{% endif %}
  45. </td>
  46. </tr>
  47. {% endfor %}
  48. </tbody>
  49. </table>
  50. </div>
  51. {% else %}
  52. <p class="lead">{% trans %}Looks like there are no forums to display in this category.{% endtrans %}</p>
  53. {% endif %}
  54. </div>
  55. {% endblock %}
  56. {% macro forum_stats(forum) -%}
  57. {% if forum.last_thread_id and not forum.attr('hidethread') -%}
  58. {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta), thread=forum_thread(forum) -%}
  59. {{ posts }} post - last in {{ thread }}
  60. {%- pluralize -%}
  61. {{ posts }} posts - last in {{ thread }}
  62. {%- endtrans %}
  63. {%- else -%}
  64. {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta) -%}
  65. {{ posts }} post
  66. {%- pluralize -%}
  67. {{ posts }} posts
  68. {%- endtrans %}
  69. {%- endif %}
  70. {%- endmacro %}
  71. {% macro forum_thread(forum) -%}
  72. <a href="{% url 'thread_new' thread=forum.last_thread_id, slug=forum.last_thread_slug %}">{{ forum.last_thread_name }}</a>
  73. {%- endmacro %}
  74. {% macro redirect_stats(forum) -%}
  75. {% trans count=forum.redirects, redirects=fancy_number(forum.redirects, forum.redirects_delta) -%}
  76. {{ redirects }} click
  77. {%- pluralize -%}
  78. {{ redirects }} clicks
  79. {%- endtrans %}
  80. {%- endmacro %}
  81. {% macro fancy_number(number, delta) -%}
  82. <strong{% if delta < number %} class="stat-increment"{% endif %}>{{ number|intcomma }}</strong>
  83. {%- endmacro %}