## -*- coding: utf-8 -*- ## usage: ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> ## ${comment.comment_block(comment)} ## <%namespace name="base" file="/base/base.mako"/> <%def name="comment_block(comment, inline=False)"> <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version', None)) %> <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %>
% if comment.comment_type == 'todo': % if comment.resolved: % else:
${comment.comment_type}
% endif % else: % if comment.resolved_comment: fix % else: ${comment.comment_type or 'note'} % endif % endif
${base.gravatar_with_user(comment.author.email, 16)}
${h.age_component(comment.modified_at, time_is_local=True)}
% if inline: % else: % endif % if comment.status_change:
${comment.status_change[0].status_lbl}
% endif
${comment.render(mentions=True)|n}
## generate main comments <%def name="generate_comments(include_pull_request=False, is_pull_request=False)">
%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
<%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)"> ## merge status, and merge action %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 is_pull_request: placeholder = _('Leave a comment on this Pull Request.') elif is_compare: placeholder = _('Leave a comment on all commits in this range.') else: placeholder = _('Leave a comment on this Commit.') %> % if c.rhodecode_user.username != h.DEFAULT_USER:
## template generated for injection ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
## inject form here
% else: ## form state when not logged in
${_('You need to be logged in to leave comments.')} ${_('Login now')}
% endif
<%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)"> ## comment injected based on assumption that user is logged in