From 186fe84212d4eb3f9420b90424d830fcf1b78a6f Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Mon, 10 Dec 2012 12:25:38 +0100 Subject: Factor the thread summaries form out in a separate file --- hyperkitty/templates/recent_activities.html | 72 +----------------------- hyperkitty/templates/threads/summary_thread.html | 38 +++++++++++++ hyperkitty/views/list.py | 14 ++--- 3 files changed, 47 insertions(+), 77 deletions(-) create mode 100644 hyperkitty/templates/threads/summary_thread.html diff --git a/hyperkitty/templates/recent_activities.html b/hyperkitty/templates/recent_activities.html index 089ca1f..c982182 100644 --- a/hyperkitty/templates/recent_activities.html +++ b/hyperkitty/templates/recent_activities.html @@ -77,82 +77,14 @@

Recently active discussions

{% for thread in most_active_threads %} - -
- #{{forloop.counter}} - {{ thread.subject|strip_subject:mlist }} -
-
    - {% if thread.category_tag %} -
  • - {{thread.category}} -
  • - {% endif %} - {% if thread.category %} -
  • - {{thread.category}} -
  • - {% endif %} - {% if use_mockups %} -
  • - +0/-0 -
  • - {% endif %} -
  • - {{ thread.participants|length }} -
  • -
  • - {{ thread.length }} -
  • -
-
-
- + {% include "threads/summary_thread.html" with counter=forloop.counter %} {% endfor %}

Top discussions the last 30 days

{% for thread in top_threads %} - -
- #{{forloop.counter}} - {{ thread.subject|strip_subject:mlist }} -
-
    - {% if thread.category_tag %} -
  • - {{ thread.category }} -
  • - {% endif %} - {% if thread.category %} -
  • - {{ thread.category }} -
  • - {% endif %} - {% if use_mockups %} -
  • - +0/-0 -
  • - {% endif %} -
  • - {{ thread.participants|length }} -
  • -
  • - {{ thread.length }} -
  • -
-
-
- + {% include "threads/summary_thread.html" with counter=forloop.counter %} {% endfor %}
diff --git a/hyperkitty/templates/threads/summary_thread.html b/hyperkitty/templates/threads/summary_thread.html new file mode 100644 index 0000000..16b6804 --- /dev/null +++ b/hyperkitty/templates/threads/summary_thread.html @@ -0,0 +1,38 @@ +{% load hk_generic %} +{% load storm %} + +
+ #{{counter}} + {{ thread.subject|strip_subject:mlist }} +
+
    + {% if thread.category_tag %} +
  • + {{thread.category}} +
  • + {% endif %} + {% if thread.category %} +
  • + {{thread.category}} +
  • + {% endif %} + {% if use_mockups %} +
  • + +0/-0 +
  • + {% endif %} +
  • + {{ thread.participants|length }} +
  • +
  • + {{ thread.length }} +
  • +
+
+
+ +{# vim: set noet: #} diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index 97044ed..8c3940c 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -129,21 +129,21 @@ def archives(request, mlist_fqdn, year=None, month=None, day=None): totaldislikes = totaldislikes + dislikes try: - thread.avglike = totallikes / totalvotes + thread.likes = totallikes / totalvotes except: - thread.avglike = 0 + thread.likes = 0 try: - thread.avgdislike = totaldislikes / totalvotes + thread.dislikes = totaldislikes / totalvotes except: - thread.avgdislike = 0 + thread.dislikes = 0 thread.likestatus = "neutral" - if thread.avglike - thread.avgdislike >= 10: + if thread.likes - thread.dislikes >= 10: thread.likestatus = "likealot" - elif thread.avglike - thread.avgdislike > 0: + elif thread.likes - thread.dislikes > 0: thread.likestatus = "like" - #elif thread.avglike - thread.avgdislike < 0: + #elif thread.likes - thread.dislikes < 0: # thread.likestatus = "dislike" #threads[cnt] = thread -- cgit