#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

@ -20,12 +20,12 @@
{% endif %}
<a href="{{ item.get_absolute_url }}">{{ item }}</a>
{% if item.releated_sid %}
({{ item.get_releated_type }})
({{ item.get_releated_type }})
{% endif %}
</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

@ -49,53 +49,53 @@
</div>
{% endif %}
<h1>{% trans "Agenda" %}</h1>
<h1>{% trans "Agenda" %}</h1>
<p>
{%trans "Filter" %}:
<input type="checkbox" id="hide_closed_items"> {%trans "Hide closed items" %}
</p>
{{ items|length }}
{% 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>{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %}
<th style="width: 1px;">{% trans "Comment" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<th style="width: 1px;">{% trans "Actions" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<th class="tabledrag-hide">{% trans "Weight" %}</th>
{% endif %}
</tr>
{% if items %}
<tr class="topline {% if overview %}activeline{% endif %}">
<td></td>
<td>
<b>{% trans "Agenda" %}</b>
</td>
{% if perms.agenda.can_manage_agenda %}
<td></td>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td></td>
{% endif %}
</tr>
<p>
{%trans "Filter" %}:
<input type="checkbox" id="hide_closed_items"> {%trans "Hide closed items" %}
</p>
{{ items|length }}
{% blocktrans count counter=items|length %}item{% plural %}items{% endblocktrans %}<span id="hiddencount"></span>
<table id="menu-overview" class="agendatable">
<tr>
<th width="50">{% trans "Done" %}</th>
<th>{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %}
<th width="200">{% trans "Comment" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<th width="50">{% trans "Actions" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<th class="tabledrag-hide">{% trans "Weight" %}</th>
{% endif %}
</tr>
{% if items %}
<tr class="topline {% if overview %}activeline{% endif %}">
<td></td>
<td>
<b>{% trans "Agenda" %}</b>
</td>
{% if perms.agenda.can_manage_agenda %}
<td></td>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td></td>
{% endif %}
</tr>
{% for item in items %}
<tr class="draggable{% cycle ' odd' '' %}
{% if item.active %}activeline{% endif %}">
{% include "agenda/item_row.html" %}
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4"><i>{%trans "No items available." %}</i></td>
</tr>
{% endif %}
</table>
{% for item in items %}
<tr class="draggable{% cycle ' odd' '' %}
{% if item.active %}activeline{% endif %}">
{% include "agenda/item_row.html" %}
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4"><i>{%trans "No items available." %}</i></td>
</tr>
{% endif %}
</table>
</form>
{% endblock %}

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]