active_threads.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {% extends "cranefly/layout.html" %}
  2. {% load i18n %}
  3. {% import "cranefly/macros.html" as macros with context %}
  4. {% block title %}{{ macros.page_title(title=_('Active Threads')) }}{% endblock %}
  5. {% block content %}
  6. <div class="page-header">
  7. <h1>{% trans %}Active Threads{% endtrans %}</h1>
  8. </div>
  9. {% if threads %}
  10. <p class="lead">{% trans %}Following threads are currently experiencing most activity:{% endtrans %}</p>
  11. <ul class="unstyled shorts-list">
  12. {% for row in threads|batch(2, '') %}
  13. <li>
  14. <div class="row">
  15. {% for thread in row %}{% if thread %}
  16. <div class="span6">
  17. <img src="{% if thread.start_poster_id %}{{ thread.start_poster.get_avatar(36) }}{% else %}{{ macros.avatar_guest(24) }}{% endif %}" class="avatar tooltip-top" title="{% trans username=thread.start_poster_name %}Thread started by {{ username }}{% endtrans %}">
  18. <p class="title">
  19. <a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}" class="hover-opacity tooltip-top" title="{% trans %}Jump to thread start{% endtrans %}"><i class="icon-asterisk"></i></a>
  20. <a href="{% url 'thread_last' thread=thread.pk, slug=thread.slug %}" class="jump jump-last tooltip-top" title="{% trans %}Jump to latest reply{% endtrans %}"><strong>{{ thread.name }}</strong></a>
  21. </p>
  22. <p class="location">{% trans forum=forum(thread.forum), starter=username(thread.start_poster_id, thread.start_poster_name, thread.start_poster_slug), start=thread.start|reldate %}Thread started by {{ starter }} in {{ forum }} on {{ start }}.{% endtrans %}</p>
  23. </div>
  24. {% endif %}{% endfor %}
  25. </div>
  26. </li>
  27. {% endfor %}
  28. </ul>
  29. {% else %}
  30. <p class="lead">{% trans %}Looks like there are no active threads.{% endtrans %}</p>
  31. {% endif %}
  32. {%- endblock %}
  33. {% macro forum(forum) -%}
  34. <a href="{% url 'forum' forum=forum.pk, slug=forum.slug %}">{{ forum.name }}</a>
  35. {%- endmacro %}
  36. {% macro username(id, username, slug) -%}
  37. {%- if id -%}
  38. <a href="{% url 'user' user=id, username=slug %}">{{ username }}</a>
  39. {%- else -%}
  40. {{ username }}
  41. {%- endif -%}
  42. {%- endmacro %}