## -*- coding: utf-8 -*- ## usage: ## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> ## ${comment.comment_block(comment)} ## <%namespace name="base" file="/base/base.html"/> <%def name="comment_block(comment, inline=False)">
${base.gravatar_with_user(comment.author.email, 16)}
${h.age_component(comment.modified_at, time_is_local=True)}
%if comment.pull_request: %if comment.status_change: ${_('Vote on pull request #%s') % comment.pull_request.pull_request_id}: %else: ${_('Comment on pull request #%s') % comment.pull_request.pull_request_id} %endif %else: %if comment.status_change: ${_('Status change on commit')}: %else: ${_('Comment on commit')} %endif %endif
%if comment.status_change:
${comment.status_change[0].status_lbl}
%endif
${comment.render(mentions=True)|n}
<%def name="comment_block_outdated(comment)">
${base.gravatar_with_user(comment.author.email, 16)}
${h.age_component(comment.modified_at, time_is_local=True)}
%if comment.status_change:
${comment.status_change[0].status_lbl}
%endif ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed ## only super-admin, repo admin OR comment owner can delete %if not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed()): %endif
${comment.render(mentions=True)|n}
<%def name="comment_inline_form()"> ## generates inlines taken from c.comments var <%def name="inlines(is_pull_request=False)"> %if is_pull_request:

${ungettext("%d Pull Request Comment", "%d Pull Request Comments", len(c.comments)) % len(c.comments)}

%else:

${ungettext("%d Commit Comment", "%d Commit Comments", len(c.comments)) % len(c.comments)}

%endif %for path, lines_comments in c.inline_comments: % for line, comments in lines_comments.iteritems(): %endfor %endfor ## generate inline comments and the main ones <%def name="generate_comments(include_pull_request=False, is_pull_request=False)"> ## generate inlines for this changeset ${inlines(is_pull_request)} %for comment in c.comments:
## only render comments that are not from pull request, or from ## pull request and a status change %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request: ${comment_block(comment)} %endif
%endfor ## to anchor ajax comments
## MAIN COMMENT FORM <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)"> %if is_compare: <% form_id = "comments_form_compare" %> %else: <% form_id = "comments_form" %> %endif %if is_pull_request:
%if c.allowed_to_merge:
${h.secure_form(url('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form')} ${c.pr_merge_msg} ${c.approval_msg if c.approval_msg else ''} <% merge_disabled = ' disabled' if c.pr_merge_status is False else '' %> ${h.end_form()}
%else:
${c.pr_merge_msg} ${c.approval_msg if c.approval_msg else ''}
%endif
%endif
%if c.rhodecode_user.username != h.DEFAULT_USER:
${h.secure_form(post_url, id_=form_id)}
%if is_pull_request: ${(_('Create a comment on this Pull Request.'))} %elif is_compare: ${(_('Create comments on this Commit range.'))} %else: ${(_('Create a comment on this Commit.'))} %endif
${(_('Comments parsed using %s syntax with %s support.') % ( ('%s' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), ('@mention' % _('Use @username inside this text to send notification to this RhodeCode user')) ) )|n }
${h.textarea('text', class_="comment-block-ta")}
%if form_extras and isinstance(form_extras, (list, tuple)): % for form_ex_el in form_extras: ${form_ex_el|n} % endfor %endif
${h.end_form()}
%endif