From 91e6f9e2d6df42cfce6a58af660cc76d1835f39d Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Tue, 28 Jul 2015 16:09:01 -0300 Subject: [PATCH] Added message view theme --- colab_spb/views.py | 3 ++- templates/discussion-message-preview.html | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ templates/discussion.html | 29 ++++++++--------------------- 3 files changed, 81 insertions(+), 22 deletions(-) create mode 100644 templates/discussion-message-preview.html diff --git a/colab_spb/views.py b/colab_spb/views.py index fe4021b..e63d732 100644 --- a/colab_spb/views.py +++ b/colab_spb/views.py @@ -2,12 +2,13 @@ from django.shortcuts import render from django.utils.translation import ugettext as _ from colab.super_archives.models import MailingList, Thread from colab.accounts.utils import mailman +from colab.accounts.models import User def get_list(request): list_name = None MAX = 0 if request.GET.get('list_name'): - list_name = request.GET['list_name'] + list_name = request.GET['list_name'].title() if request.GET.get('MAX'): MAX = request.GET['MAX'] diff --git a/templates/discussion-message-preview.html b/templates/discussion-message-preview.html new file mode 100644 index 0000000..ecab598 --- /dev/null +++ b/templates/discussion-message-preview.html @@ -0,0 +1,71 @@ +{% load i18n tz highlight %} + +{% if result.fullname or result.modified or result.modified_by %} +
+ {% if result.modified %} + {{ result.modified|localtime|timesince }} {% trans "ago" %} - + {% endif %} + + {% if result.modified_by %} + {% trans "by" %} + {% if result.modified_by_url %} + + {% else %} + + {% endif %} + + {% if query %} + {% highlight result.modified_by with query %} + {% else %} + {{ result.modified_by }} + {% endif %} + + {% if result.modified_by_url %} + + {% else %} + + {% endif %} + + {% else %} + {% trans "by" %} {% trans "Anonymous" %} + {% endif %} +
+{% endif %} + +{% if result.title %} + + + + {% if query %} + {% highlight result.title with query max_length "1000" %} + {% else %} + {{ result.title }} + {% endif %} + + +{% endif %} + +{% if result.description %} + + - {% if query %} + {% highlight result.description with query max_length "110" %} + {% else %} + {% if result.latest_description %} + {{ result.latest_description|striptags|escape|truncatechars:110 }} + {% elif result.description %} + {{ result.description|striptags|escape|truncatechars:110 }} + {% endif %} + {% endif %} + +{% endif %} diff --git a/templates/discussion.html b/templates/discussion.html index 8fcff41..c2fbb92 100644 --- a/templates/discussion.html +++ b/templates/discussion.html @@ -1,44 +1,31 @@ - {% load i18n %} -

{% trans 'Groups'|title %}

-
- {% for listname, description, latest, most_relevant, number_of_users in lists %} {% if latest or most_relevant %} -

{{ listname|title|lower }} {% if description %} ({{ description }}){% endif %}

-
- {% blocktrans %}{{ number_of_users }} members{% endblocktrans %} - {% if proxy.trac %} - Wiki - {% endif %} -
-
-

{% trans 'latest'|title %}

-
    +
    {% for thread in latest %} - {% include "message-preview.html" with result=thread.latest_message %} + {% include "discussion-message-preview.html" with result=thread.latest_message %} +
    {% endfor %} -

{% trans 'most relevant'|title %}

-
    +
    {% for thread in most_relevant %} - {% include "message-preview.html" with result=thread %} + {% include "discussion-message-preview.html" with result=thread %} +
    {% endfor %} -
-- libgit2 0.21.2