#237, #238 only show the first line of a comment in the agenda

This commit is contained in:
Oskar Hahn 2012-06-30 10:39:58 +02:00
parent 818a15aa2b
commit e8e664b92e
6 changed files with 67 additions and 57 deletions

View File

@ -17,3 +17,7 @@ a.close_link span {
a.close_link.closed span {
background-image: url(../images/icons/done.png);
}
table#menu-overview {
white-space: nowrap;
}

View File

@ -25,7 +25,7 @@
</td>
{% if perms.agenda.can_manage_agenda %}
<td>
{{ item.comment }}
{{ item.comment|first_line }}
</td>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}

View File

@ -59,13 +59,13 @@
{% blocktrans count counter=items|length %}item{% plural %}items{% endblocktrans %}<span id="hiddencount"></span>
<table id="menu-overview" class="agendatable">
<tr>
<th style="width: 1px;">{% trans "Done" %}</th>
<th width="50">{% trans "Done" %}</th>
<th>{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %}
<th style="width: 1px;">{% trans "Comment" %}</th>
<th width="200">{% trans "Comment" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<th style="width: 1px;">{% trans "Actions" %}</th>
<th width="50">{% trans "Actions" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<th class="tabledrag-hide">{% trans "Weight" %}</th>
@ -87,7 +87,7 @@
{% for item in items %}
<tr class="draggable{% cycle ' odd' '' %}
{% if item.active %}activeline{% endif %}">
{% if item.active %}activeline{% endif %}">
{% include "agenda/item_row.html" %}
</tr>
{% endfor %}

View File

@ -63,14 +63,6 @@ class Profile(models.Model):
if link == 'delete':
return ('user_delete', [str(self.user.id)])
def get_comment_line(self):
lines = self.comment.split('\n')
if len(lines) > 1 or len(lines[0]) > 40:
s = "%s ..."
else:
s = "%s"
return s % lines[0][:40]
def __unicode__(self):
if self.group:
return "%s (%s)" % (self.user.get_full_name(), self.group)

View File

@ -2,6 +2,7 @@
{% load i18n %}
{% load staticfiles %}
{% load tags %}
{% block title %}{{ block.super }} - {%trans "Participants" %}{% endblock %}
@ -80,7 +81,7 @@
<td>{{ user.profile.get_type_display }}</td>
<td>{{ user.profile.committee }}</td>
{% if perms.participant.can_manage_participant %}
<td>{{ user.profile.get_comment_line }}</td>
<td>{{ user.profile.comment|first_line }}</td>
<td>{% if user.last_login > user.date_joined %}
{{ user.last_login }}
{% endif %}</td>

View File

@ -36,3 +36,16 @@ def active(request, pattern):
@register.simple_tag
def model_url(object, link='view'):
return object.get_absolute_url(link)
@register.filter
def first_line(text):
try:
lines = text.split('\n')
except AttributeError:
return ''
if len(lines) > 1 or len(lines[0]) > 40:
s = "%s ..."
else:
s = "%s"
return s % lines[0][:40]