Add auto-hide/show magic to message recipients field when viewing
This commit is contained in:
parent
f3cab67aaf
commit
70a2f10c81
2 changed files with 29 additions and 0 deletions
|
@ -97,6 +97,12 @@ class RecipientsFieldRenderer(formalchemy.FieldRenderer):
|
|||
recips = sorted([r.recipient.display_name for r in recips])
|
||||
if len(recips) < len(recipients):
|
||||
recips.insert(0, 'you')
|
||||
max_display = 5
|
||||
if len(recips) > max_display:
|
||||
basic = HTML.literal("{}, ".format(', '.join(recips[:max_display-1])))
|
||||
more = tags.link_to("({} more)".format(len(recips[max_display-1:])), '#', class_='more')
|
||||
everyone = HTML.tag('span', class_='everyone', c=', '.join(recips[max_display-1:]))
|
||||
return basic + more + everyone
|
||||
return ', '.join(recips)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue