Просмотр исходного кода

#410: show new/unread threads only in dropdown

Rafał Pitoń 10 лет назад
Родитель
Сommit
3094763f34

+ 2 - 0
misago/static/misago/js/misago-uiserver.js

@@ -34,6 +34,8 @@
           }
         });
 
+        $.misago_dom().changed();
+
         if (poll > 0) {
           window.setTimeout(function() {
             query_server(frequency);

+ 2 - 4
misago/static/misago/js/misago-user-nav.js

@@ -1,9 +1,8 @@
 $(function() {
   var $nav = $('#main-navbar');
 
-
   if (is_authenticated) {
-    // keep badges updated
+    // badges updates
     $.misago_ui().observer(function(data) {
       $nav.find('.badge').each(function() {
         var binding_name = $(this).data('badge-binding');
@@ -19,7 +18,7 @@ $(function() {
       });
     });
 
-    // keep tooltips updated
+    // tooltips updates
     $.misago_ui().observer(function(data) {
       $nav.find('.tooltip-bottom').each(function() {
         var binding_name = $(this).data('tooltip-binding');
@@ -27,7 +26,6 @@ $(function() {
           $(this).attr("title", data[binding_name].message);
         }
       });
-      $.misago_dom().changed();
     });
   }
 });

+ 0 - 22
misago/templates/misago/user_nav.html

@@ -57,28 +57,6 @@
 
 <ul class="nav navbar-nav navbar-nav-primary navbar-right">
   <li>
-    <a href="{% url 'misago:new_threads' %}" class="tooltip-bottom" data-tooltip-binding="misago_new_threads"
-        {% if user.new_threads %}
-        title="{% blocktrans count threads=user.new_threads %}{{ threads }} new thread{% plural %}{{ threads }} new threads{% endblocktrans %}"
-        {% else %}
-        title="{% trans "New threads" %}"
-        {% endif %}>
-      <span class="fa fa-plus-circle fa-fw"></span>
-      <span class="badge fade {{ "in"|iftrue:user.new_threads }}" data-badge-binding="misago_new_threads">{{ user.new_threads }}</span>
-    </a>
-  </li>
-  <li>
-    <a href="{% url 'misago:unread_threads' %}" class="tooltip-bottom" data-tooltip-binding="misago_unread_threads"
-        {% if user.unread_threads %}
-        title="{% blocktrans count threads=user.unread_threads %}{{ threads }} unread thread{% plural %}{{ threads }} unread threads{% endblocktrans %}"
-        {% else %}
-        title="{% trans "Unread threads" %}"
-        {% endif %}>
-      <span class="fa fa-signal fa-fw"></span>
-      <span class="badge fade {{ "in"|iftrue:user.unread_threads }}" data-badge-binding="misago_unread_threads">{{ user.unread_threads }}</span>
-    </a>
-  </li>
-  <li>
     <a href="#" class="tooltip-bottom" title="{% trans "Unresolved reports" %}">
       <span class="fa fa-exclamation-triangle fa-fw"></span>
       <span class="badge">57</span>

+ 2 - 11
misago/threads/views/newthreads.py

@@ -5,7 +5,7 @@ from django.core.exceptions import PermissionDenied
 from misago.core.uiviews import uiview
 from misago.users.decorators import deny_guests
 from django.utils import timezone
-from django.utils.translation import ungettext, ugettext as _
+from django.utils.translation import ugettext as _
 
 from misago.threads.models import Thread
 from misago.threads.permissions import exclude_invisible_threads
@@ -54,15 +54,6 @@ class NewThreadsView(ThreadsView):
 @uiview("misago_new_threads")
 @deny_guests
 def event_sender(request, resolver_match):
-    if request.user.new_threads:
-        message = ungettext("%(threads)s new thread",
-                            "%(threads)s new threads",
-                            request.user.new_threads)
-        message = message % {'threads': request.user.new_threads}
-    else:
-        message = _("New threads")
-
     return {
-        'count': int(request.user.new_threads),
-        'message': message,
+        'count': int(request.user.new_threads)
     }

+ 2 - 11
misago/threads/views/unreadthreads.py

@@ -6,7 +6,7 @@ from misago.core.uiviews import uiview
 from misago.users.decorators import deny_guests
 from django.db.models import F
 from django.utils import timezone
-from django.utils.translation import ungettext, ugettext as _
+from django.utils.translation import ugettext as _
 
 from misago.threads.models import Thread
 from misago.threads.permissions import exclude_invisible_threads
@@ -56,15 +56,6 @@ class UnreadThreadsView(ThreadsView):
 @uiview("misago_unread_threads")
 @deny_guests
 def event_sender(request, resolver_match):
-    if request.user.unread_threads:
-        message = ungettext("%(threads)s unread thread",
-                            "%(threads)s unread threads",
-                            request.user.unread_threads)
-        message = message % {'threads': request.user.unread_threads}
-    else:
-        message = _("Unread threads")
-
     return {
-        'count': int(request.user.unread_threads),
-        'message': message,
+        'count': int(request.user.unread_threads)
     }