123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- {% extends "cranefly/layout.html" %}
- {% load i18n %}
- {% import "cranefly/macros.html" as macros with context %}
- {% block title %}{{ macros.page_title(title=_('Popular Threads')) }}{% endblock %}
- {% block container %}
- <div class="page-header header-primary">
- <div class="container">
- {{ messages_list(messages) }}
- <h1>{% trans %}Popular Threads{% endtrans %}</h1>
- </div>
- </div>
- <div class="container container-primary">
- {% if threads %}
- <div class="popular-threads">
- {% for thread in threads %}
- {% do thread.__dict__.update({'warmth': loop.index}) %}
- {% endfor %}
- {% for row in threads|batch(2, '') %}
- <div class="row">
- {% for thread in row %}{% if thread %}
- <div class="span6">
- <div class="popular-thread">
- <a href="{% url 'thread_new' thread=thread.pk, slug=thread.slug %}" class="label popular-thread-warmth popular-thread-warmth-{{ warmth(thread.warmth) }} tooltip-top" title="{% trans %}Jump to latest reply{% endtrans %}"><i class="icon-fire"></i></a>
- <div class="popular-thread-details">
- <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="popular-thread-title tooltip-top" title="{% trans %}Jump to thread start{% endtrans %}">{{ thread.name }}</a>
- <p class="popular-thread-info">
- {% trans forum=forum(thread.forum), starter=username(thread.start_poster_id, thread.start_poster_name, thread.start_poster_slug), last=thread.last|reldate, replies=replies(thread.replies) %}By {{ starter }} - {{ forum }} - {{ replies }} - last on {{ last }}.{% endtrans %}
- </p>
- </div>
- </div>
- </div>
- {% endif %}{% endfor %}
- </div>
- <hr>
- {% endfor %}
- </div>
- {% else %}
- <p class="lead">{% trans %}Looks like there are no popular threads... yet!{% endtrans %}</p>
- {% endif %}
- </div>
- {% endblock %}
- {% macro warmth(loop_index) -%}
- {% if loop_index < 5 %}0{% elif loop_index < 20 %}1{% elif loop_index < 35 %}2{% else %}3{% endif %}
- {%- endmacro %}
- {% macro replies(thread_replies) -%}
- {% trans count=thread_replies, replies=thread_replies|intcomma -%}
- One reply
- {%- pluralize -%}
- {{ replies }} replies
- {%- endtrans %}
- {%- endmacro %}
- {% macro forum(forum) -%}
- <a href="{% url 'forum' forum=forum.pk, slug=forum.slug %}">{{ forum.name }}</a>
- {%- endmacro %}
- {% macro username(id, username, slug) -%}
- {%- if id -%}
- <a href="{% url 'user' user=id, username=slug %}">{{ username }}</a>
- {%- else -%}
- {{ username }}
- {%- endif -%}
- {%- endmacro %}
|