## -*- coding: utf-8 -*- ## usage: ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> ## ${comment.comment_block(co)} ## <%def name="comment_block(co)">
${h.gravatar(co.author.email, size=20)}
${co.author.username}
${h.age(co.modified_at)}
%if co.pull_request: %if co.status_change: ${_('Status change from pull request')} "${co.pull_request.title or _("No title")}": %else: ${_('Comment from pull request')} "${co.pull_request.title or _("No title")}" %endif %else: %if co.status_change: ${_('Status change on changeset')}: %else: ${_('Comment on changeset')} %endif %endif
%if co.status_change:
${co.status_change[0].status_lbl}
%endif %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or co.author.user_id == c.authuser.user_id:
${_('Delete')}
%endif
${h.rst_w_mentions(co.text)|n}
<%def name="comment_inline_form()"> ## show comment count as "x comments (y inline, z general)" <%def name="comment_count(inline_cnt, general_cnt)"> ${'%s (%s, %s)' % ( ungettext("%d comment", "%d comments", inline_cnt + general_cnt) % (inline_cnt + general_cnt), ungettext("%d inline", "%d inline", inline_cnt) % inline_cnt, ungettext("%d general", "%d general", general_cnt) % general_cnt )} ## generates inlines taken from c.comments var <%def name="inlines()">
${comment_count(c.inline_cnt, len(c.comments))}
%for path, lines in c.inline_comments: % for line,comments in lines.iteritems(): %endfor %endfor ## generate inline comments and the main ones <%def name="generate_comments()">
## generate inlines for this changeset ${inlines()}
%for co in c.comments:
${comment_block(co)}
%endfor
## MAIN COMMENT FORM <%def name="comments(post_url, cur_status, is_pr=False, change_status=True)">
%if c.authuser.username != 'default':
${h.form(post_url, id="main_form")}
${(_('Comments parsed using %s syntax with %s support.') % (('RST' % h.url('rst_help')), '@mention' % _('Use @username inside this text to notify another user.')))|n}
${h.textarea('text', class_="comment-block-ta")} %if change_status:
%if is_pr: ${_('Vote for pull request status')}: %else: ${_('Set changeset status')}: %endif %for status,lbl in c.changeset_statuses: %endfor %if is_pr and ( \ h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) \ or c.pull_request.author.user_id == c.authuser.user_id): %endif
%endif
${h.submit('save', _('Comment'), class_="btn")}
${_('Preview')}
${h.end_form()}
%endif