new_threads.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=_('New Threads')) }}{% endblock %}
  4. {% block container %}
  5. <div class="page-header header-primary">
  6. <div class="container">
  7. {{ messages_list(messages) }}
  8. <h1>{% trans %}New Threads{% endtrans %}</h1>
  9. </div>
  10. </div>
  11. <div class="container container-primary">
  12. {% if threads %}
  13. <div class="forum-threads-list">
  14. <div class="header">
  15. <div class="row-fluid">
  16. <div class="span7">{% trans %}Thread{% endtrans %}</div>
  17. <div class="span5 thread-activity">
  18. <div class="thread-replies">{% trans %}Activity{% endtrans %}</div>
  19. </div>
  20. </div>
  21. </div>
  22. {% for thread in threads %}
  23. <div class="thread-row{% if not thread.is_read %} thread-new{% endif %}{% if loop.last %} thread-last{% endif %}">
  24. <div class="row-fluid">
  25. <div class="span7">
  26. {% if thread.is_read %}
  27. <a href="{{ url('thread_new', thread=thread.pk, slug=thread.slug) }}" class="thread-icon thread-icon-last tooltip-top" title="{% trans %}Click to see last post{% endtrans %}"><i class="icon-circle-blank"></i></a>
  28. {% else %}
  29. <a href="{{ url('thread_new', thread=thread.pk, slug=thread.slug) }}" class="thread-icon thread-icon-new tooltip-top" title="{% trans %}Click to see first unread post{% endtrans %}"><i class="icon-circle"></i></a>
  30. {% endif %}
  31. <a href="{{ url('thread', thread=thread.pk, slug=thread.slug) }}" class="thread-name">{{ thread.name }}</a>
  32. {{ macros.thread_flags(thread) }}
  33. <div class="thread-details">
  34. {% trans user=thread_starter(thread), forum=thread_forum(thread), start=thread.start|reltimesince|low %}by {{ user }} in {{ forum }} {{ start }}{% endtrans %}
  35. </div>
  36. </div>
  37. <div class="span5 thread-activity">
  38. {% if settings.avatars_on_threads_list %}
  39. <div class="thread-last-avatar">
  40. {% if thread.last_poster_id %}
  41. <a href="{{ url('user', user=thread.last_poster.pk, username=thread.last_poster.username_slug) }}"><img src="{{ thread.last_poster.get_avatar(40) }}" alt=""></a>
  42. {% else %}
  43. <img src="{{ macros.avatar_guest(40) }}" alt="" class="user-avatar">
  44. {% endif %}
  45. </div>
  46. {% endif %}
  47. <div class="thread-replies">
  48. <strong class="lead">{{ thread_reply(thread) }}, {{ thread.last|reldate|low }}</strong><br>
  49. {{ replies(thread.replies) }}, <span{% if (thread.upvotes-thread.downvotes) > 0 %} class="text-success"{% elif (thread.upvotes-thread.downvotes) < 0 %} class="text-error"{% endif %}><strong>{% if (thread.upvotes-thread.downvotes) > 0 %}+{% elif (thread.upvotes-thread.downvotes) < 0 %}-{% endif %}</strong>{% trans rating=(thread.upvotes-thread.downvotes)|abs|intcomma %}{{ rating }} thread rating{% endtrans %}</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. {% endfor %}
  55. </div>
  56. {{ pager() }}
  57. {% else %}
  58. <p class="lead">{% trans %}No new threads were started in last 48 hours.{% endtrans %}</p>
  59. {% endif %}
  60. </div>
  61. {% endblock %}
  62. {% macro replies(thread_replies) -%}
  63. {% trans count=thread_replies, replies=thread_replies|intcomma -%}
  64. {{ replies }} reply
  65. {%- pluralize -%}
  66. {{ replies }} replies
  67. {%- endtrans %}
  68. {%- endmacro %}
  69. {% macro thread_starter(thread) -%}
  70. {% if thread.start_poster_id %}<a href="{{ url('user', user=thread.start_poster_id, username=thread.start_poster_slug) }}" class="user-link">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}
  71. {%- endmacro %}
  72. {% macro thread_forum(thread) -%}
  73. <a href="{{ url('forum', forum=thread.forum_id, slug=thread.forum.slug) }}" class="forum-link">{{ thread.forum.name }}</a>
  74. {%- endmacro %}
  75. {% macro thread_reply(thread) -%}
  76. {% if thread.last_poster_id %}<a href="{{ url('user', user=thread.last_poster_id, username=thread.last_poster_slug) }}" class="user-link">{{ thread.last_poster_name }}</a>{% else %}{{ thread.last_poster_name }}{% endif %}
  77. {%- endmacro %}
  78. {% macro pager() -%}
  79. {% if items_total > 0 and pagination['total'] > 1 %}
  80. <div class="pagination">
  81. <ul>
  82. <li class="count">{{ macros.pager_label(pagination) }}</li>
  83. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{{ url('new_threads', page=pagination['prev']) }}{% else %}{{ url('new_threads') }}{% endif %}" class="tooltip-top" title="{% trans %}Previous Page{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  84. {%- if pagination['next'] > 0 %}<li><a href="{{ url('new_threads', page=pagination['next']) }}" class="tooltip-top" title="{% trans %}Next Page{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  85. </ul>
  86. </div>
  87. {% endif %}
  88. {%- endmacro %}