diff options
-rw-r--r-- | hyperkitty/templates/recent_activities.html | 72 | ||||
-rw-r--r-- | hyperkitty/templates/threads/summary_thread.html | 38 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 14 |
3 files changed, 47 insertions, 77 deletions
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 @@ <section id="most_active"> <h2>Recently active discussions</h2> {% for thread in most_active_threads %} - <!-- Start thread --> - <div class="thread"> - <span class="thread_id">#{{forloop.counter}}</span> - <span class="thread_title"><a name="{{thread.thread_id}}" - href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}" - >{{ thread.subject|strip_subject:mlist }}</a></span> - <div class="thread_stats"> - <ul class="inline-block"> - {% if thread.category_tag %} - <li class="type type_{{thread.category_tag}}"> - <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category_tag %}" - >{{thread.category}}</a> - </li> - {% endif %} - {% if thread.category %} - <li class="type type_{{thread.category|lower}}"> - <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category|lower %}" - >{{thread.category}}</a> - </li> - {% endif %} - {% if use_mockups %} - <li class="likestatus neutral"> - +0/-0 - </li> - {% endif %} - <li class="participant"> - {{ thread.participants|length }} - </li> - <li class="discussion"> - {{ thread.length }} - </li> - </ul> - </div> - </div> - <!-- End thread --> + {% include "threads/summary_thread.html" with counter=forloop.counter %} {% endfor %} </section> <section id="top_discussion"> <h2>Top discussions the last 30 days</h2> {% for thread in top_threads %} - <!-- Start thread --> - <div class="thread"> - <span class="thread_id">#{{forloop.counter}}</span> - <span class="thread_title"> <a name="{{thread.thread_id}}" - href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}" - >{{ thread.subject|strip_subject:mlist }}</a> </span> - <div class="thread_stats"> - <ul class="inline-block"> - {% if thread.category_tag %} - <li class="type type_{{thread.category_tag}}"> - <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category_tag %}" - >{{ thread.category }}</a> - </li> - {% endif %} - {% if thread.category %} - <li class="type type_{{thread.category|lower}}"> - <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category|lower %}" - >{{ thread.category }}</a> - </li> - {% endif %} - {% if use_mockups %} - <li class="likestatus neutral"> - +0/-0 - </li> - {% endif %} - <li class="participant"> - {{ thread.participants|length }} - </li> - <li class="discussion"> - {{ thread.length }} - </li> - </ul> - </div> - </div> - <!-- End thread --> + {% include "threads/summary_thread.html" with counter=forloop.counter %} {% endfor %} </section> 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 %} + + <div class="thread"> + <span class="thread_id">#{{counter}}</span> + <span class="thread_title"><a name="{{thread.thread_id}}" + href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}" + >{{ thread.subject|strip_subject:mlist }}</a></span> + <div class="thread_stats"> + <ul class="inline-block"> + {% if thread.category_tag %} + <li class="type type_{{thread.category_tag}}"> + <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category_tag %}" + >{{thread.category}}</a> + </li> + {% endif %} + {% if thread.category %} + <li class="type type_{{thread.category|lower}}"> + <a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category|lower %}" + >{{thread.category}}</a> + </li> + {% endif %} + {% if use_mockups %} + <li class="likestatus neutral"> + +0/-0 + </li> + {% endif %} + <li class="participant"> + {{ thread.participants|length }} + </li> + <li class="discussion"> + {{ thread.length }} + </li> + </ul> + </div> + </div> + +{# 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 |