#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 { a.close_link.closed span {
background-image: url(../images/icons/done.png); background-image: url(../images/icons/done.png);
} }
table#menu-overview {
white-space: nowrap;
}

View File

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

View File

@ -63,14 +63,6 @@ class Profile(models.Model):
if link == 'delete': if link == 'delete':
return ('user_delete', [str(self.user.id)]) 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): def __unicode__(self):
if self.group: if self.group:
return "%s (%s)" % (self.user.get_full_name(), self.group) return "%s (%s)" % (self.user.get_full_name(), self.group)

View File

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

View File

@ -36,3 +36,16 @@ def active(request, pattern):
@register.simple_tag @register.simple_tag
def model_url(object, link='view'): def model_url(object, link='view'):
return object.get_absolute_url(link) 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]