From 5c0e4e11dad001952f7fe745b22e1cf63fbc50fd Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Fri, 15 Nov 2013 14:32:18 +0100 Subject: Call out new lists --- hyperkitty/static/hyperkitty/css/hyperkitty-index.css | 6 ++++++ hyperkitty/templates/index.html | 12 ++++++++++++ hyperkitty/views/index.py | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/hyperkitty/static/hyperkitty/css/hyperkitty-index.css b/hyperkitty/static/hyperkitty/css/hyperkitty-index.css index 71d51c1..344d550 100644 --- a/hyperkitty/static/hyperkitty/css/hyperkitty-index.css +++ b/hyperkitty/static/hyperkitty/css/hyperkitty-index.css @@ -102,3 +102,9 @@ .all-lists table.lists tr.inactive .list-name { color: #999; } + +.all-lists table.lists tr span.new { + font-size: 78%; + text-transform: uppercase; + margin-right: 0.5em; +} diff --git a/hyperkitty/templates/index.html b/hyperkitty/templates/index.html index 357bde6..7e39a58 100644 --- a/hyperkitty/templates/index.html +++ b/hyperkitty/templates/index.html @@ -36,6 +36,13 @@ {% trans 'Most popular' %} {% endif %} +
  • + {% if sort_mode == "creation" %} + {% trans 'Newest' %} + {% else %} + {% trans 'Newest' %} + {% endif %} +
  • @@ -47,6 +54,8 @@ ({% trans 'most active first' %}) {% elif sort_mode == 'popular' %} ({% trans 'most popular first' %}) + {% elif sort_mode == 'creation' %} + ({% trans 'newest first' %}) {% endif %} @@ -69,6 +78,9 @@ {% endif %} "> + {% if mlist.is_new %} + {% trans 'new' %} + {% endif %} {% if mlist.display_name %} diff --git a/hyperkitty/views/index.py b/hyperkitty/views/index.py index 7f61a1e..1be3995 100644 --- a/hyperkitty/views/index.py +++ b/hyperkitty/views/index.py @@ -41,6 +41,7 @@ from hyperkitty.lib.mailman import is_mlist_authorized def index(request): store = get_store(request) lists = store.get_lists() + now = datetime.datetime.now() for mlist in lists: if mlist.archive_policy != ArchivePolicy.private: mlist.is_private = False @@ -53,6 +54,11 @@ def index(request): mlist.can_view = False if mlist.can_view: mlist.evolution = get_recent_list_activity(store, mlist) + if mlist.created_at and \ + now - mlist.created_at <= datetime.timedelta(days=30): + mlist.is_new = True + else: + mlist.is_new = False # sorting sort_mode = request.GET.get('sort') @@ -60,6 +66,8 @@ def index(request): lists.sort(key=lambda l: l.recent_threads_count, reverse=True) elif sort_mode == "popular": lists.sort(key=lambda l: l.recent_participants_count, reverse=True) + elif sort_mode == "creation": + lists.sort(key=lambda l: l.created_at, reverse=True) else: sort_mode = None -- cgit