diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-05-22 16:42:19 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-05-23 09:32:13 +0200 |
commit | e21dd91f3482ce6e1ea6c48f8efa2f46777c7a70 (patch) | |
tree | 3d296f2ad327f729298539ea15833251348e0307 | |
parent | 1eeef494e6cb6c23f207be8715ff39c0e52e3c37 (diff) | |
download | hyperkitty-e21dd91f3482ce6e1ea6c48f8efa2f46777c7a70.tar.gz hyperkitty-e21dd91f3482ce6e1ea6c48f8efa2f46777c7a70.tar.xz hyperkitty-e21dd91f3482ce6e1ea6c48f8efa2f46777c7a70.zip |
Display a marker on unread threads in the month view
-rw-r--r-- | hyperkitty/static/css/hyperkitty-common.css | 5 | ||||
-rw-r--r-- | hyperkitty/static/css/hyperkitty-message.css | 7 | ||||
-rw-r--r-- | hyperkitty/static/css/hyperkitty-threadslist.css | 4 | ||||
-rw-r--r-- | hyperkitty/templates/messages/message.html | 6 | ||||
-rw-r--r-- | hyperkitty/templates/threads/summary_thread_large.html | 12 | ||||
-rw-r--r-- | hyperkitty/templatetags/hk_generic.py | 5 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 16 |
7 files changed, 38 insertions, 17 deletions
diff --git a/hyperkitty/static/css/hyperkitty-common.css b/hyperkitty/static/css/hyperkitty-common.css index ee591c5..2fe6669 100644 --- a/hyperkitty/static/css/hyperkitty-common.css +++ b/hyperkitty/static/css/hyperkitty-common.css @@ -16,11 +16,6 @@ list-style-type: none; } -i.new-message { - float: right; - margin-right: 2em; -} - /* from Bootstrap's alert class */ .errorlist { list-style-type: none; diff --git a/hyperkitty/static/css/hyperkitty-message.css b/hyperkitty/static/css/hyperkitty-message.css index 92c8778..3e43e3d 100644 --- a/hyperkitty/static/css/hyperkitty-message.css +++ b/hyperkitty/static/css/hyperkitty-message.css @@ -209,11 +209,16 @@ background-color: rgb(215, 215, 229); display: none; } -.replies .email.new-message { +.replies .email.unread { border-top: 1px solid rgb(100, 100, 100); background-color: rgb(214, 214, 214); } +.email.unread i.unread { + float: right; + margin-right: 2em; +} + .email-body { white-space: pre; overflow: auto; diff --git a/hyperkitty/static/css/hyperkitty-threadslist.css b/hyperkitty/static/css/hyperkitty-threadslist.css index 231ba43..644d2b7 100644 --- a/hyperkitty/static/css/hyperkitty-threadslist.css +++ b/hyperkitty/static/css/hyperkitty-threadslist.css @@ -68,6 +68,10 @@ margin-left: 2em; } +.thread.unread i.unread { + vertical-align: baseline; +} + .thread-content { margin-top: 0.5em; } diff --git a/hyperkitty/templates/messages/message.html b/hyperkitty/templates/messages/message.html index 44ffc9f..6a42066 100644 --- a/hyperkitty/templates/messages/message.html +++ b/hyperkitty/templates/messages/message.html @@ -3,8 +3,8 @@ {% load gravatar %} {% load hk_generic %} -{% is_message_new as is_new %} -<div class="email{% if unfolded %} email-first{% endif %}{% if is_new %} new-message{% endif %}"> +{% is_message_new email.date as is_new %} +<div class="email{% if unfolded %} email-first{% endif %}{% if is_new %} unread{% endif %}"> <div class="email-header" id="{{email.message_id_hash}}"> <div class="email-date inline-block pull-right"> @@ -20,7 +20,7 @@ <span class="time" title="Sender's time: {{email|sender_date|date:"l, j F H:i:s"}}">{{email|viewer_date|date:"H:i:s"}}</span> </div> {% if is_new %} - <i class="new-message icon-eye-close"></i> + <i class="unread icon-eye-close" title="Unread"></i> {% endif %} <div class="gravatar{% if use_mockups %} pull-left{% endif %}"> {% gravatar email.sender_email 40 %} diff --git a/hyperkitty/templates/threads/summary_thread_large.html b/hyperkitty/templates/threads/summary_thread_large.html index 66b1a78..cea2be2 100644 --- a/hyperkitty/templates/threads/summary_thread_large.html +++ b/hyperkitty/templates/threads/summary_thread_large.html @@ -3,11 +3,15 @@ {% load hk_generic %} {% load storm %} - <div class="thread"> + <div class="thread{% if thread.unread %} unread{% endif %}"> <div class="{% if thread.favorite %}saved{% else %}notsaved{% endif %}"> - <span class="thread-title"><a name="{{thread.thread_id}}" - href="{% url 'thread' threadid=thread.thread_id mlist_fqdn=mlist.name %}" - >{{ thread.starting_email.subject|strip_subject:mlist }}</a></span> + <span class="thread-title"> + {% if thread.unread %} + <i class="unread icon-eye-close" title="Unread"></i> + {% endif %} + <a name="{{thread.thread_id}}" + href="{% url 'thread' threadid=thread.thread_id mlist_fqdn=mlist.name %}" + >{{ thread.starting_email.subject|strip_subject:mlist }}</a></span> <span class="thread-date">{{thread.date_active|timesince }}</span> </div> <div class="thread-content"> diff --git a/hyperkitty/templatetags/hk_generic.py b/hyperkitty/templatetags/hk_generic.py index c98c3e2..8442f63 100644 --- a/hyperkitty/templatetags/hk_generic.py +++ b/hyperkitty/templatetags/hk_generic.py @@ -185,11 +185,10 @@ def multiply(num1, num2): return num1 * num2 -def is_message_new(context): +def is_message_new(context, refdate): user = context["user"] last_view = context.get("last_view") - email = context["email"] return (user.is_authenticated() and - (last_view is None or email.date > last_view) + (last_view is None or refdate > last_view) ) register.assignment_tag(takes_context=True)(is_message_new) diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index 000b7b3..ef01b65 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -31,7 +31,7 @@ from django.utils import formats from django.utils.dateformat import format as date_format from django.http import Http404 -from hyperkitty.models import Tag, Favorite +from hyperkitty.models import Tag, Favorite, LastView from hyperkitty.lib import get_months, get_store, get_display_dates, daterange from hyperkitty.lib import FLASH_MESSAGES from hyperkitty.lib.voting import get_votes @@ -128,6 +128,20 @@ def _thread_list(request, mlist, threads, template_name='thread_list.html', extr except Tag.DoesNotExist: thread.tags = [] + # Unread status + thread.unread = False + if request.user.is_authenticated(): + try: + last_view_obj = LastView.objects.get( + list_address=mlist.name, + threadid=thread.thread_id, + user=request.user) + except LastView.DoesNotExist: + thread.unread = True + else: + if thread.date_active > last_view_obj.view_date: + thread.unread = True + all_threads = threads paginator = Paginator(threads, 10) page_num = request.GET.get('page') |