Browse Source

Tweaked unread replies count on threads list

Rafał Pitoń 10 years ago
parent
commit
31117bd901

+ 3 - 1
misago/readtracker/threadstracker.py

@@ -20,6 +20,7 @@ def make_threads_read_aware(user, threads):
     threads_dict = {}
     threads_dict = {}
     for thread in threads:
     for thread in threads:
         thread.is_read = not is_date_tracked(user, thread.last_post_on)
         thread.is_read = not is_date_tracked(user, thread.last_post_on)
+        thread.is_new = True
         if thread.is_read:
         if thread.is_read:
             thread.unread_replies = 0
             thread.unread_replies = 0
         else:
         else:
@@ -29,6 +30,7 @@ def make_threads_read_aware(user, threads):
     for record in user.threadread_set.filter(thread__in=threads_dict.keys()):
     for record in user.threadread_set.filter(thread__in=threads_dict.keys()):
         if record.thread_id in threads_dict:
         if record.thread_id in threads_dict:
             thread = threads_dict[record.thread_id]
             thread = threads_dict[record.thread_id]
+            thread.is_new = False
             thread.is_read = record.last_read_on >= thread.last_post_on
             thread.is_read = record.last_read_on >= thread.last_post_on
             if thread.is_read:
             if thread.is_read:
                 thread.unread_replies = 0
                 thread.unread_replies = 0
@@ -105,4 +107,4 @@ def count_read_replies(user, thread, last_read_reply):
         last_reply_date = last_read_reply.last_read_on
         last_reply_date = last_read_reply.last_read_on
         queryset = thread.post_set.filter(last_read_on__lte=last_reply_date)
         queryset = thread.post_set.filter(last_read_on__lte=last_reply_date)
         queryset = queryset.filter(is_moderated=False)
         queryset = queryset.filter(is_moderated=False)
-        return queryset.count()
+        return queryset.count() - 1 # - starters post

+ 7 - 9
misago/static/misago/css/misago/threadslists.less

@@ -94,25 +94,23 @@
             display: inline-block;
             display: inline-block;
             margin: 0px;
             margin: 0px;
             margin-right: @font-size-large;
             margin-right: @font-size-large;
+            margin-top: -2px;
+            .opacity(0.7);
             transition-duration: 0.5s;
             transition-duration: 0.5s;
             width: @font-size-large * 4.5;
             width: @font-size-large * 4.5;
 
 
             font-size: @font-size-large;
             font-size: @font-size-large;
 
 
-            &>div {
+            .label {
               display: inline;
               display: inline;
+              padding-left: 4px;
 
 
-              span {
-                font-size: @font-size-base;
-              }
+              font-size: @font-size-base;
+              font-weight: normal !important;
             }
             }
 
 
             &.new-replies {
             &.new-replies {
-              color: @brand-primary;
-            }
-
-            &.new-thread {
-              color: @brand-success;
+              .opacity(1);
             }
             }
           }
           }
 
 

+ 10 - 10
misago/templates/misago/threads/base.html

@@ -66,19 +66,19 @@
                   {{ thread.replies|intcomma }}
                   {{ thread.replies|intcomma }}
                 </div>
                 </div>
               </div>
               </div>
-              {% elif thread.replies and thread.replies > thread.unread_replies %}
+              {% elif thread.is_new %}
               <div class="thread-replies new-replies">
               <div class="thread-replies new-replies">
-                <div class="tooltip-top" title="{% blocktrans trimmed with replies=thread.unread_replies|intcomma count counter=thread.unread_replies %}{{ replies }} new reply{% plural %}{{ replies }} new replies{% endblocktrans %}">
-                  <span class="glyphicon glyphicon-plus"></span>
-                  {{ thread.unread_replies|intcomma }}
-                </div>
+                <span class="label label-success tooltip-top" title="{% blocktrans trimmed with replies=thread.replies|intcomma count counter=thread.replies %}New thread with {{ replies }} reply{% plural %}New thread with {{ replies }} replies{% endblocktrans %}">
+                  <span class="fa fa-plus-circle fa-fw"></span>
+                  {{ thread.replies|intcomma }}
+                </span>
               </div>
               </div>
               {% else %}
               {% else %}
-              <div class="thread-replies new-thread">
-                <div class="tooltip-top" title="{% blocktrans trimmed with replies=thread.replies|intcomma count counter=thread.replies %}New thread with {{ replies }} reply{% plural %}New thread with {{ replies }} replies{% endblocktrans %}">
-                  <span class="glyphicon glyphicon-leaf"></span>
-                  {{ thread.replies|intcomma }}
-                </div>
+              <div class="thread-replies new-replies">
+                <span class="label label-primary tooltip-top" title="{% blocktrans trimmed with replies=thread.unread_replies|intcomma count counter=thread.unread_replies %}{{ replies }} new reply{% plural %}{{ replies }} new replies{% endblocktrans %}">
+                  <span class="fa fa-signal fa-fw"></span>
+                  {{ thread.unread_replies|intcomma }}
+                </span>
               </div>
               </div>
               {% endif %}
               {% endif %}