summaryrefslogtreecommitdiffstats
path: root/hyperkitty
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-10-05 15:01:59 +0200
committerAurélien Bompard <aurelien@bompard.org>2012-10-05 15:01:59 +0200
commitc7570addec98c4e7695d83202650b9296e47c957 (patch)
tree147cd9e6e981acdd11efd6fd3950d8f936f8ae42 /hyperkitty
parentcd1a2d5f2ec738ab2f17c86dcabe8733a682aa4f (diff)
downloadhyperkitty-c7570addec98c4e7695d83202650b9296e47c957.tar.gz
hyperkitty-c7570addec98c4e7695d83202650b9296e47c957.tar.xz
hyperkitty-c7570addec98c4e7695d83202650b9296e47c957.zip
Improve appearance
Diffstat (limited to 'hyperkitty')
-rw-r--r--hyperkitty/lib/__init__.py9
-rw-r--r--hyperkitty/lib/archiver.py2
-rw-r--r--hyperkitty/static/css/style.css9
-rw-r--r--hyperkitty/static/css/thread.css37
-rw-r--r--hyperkitty/templates/message.html4
-rw-r--r--hyperkitty/templates/messages/message.html35
-rw-r--r--hyperkitty/templates/month_view.html3
-rw-r--r--hyperkitty/templates/recent_activities.html5
-rw-r--r--hyperkitty/templates/thread.html26
-rw-r--r--hyperkitty/templatetags/storm.py6
-rw-r--r--hyperkitty/views/list.py8
-rw-r--r--hyperkitty/views/thread.py14
12 files changed, 103 insertions, 55 deletions
diff --git a/hyperkitty/lib/__init__.py b/hyperkitty/lib/__init__.py
index 0ae2a7f..1ab04cd 100644
--- a/hyperkitty/lib/__init__.py
+++ b/hyperkitty/lib/__init__.py
@@ -59,3 +59,12 @@ def get_months(store, list_name):
def get_store(request):
return request.environ["kittystore.store"]
+
+
+def stripped_subject(mlist, subject):
+ if mlist is None:
+ return subject
+ list_name = mlist.display_name or mlist.name[:mlist.name.index("@")]
+ if subject.lower().startswith("[%s] " % list_name.lower()):
+ subject = subject[len(list_name)+3 : ]
+ return subject
diff --git a/hyperkitty/lib/archiver.py b/hyperkitty/lib/archiver.py
index 3a2e7a7..2e21e27 100644
--- a/hyperkitty/lib/archiver.py
+++ b/hyperkitty/lib/archiver.py
@@ -88,7 +88,7 @@ class Archiver(object):
"""
if self.store is None:
self.store = get_store(self.store_url)
- msg.message_id_hash = self.store.add_to_list(mlist.fqdn_listname, msg)
+ msg.message_id_hash = self.store.add_to_list(mlist, msg)
self.store.commit()
# TODO: Update karma
return msg.message_id_hash
diff --git a/hyperkitty/static/css/style.css b/hyperkitty/static/css/style.css
index ef9bfa2..cc6945d 100644
--- a/hyperkitty/static/css/style.css
+++ b/hyperkitty/static/css/style.css
@@ -1,6 +1,6 @@
body {
position: relative;
- padding-top: 90px;
+ padding-top: 55px;
background-color: white;
}
@@ -353,4 +353,9 @@ body {
.removed {
display: none;
-}[
+}
+
+p.attachments {
+ margin-bottom: 0;
+ font-weight: bold;
+}
diff --git a/hyperkitty/static/css/thread.css b/hyperkitty/static/css/thread.css
index 88a2050..90d2add 100644
--- a/hyperkitty/static/css/thread.css
+++ b/hyperkitty/static/css/thread.css
@@ -1,3 +1,18 @@
+
+header {
+ /*background-color: #f6f6f6;*/
+ /*border-bottom: 1px solid #b3b3b3;*/
+ margin-bottom: 3em;
+ padding: 1em 0;
+}
+
+h1 {
+ text-align: center;
+ font-size: 24px;
+ line-height: 26px;
+}
+
+
#thread_nav{
margin:auto;
width:100%;
@@ -127,8 +142,7 @@
.email_header {
position:relative;
- margin-top: 20px;
- margin-bottom: 20px;
+ margin-bottom: 1em;
}
.email_header img {
@@ -146,12 +160,6 @@
font-weight: bold;
}
-.email_date {
- position: absolute;
- right: 20px;
- bottom: 0px;
-}
-
.email_date .date {
font-weight: bold;
}
@@ -165,18 +173,16 @@
}
/* The email thread */
-.even {
- background-color: rgb(246, 246, 246);
+.even, .odd {
border-top: 1px solid rgb(179, 179, 179);
- padding-left: 20px;
+ padding: 1em;
margin: 20px 0px 20px 0px;
}
-
+.even {
+ background-color: rgb(246, 246, 246);
+}
.odd {
background-color: rgb(238, 238, 238);
- border-top: 1px solid rgb(179, 179, 179);
- padding-left: 20px;
- margin: 20px 0px 20px 0px;
}
.email {
@@ -207,6 +213,7 @@
background-color: rgb(255, 255, 255);
white-space: pre;
display: inline-block;
+ width: 95%;
}
.first_email_body {
diff --git a/hyperkitty/templates/message.html b/hyperkitty/templates/message.html
index 5d061e5..35c3add 100644
--- a/hyperkitty/templates/message.html
+++ b/hyperkitty/templates/message.html
@@ -7,6 +7,10 @@
{% block content %}
+<header>
+ <h1>{{ message.subject }}</h1>
+</header>
+
<section id="thread_content">
{% include 'messages/first_email.html' with first_mail=message %}
</section>
diff --git a/hyperkitty/templates/messages/message.html b/hyperkitty/templates/messages/message.html
index 08d5cca..c971e16 100644
--- a/hyperkitty/templates/messages/message.html
+++ b/hyperkitty/templates/messages/message.html
@@ -2,17 +2,21 @@
{% load gravatar %}
<div class="email_header">
+ <div class="email_date inline-block pull-right">
+ <span class="date">{{email.date}}</span>
+ <br />
+ </div>
{% gravatar_img_for_email email.email 40 %}
<div class="email_author inline-block">
<span class="name"> <a href="{% url message_index mlist_fqdn=list_address, hashid=email.message_id_hash %}">{{email.sender_name}}</a> </span>
- {% if settings.USE_MOCKUPS %}
<br />
- <span class="rank">Rank 8</span>
+ <span class="rank">
+ {% if settings.USE_MOCKUPS %}
+ Rank 8
+ {% else %}
+ &nbsp;
{% endif %}
- </div>
- <div class="email_date inline-block right">
- <span class="date">{{email.date}}</span>
- <br />
+ </span>
</div>
</div>
@@ -24,6 +28,17 @@
{{email.content}}
</div>
+{% if unfolded and email.attachments|count %}
+<p class="attachments">Attachments:</p>
+<ul class="attachments-list">
+{% for attachment in email.attachments %}
+ <li><a href="{% url message_attachment mlist_fqdn=list_address, hashid=email.message_id_hash, counter=attachment.counter, filename=attachment.name %}">{{attachment.name}}</a>
+ ({{attachment.content_type}} &mdash; {{attachment.size|filesizeformat}})
+ </li>
+{% endfor %}
+</ul>
+{% endif %}
+
<ul class="email_info inline" messageid="{{email.message_id_hash}}">
{% if settings.USE_MOCKUPS %}
<li class="neutral">
@@ -36,11 +51,9 @@
<a href="#dislike"> Dislike</a>
</li>
{% endif %}
-{% if email.attachments|count %}
- {% if not unfolded %}
+{% if not unfolded and email.attachments|count %}
<li class="attachments">
- <a href="#attachments">{{ email.attachments|count }} attachments</a>
- {% endif %}
+ <a href="#attachments">{{ email.attachments|count }} attachment(s)</a>
<ul class="attachments-list">
{% for attachment in email.attachments %}
<li><a href="{% url message_attachment mlist_fqdn=list_address, hashid=email.message_id_hash, counter=attachment.counter, filename=attachment.name %}">{{attachment.name}}</a>
@@ -48,9 +61,7 @@
</li>
{% endfor %}
</ul>
- {% if not unfolded %}
</li>
- {% endif %}
{% endif %}
</ul>
diff --git a/hyperkitty/templates/month_view.html b/hyperkitty/templates/month_view.html
index 3dc3db3..fdfd731 100644
--- a/hyperkitty/templates/month_view.html
+++ b/hyperkitty/templates/month_view.html
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load poll_extras %}
{% load gravatar %}
+{% load storm %}
{% block content %}
@@ -10,7 +11,7 @@
<div class="thread">
<div class="notsaved">
<span class="thread_title"> <a name="{{email.thread_id}}"
- href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}"> {{email.subject}} </a> </span>
+ href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}">{{ email.subject|strip_subject:mlist }}</a> </span>
<span class="thread_date"> {{email.date}}</span>
</div>
<div class="thread_content">
diff --git a/hyperkitty/templates/recent_activities.html b/hyperkitty/templates/recent_activities.html
index 3cbafdf..3b197c8 100644
--- a/hyperkitty/templates/recent_activities.html
+++ b/hyperkitty/templates/recent_activities.html
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load poll_extras %}
{% load gravatar %}
+{% load storm %}
{% block additional_stylesheets %}
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/stats.css" />
@@ -85,7 +86,7 @@
<div class="thread">
<span class="thread_id">#{{forloop.counter}}</span>
<span class="thread_title"> <a name="{{email.thread_id}}"
- href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}"> {{email.subject}} </a> </span>
+ href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}">{{ email.subject|strip_subject:mlist }}</a> </span>
<div class="thread_stats">
<ul class="inline-block">
{% if email.category_tag %}
@@ -123,7 +124,7 @@
<div class="thread">
<span class="thread_id">#{{forloop.counter}}</span>
<span class="thread_title"> <a name="{{email.thread_id}}"
- href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}"> {{email.subject}} </a> </span>
+ href="{% url thread threadid=email.thread_id, mlist_fqdn=list_address %}">{{ email.subject|strip_subject:mlist }}</a> </span>
<div class="thread_stats">
<ul class="inline-block">
{% if email.category_tag %}
diff --git a/hyperkitty/templates/thread.html b/hyperkitty/templates/thread.html
index a3d8c8b..78b4891 100644
--- a/hyperkitty/templates/thread.html
+++ b/hyperkitty/templates/thread.html
@@ -8,6 +8,10 @@
{% block content %}
+ <header>
+ <h1>{{ subject }}</h1>
+ </header>
+
{% include 'threads/right_col.html' %}
<!-- main section, the email thread -->
@@ -39,7 +43,7 @@
userCollapseText : 'View Less',
expandText : 'View More'
});
- });
+ });
</script>
<script type="text/javascript">
@@ -90,21 +94,21 @@
{% else %}
alert('You need to login in order to vote');
{% endif %}
-
+
});
$("#add_tag_form").submit( function () {
-
+
{% if user.is_authenticated %}
- $.ajax({
+ $.ajax({
type: "POST",
- data : $(this).serialize(),
- url: "{% url add_tag mlist_fqdn=list_address, email_id=threadid %}",
+ data : $(this).serialize(),
+ url: "{% url add_tag mlist_fqdn=list_address, email_id=threadid %}",
success: function(data){
console.log('Tag is added successfully');
- location.reload();
- }
- });
+ location.reload();
+ }
+ });
return false;
{% else %}
alert('You need to login in order to add tag');
@@ -115,7 +119,7 @@
$("ul.email_info li.attachments > a").click(function() {
$(this).next("ul").fadeToggle('fast');
});
-
- });
+
+ });
</script>
{% endblock %}
diff --git a/hyperkitty/templatetags/storm.py b/hyperkitty/templatetags/storm.py
index 81fd4aa..a116430 100644
--- a/hyperkitty/templatetags/storm.py
+++ b/hyperkitty/templatetags/storm.py
@@ -1,7 +1,13 @@
from django import template
+from hyperkitty.lib import stripped_subject
+
register = template.Library()
@register.filter(name="count")
def count(expr):
return expr.count()
+
+@register.filter(name="strip_subject")
+def count(subject, mlist):
+ return stripped_subject(mlist, subject)
diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py
index 134ee23..d8ea29a 100644
--- a/hyperkitty/views/list.py
+++ b/hyperkitty/views/list.py
@@ -82,11 +82,11 @@ def archives(request, mlist_fqdn, year=None, month=None, day=None):
begin_date = datetime(today.year, today.month, 1)
end_date = datetime(today.year, today.month + 1, 1)
month_string = 'Past thirty days'
- list_name = mlist_fqdn.split('@')[0]
search_form = SearchForm(auto_id=False)
t = loader.get_template('month_view.html')
store = get_store(request)
+ mlist = store.get_list(mlist_fqdn)
threads = store.get_threads(mlist_fqdn, start=begin_date,
end=end_date)
@@ -159,7 +159,7 @@ def archives(request, mlist_fqdn, year=None, month=None, day=None):
archives_length = get_months(store, mlist_fqdn)
c = RequestContext(request, {
- 'list_name' : list_name,
+ 'mlist' : mlist,
'objects': threads.object_list,
'page': pageNo,
'has_previous': threads.has_previous(),
@@ -184,7 +184,6 @@ def list(request, mlist_fqdn=None):
return HttpResponseRedirect('/')
t = loader.get_template('recent_activities.html')
search_form = SearchForm(auto_id=False)
- list_name = mlist_fqdn.split('@')[0]
# Get stats for last 30 days
today = datetime.utcnow()
@@ -192,6 +191,7 @@ def list(request, mlist_fqdn=None):
begin_date = end_date - timedelta(days=32)
store = get_store(request)
+ mlist = store.get_list(mlist_fqdn)
threads = store.get_threads(list_name=mlist_fqdn, start=begin_date,
end=end_date)
@@ -253,7 +253,7 @@ def list(request, mlist_fqdn=None):
threads_per_category = {}
c = RequestContext(request, {
- 'list_name' : list_name,
+ 'mlist' : mlist,
'list_address': mlist_fqdn,
'search_form': search_form,
'month': 'Recent activity',
diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py
index 48106d0..397a158 100644
--- a/hyperkitty/views/thread.py
+++ b/hyperkitty/views/thread.py
@@ -32,24 +32,20 @@ from django.contrib.auth.decorators import (login_required,
from hyperkitty.models import Rating, Tag
#from hyperkitty.lib.mockup import *
from forms import *
-from hyperkitty.lib import get_months, get_store
+from hyperkitty.lib import get_months, get_store, stripped_subject
def thread_index (request, mlist_fqdn, threadid):
''' Displays all the email for a given thread identifier '''
- list_name = mlist_fqdn.split('@')[0]
-
search_form = SearchForm(auto_id=False)
t = loader.get_template('thread.html')
store = get_store(request)
messages = store.get_messages_in_thread(mlist_fqdn, threadid)
if not messages:
raise Http404
- #prev_thread = mongo.get_thread_name(list_name, int(threadid) - 1)
prev_thread = []
if len(prev_thread) > 30:
prev_thread = '%s...' % prev_thread[:31]
- #next_thread = mongo.get_thread_name(list_name, int(threadid) + 1)
next_thread = []
if len(next_thread) > 30:
next_thread = '%s...' % next_thread[:31]
@@ -100,9 +96,13 @@ def thread_index (request, mlist_fqdn, threadid):
days_old = today - messages[0].date.date()
days_inactive = today - messages[-1].date.date()
+ mlist = store.get_list(mlist_fqdn)
+ subject = stripped_subject(mlist, messages[0].subject)
+
c = RequestContext(request, {
- 'list_name' : list_name,
+ 'mlist' : mlist,
'threadid' : threadid,
+ 'subject': subject,
'tags' : tags,
'list_address': mlist_fqdn,
'search_form': search_form,
@@ -137,7 +137,7 @@ def add_tag(request, mlist_fqdn, email_id):
try:
tag_obj = Tag.objects.get(threadid=email_id, list_address=mlist_fqdn, tag=tag)
except Tag.DoesNotExist:
- tag_obj = Tag(list_address=mlist_fqdn, threadid=email_id, tag=tag)
+ tag_obj = Tag(list_address=mlist_fqdn, threadid=email_id, tag=tag)
tag_obj.save()
response_dict = { }