diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2012-10-04 12:02:52 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2012-10-04 12:02:52 +0200 |
commit | cd1a2d5f2ec738ab2f17c86dcabe8733a682aa4f (patch) | |
tree | a00aafaafbe919364ff8c9882bc5cf26935fb29a | |
parent | 5f9c7c8bba6db94f45cf0d0f2ca679ee8a0a3a92 (diff) | |
download | hyperkitty-cd1a2d5f2ec738ab2f17c86dcabe8733a682aa4f.tar.gz hyperkitty-cd1a2d5f2ec738ab2f17c86dcabe8733a682aa4f.tar.xz hyperkitty-cd1a2d5f2ec738ab2f17c86dcabe8733a682aa4f.zip |
Improve attachments display
-rw-r--r-- | hyperkitty/static/css/thread.css | 9 | ||||
-rw-r--r-- | hyperkitty/templates/message.html | 11 | ||||
-rw-r--r-- | hyperkitty/templates/messages/message.html | 32 | ||||
-rw-r--r-- | hyperkitty/templates/thread.html | 6 | ||||
-rw-r--r-- | hyperkitty/templatetags/poll_extras.py | 2 | ||||
-rw-r--r-- | hyperkitty/templatetags/storm.py | 7 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 3 | ||||
-rw-r--r-- | hyperkitty/views/message.py | 2 |
8 files changed, 46 insertions, 26 deletions
diff --git a/hyperkitty/static/css/thread.css b/hyperkitty/static/css/thread.css index 268e7ff..88a2050 100644 --- a/hyperkitty/static/css/thread.css +++ b/hyperkitty/static/css/thread.css @@ -160,10 +160,6 @@ color: rgb(167, 169, 172); } -.email_info { - padding: 0px; -} - .add_comment { float: right; } @@ -237,3 +233,8 @@ white-space: pre; } +ul.attachments-list li { + display: list-item; + list-style-type: disc; +} + diff --git a/hyperkitty/templates/message.html b/hyperkitty/templates/message.html index e9f2806..5d061e5 100644 --- a/hyperkitty/templates/message.html +++ b/hyperkitty/templates/message.html @@ -9,17 +9,6 @@ <section id="thread_content"> {% include 'messages/first_email.html' with first_mail=message %} - - {% if attachments|length %} - <h2>Attachments</h2> - <ul> - {% for attachment in attachments %} - <li><a href="{% url message_attachment mlist_fqdn=list_address, hashid=hashid, counter=attachment.counter, filename=attachment.name %}">{{attachment.name}}</a> - ({{attachment.content_type}}, {{attachment.size}} octets) - </li> - {% endfor %} - </ul> - {% endif %} </section> {% endblock %} diff --git a/hyperkitty/templates/messages/message.html b/hyperkitty/templates/messages/message.html index 54613e0..08d5cca 100644 --- a/hyperkitty/templates/messages/message.html +++ b/hyperkitty/templates/messages/message.html @@ -1,3 +1,4 @@ +{% load storm %} {% load gravatar %} <div class="email_header"> @@ -14,18 +15,17 @@ <br /> </div> </div> + {% if unfolded %} - <div class="first_email_body"> +<div class="first_email_body"> {% else %} - <div class="email_body"> +<div class="email_body"> {% endif %} - - {{email.content}} - +{{email.content}} </div> -{% if settings.USE_MOCKUPS %} <ul class="email_info inline" messageid="{{email.message_id_hash}}"> +{% if settings.USE_MOCKUPS %} <li class="neutral"> +{{email.likes}}/-{{email.dislikes}} </li> @@ -35,5 +35,23 @@ <li class="votedown"> <a href="#dislike"> Dislike</a> </li> -</ul> {% endif %} +{% if email.attachments|count %} + {% if not unfolded %} + <li class="attachments"> + <a href="#attachments">{{ email.attachments|count }} attachments</a> + {% endif %} + <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}} — {{attachment.size|filesizeformat}}) + </li> + {% endfor %} + </ul> + {% if not unfolded %} + </li> + {% endif %} +{% endif %} +</ul> + + diff --git a/hyperkitty/templates/thread.html b/hyperkitty/templates/thread.html index 2730db9..a3d8c8b 100644 --- a/hyperkitty/templates/thread.html +++ b/hyperkitty/templates/thread.html @@ -110,7 +110,11 @@ alert('You need to login in order to add tag'); {% endif %} }); - + + $("ul.email_info li.attachments ul.attachments-list").hide(); + $("ul.email_info li.attachments > a").click(function() { + $(this).next("ul").fadeToggle('fast'); + }); }); </script> diff --git a/hyperkitty/templatetags/poll_extras.py b/hyperkitty/templatetags/poll_extras.py index a5f1032..0f243c6 100644 --- a/hyperkitty/templatetags/poll_extras.py +++ b/hyperkitty/templatetags/poll_extras.py @@ -43,7 +43,7 @@ def strip_page(value): return value if value.endswith('/') and value[-3] == '/': end_with_number = False - try: + try: if int(value[-2]) in range(0,10): end_with_number = True if end_with_number: diff --git a/hyperkitty/templatetags/storm.py b/hyperkitty/templatetags/storm.py new file mode 100644 index 0000000..81fd4aa --- /dev/null +++ b/hyperkitty/templatetags/storm.py @@ -0,0 +1,7 @@ +from django import template + +register = template.Library() + +@register.filter(name="count") +def count(expr): + return expr.count() diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index 900b7f5..134ee23 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -38,6 +38,9 @@ from hyperkitty.models import Rating, Tag from hyperkitty.lib import get_months, get_store from forms import * +if settings.USE_MOCKUPS: + from hyperkitty.lib.mockup import generate_top_author, generate_thread_per_category + # @TODO : Move this into settings.py MONTH_PARTICIPANTS = 284 diff --git a/hyperkitty/views/message.py b/hyperkitty/views/message.py index f6c4d91..19242fd 100644 --- a/hyperkitty/views/message.py +++ b/hyperkitty/views/message.py @@ -49,7 +49,6 @@ def index(request, mlist_fqdn, hashid): if message is None: raise Http404 message.sender_email = message.sender_email.strip() - attachments = store.get_attachments(mlist_fqdn, message.message_id) # Extract all the votes for this message try: @@ -77,7 +76,6 @@ def index(request, mlist_fqdn, hashid): 'list_address': mlist_fqdn, 'message': message, 'hashid' : hashid, - 'attachments': attachments, }) return HttpResponse(t.render(c)) |