summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-11-15 14:32:18 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-11-20 19:15:40 +0100
commit5c0e4e11dad001952f7fe745b22e1cf63fbc50fd (patch)
tree96b736ad577736dca132063560819e25bb4d1c9e
parent0fb1bdee16eed1a29eef873dce0db0dc92007c3a (diff)
downloadhyperkitty-5c0e4e11dad001952f7fe745b22e1cf63fbc50fd.tar.gz
hyperkitty-5c0e4e11dad001952f7fe745b22e1cf63fbc50fd.tar.xz
hyperkitty-5c0e4e11dad001952f7fe745b22e1cf63fbc50fd.zip
Call out new lists
-rw-r--r--hyperkitty/static/hyperkitty/css/hyperkitty-index.css6
-rw-r--r--hyperkitty/templates/index.html12
-rw-r--r--hyperkitty/views/index.py8
3 files changed, 26 insertions, 0 deletions
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 @@
<a href="{% url 'root' %}?sort=popular">{% trans 'Most popular' %}</a>
{% endif %}
</li>
+ <li>
+ {% if sort_mode == "creation" %}
+ <span class="active">{% trans 'Newest' %}</span>
+ {% else %}
+ <a href="{% url 'root' %}?sort=creation">{% trans 'Newest' %}</a>
+ {% endif %}
+ </li>
</ul>
</div>
@@ -47,6 +54,8 @@
<small>({% trans 'most active first' %})</small>
{% elif sort_mode == 'popular' %}
<small>({% trans 'most popular first' %})</small>
+ {% elif sort_mode == 'creation' %}
+ <small>({% trans 'newest first' %})</small>
{% endif %}
</h1>
@@ -69,6 +78,9 @@
{% endif %}
">
<td>
+ {% if mlist.is_new %}
+ <span class="new label">{% trans 'new' %}</span>
+ {% endif %}
<a href="{% url 'list_overview' mlist_fqdn=mlist.name %}"
class="list-name">
{% 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