Browse Source

Thread prefixes on threads list.

Rafał Pitoń 10 years ago
parent
commit
a767949416

+ 8 - 1
misago/static/misago/css/misago/threadslists.less

@@ -14,6 +14,7 @@
         padding-top: @padding-base-vertical + 1px;
         padding-bottom: @padding-base-vertical + 1px;
 
+
         // Thread icon
         //
         //==
@@ -45,12 +46,18 @@
         //==
         .thread-flags {
           float: right;
-          overflow: auto;
           position: relative;
           top: 3px;
 
           li {
             float: left;
+            overflow: visible;
+
+            .label {
+              border-radius: @border-radius-small;
+
+              font-weight: normal;
+            }
 
             .fa, .glyphicon {
               .opacity(0.5);

+ 9 - 2
misago/templates/misago/threads/base.html

@@ -1,5 +1,5 @@
 {% extends "misago/base.html" %}
-{% load humanize i18n misago_avatars %}
+{% load humanize i18n misago_avatars misago_dates %}
 
 {% block content %}
 <div class="container">
@@ -38,6 +38,13 @@
               </a>
 
               <ul class="list-unstyled thread-flags">
+                {% if thread.prefix %}
+                <li>
+                  <span class="label label-solo label-{{ thread.prefix.css_class|default:"default" }}">
+                    {{ thread.prefix.name }}
+                  </span>
+                </li>
+                {% endif %}
                 {% if thread.has_reported_posts %}
                 <li class="tooltip-top" title="{% trans "Reported posts" %}">
                   <span class="fa fa-exclamation-triangle fa-fw fa-lg"></span>
@@ -86,7 +93,7 @@
               {% endif %}
 
               <a href="#" class="dynamic time-ago tooltip-top" data-timestamp="{{ thread.last_post_on|date:"c" }}" title="{% blocktrans with last_post=thread.last_post_on|date %}Last post from {{ last_post }}{% endblocktrans %}">
-                {{ thread.last_post_on|date }}
+                {{ thread.last_post_on|compact_date }}
               </a>
               {% endblock thread-stats %}
             </div>

+ 2 - 2
misago/templates/misago/threads/show.html

@@ -3,7 +3,7 @@
 <div class="btn-group pull-left">
   <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
     {% trans "Show:" %}{% if filter_by.is_label %}
-    <span class="label{% if filter_by.css_class %} label-{{ filter_by.css_class }}{% endif %}">
+    <span class="label label-{{ filter_by.css_class|default:"default" }}">
       {{ filter_by.name }}
     </span>
     {% else %}
@@ -18,7 +18,7 @@
     <li>
       <a href="{{ filtering.url }}">
         {% if filtering.is_label %}
-        <span class="label label-solo{% if filtering.css_class %} label-{{ filtering.css_class }}{% endif %}">
+        <span class="label label-sololabel-{{ filtering.css_class|default:"default" }}">
           {{ filtering.name }}
         </span>
         {% else %}

+ 7 - 3
misago/threads/views/generic/forum.py

@@ -134,8 +134,15 @@ class ForumView(FilterThreadsMixin, OrderThreadsMixin, ThreadsView):
         for thread in threads:
             thread.forum = forum
 
+        self.prefix_threads(threads, forum.prefixes)
+
         return page, threads
 
+    def prefix_threads(self, threads, prefixes):
+        prefixes_dict = dict([(p.pk, p) for p in prefixes])
+        for thread in threads:
+            thread.prefix = prefixes_dict.get(thread.prefix_id)
+
     def order_querysets(self, order_by, threads, announcements):
         if order_by == 'recently-replied':
             threads = threads.order_by('-weight', '-last_post')
@@ -191,9 +198,6 @@ class ForumView(FilterThreadsMixin, OrderThreadsMixin, ThreadsView):
 
         return queryset
 
-    def set_custom_filter(self, request, forum, queryset, filter_by):
-        return queryset
-
     def get_threads_queryset(self, request, forum):
         return forum.thread_set.all().order_by('-last_post_id')