## -*- coding: utf-8 -*- <%namespace name="common" file="common.block.html"/> <%namespace name="styles" file="../styles.block.html"/> ${ common.layout(title, content ) } <%def name="post_tags(post)"> <%def name="render_link(tag_id, tag_name)"> ${tag_name} % if post.tags:

% for idx, (tag_id, tag_name) in enumerate(post.tags.items()): ${u'%s%s' % (render_link(tag_id, tag_name), u',' if idx < len(post.tags) - 1 else u'')} % endfor %

% endif <%def name="title()">${ common.post_title(post) } <%def name="render_post_for(post, initiator, feed, only_original_title=False, show_shared=False)"> <%def name="basic_post(verb, description, show_feed_link=True)"> ${ common.yauser(initiator, caps=True) } ${ common.inflect(verb, initiator) } ${description} ${common.in_feed(feed, initiator, True) if show_feed_link else ''} ${ common.post_quote(post, only_original_title=only_original_title) } ${ post_tags(post) } % if show_shared and post.shared_by: <% visible, hidden = post.shared_by[:3], post.shared_by[3:] if len(hidden) == 1: visible.extend(hidden) hidden = [] %> Shared by: % for idx, user in enumerate(visible): ${u'%s%s' % (common.yauser(user), u',' if idx < len(visible) - 1 else u'')} % endfor % if hidden: and ${len(hidden)} more ${u'user' if len(hidden) == 1 else u'users'} % endif % endif <%def name="post_text()"> ${basic_post(u'wrote', u'')} <%def name="post_poll()"> ${basic_post(u'created', u'a poll')} <%def name="post_link()"> ${basic_post(u'shared', u'a link')} <%def name="post_description()"> ${basic_post(u'wrote', u'a treatment')} <%def name="post_congratulation()"> <% if post.congratulated_by_post: target = capture(common.yauser, post.congratulated_by_post) else: target = u'friends' %> ${basic_post(u'congratulated', target, u'with a holiday')} <%def name="post_status()"> ${common.yauser(initiator, caps=True)} % if not post.is_body_empty(): changed mood ${common.post_quote(post, show_title=False)} % else: not in the mood now % endif <%def name="post_friend()"> ${basic_post(u'friends', u'with ' + capture(common.yauser, post.friended_in_post), False)} <%def name="post_unfriend()"> ${basic_post(u'quarreled', u'with ' + capture(common.yauser, post.friended_in_post), False)} <%def name="post_join()"> ${basic_post(u'join', u'the club' + capture(common.yauser, post.friended_in_post), False)} <%def name="post_unjoin()"> ${basic_post(u'left', u'the club ' + capture(common.yauser, post.friended_in_post), False)} ${locals().get('post_%s' % post.post_type, post_text)()} ${styles.button(u'Join the discussion', post.url)} <%def name="content()"> ${render_post_for(post, initiator, feed)}