123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- {% extends "cranefly/layout.html" %}
- {% import "cranefly/macros.html" as macros with context %}
- {% block title %}{{ macros.page_title(title=_("Forum Map")) }}{% endblock %}
- {% block container %}
- <div class="page-header header-primary">
- <div class="container">
- {{ messages_list(messages) }}
- <h1>{% trans %}Forum Map{% endtrans %}</h1>
- </div>
- </div>
- <div class="container container-primary">
- {% if forums %}
- <div class="row">
- <div class="span6">
- {% for category in forums %}{% if loop.index0 is odd and category.subforums %}
- {{ draw_category(category) }}
- {% endif %}{% endfor %}
- </div>
- <div class="span6">
- {% for category in forums %}{% if loop.index0 is even and category.subforums %}
- {{ draw_category(category) }}
- {% endif %}{% endfor %}
- </div>
- </div>
- {% else %}
- <p class="lead">{% trans %}Looks like no forums exist that you have permission to see.{% endtrans %}</p>
- {% endif %}
- </div>
- {% endblock %}
- {% macro draw_category(category) %}
- <div class="forum-map-category{% if category.style %} forum-map-category-{{ category.style }}{% endif %}">
- <table class="table">
- <caption>{{ category.name }}</caption>
- <tbody>
- {% for forum in category.subforums%}
- {{ draw_forum(forum) }}
- {% endfor %}
- </tbody>
- </table>
- </div>
- {% endmacro %}
- {% macro draw_forum(forum, depth=0, branch='', last=false) %}
- <tr>
- <td class="{% if depth -%}
- forum-map-subforum
- {%- else -%}
- forum-map-forum
- {%- endif %}">
- <h3>{% if depth %}{% if last -%}
- {{ draw_tree(branch ~ 'l') }}
- {%- else -%}
- {{ draw_tree(branch ~ 't') }}
- {%- endif %}{% endif %} <a href="{{ forum.type|url(slug=forum.slug, forum=forum.id) }}">{{ forum.name }}</a></h3>
- <div class="forum-details">
- {% if forum.type == 'redirect' %}
- {{ redirect_stats(forum) }}
- {% else %}
- {{ forum_stats(forum) }}
- {% endif %}
- </div>
- </td>
- </tr>
- {% for subforum in forum.subforums %}
- {% if depth %}
- {% if last %}
- {{ draw_forum(subforum, (depth + 1), (branch ~ 's'), loop.last) }}
- {% else %}
- {{ draw_forum(subforum, (depth + 1), (branch ~ 'i'), loop.last) }}
- {% endif %}
- {% else %}
- {{ draw_forum(subforum, (depth + 1), '', loop.last) }}
- {% endif %}
- {% endfor %}
- {% endmacro %}
- {% macro draw_tree(branch) %}
- {% for item in branch %}
- <span class="tree-{{ item }}"><span></span></span>
- {% endfor %}
- {% endmacro %}
- {% macro forum_stats(forum) -%}
- {% if forum.last_thread_id and not forum.attr('hidethread') -%}
- {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta), thread=forum_thread(forum) -%}
- {{ posts }} post - last in {{ thread }}
- {%- pluralize -%}
- {{ posts }} posts - last in {{ thread }}
- {%- endtrans %}
- {%- else -%}
- {% trans count=forum.posts, posts=fancy_number(forum.posts, forum.posts_delta) -%}
- {{ posts }} post
- {%- pluralize -%}
- {{ posts }} posts
- {%- endtrans %}
- {%- endif %}
- {%- endmacro %}
- {% macro forum_thread(forum) -%}
- <a href="{% url 'thread' thread=forum.last_thread_id, slug=forum.last_thread_slug %}">{{ forum.last_thread_name }}</a>
- {%- endmacro %}
- {% macro redirect_stats(forum) -%}
- {% trans count=forum.redirects, redirects=fancy_number(forum.redirects, forum.redirects_delta) -%}
- {{ redirects }} click
- {%- pluralize -%}
- {{ redirects }} clicks
- {%- endtrans %}
- {%- endmacro %}
- {% macro fancy_number(number, delta) -%}
- <strong{% if delta < number %} class="stat-increment"{% endif %}>{{ number|intcomma }}</strong>
- {%- endmacro %}
|