#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

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

@ -49,53 +49,53 @@
</div> </div>
{% endif %} {% endif %}
<h1>{% trans "Agenda" %}</h1> <h1>{% trans "Agenda" %}</h1>
<p> <p>
{%trans "Filter" %}: {%trans "Filter" %}:
<input type="checkbox" id="hide_closed_items"> {%trans "Hide closed items" %} <input type="checkbox" id="hide_closed_items"> {%trans "Hide closed items" %}
</p> </p>
{{ items|length }} {{ items|length }}
{% 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>
{% endif %} {% endif %}
</tr> </tr>
{% if items %} {% if items %}
<tr class="topline {% if overview %}activeline{% endif %}"> <tr class="topline {% if overview %}activeline{% endif %}">
<td></td> <td></td>
<td> <td>
<b>{% trans "Agenda" %}</b> <b>{% trans "Agenda" %}</b>
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<td></td> <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 %}
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
{% 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 %}
{% else %} {% else %}
<tr> <tr>
<td colspan="4"><i>{%trans "No items available." %}</i></td> <td colspan="4"><i>{%trans "No items available." %}</i></td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>
</form> </form>
{% endblock %} {% endblock %}

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]