## snippet for sidebar elements ## usage: ## <%namespace name="sidebar" file="/base/sidebar.mako"/> ## ${sidebar.comments_table()} <%namespace name="base" file="/base/base.mako"/> <%def name="comments_table(comments, counter_num, todo_comments=False, draft_comments=False, existing_ids=None, is_pr=True)"> <% if todo_comments: cls_ = 'todos-content-table' def sorter(entry): user_id = entry.author.user_id resolved = '1' if entry.resolved else '0' if user_id == c.rhodecode_user.user_id: # own comments first user_id = 0 return '{}'.format(str(entry.comment_id).zfill(10000)) elif draft_comments: cls_ = 'drafts-content-table' def sorter(entry): return '{}'.format(str(entry.comment_id).zfill(10000)) else: cls_ = 'comments-content-table' def sorter(entry): return '{}'.format(str(entry.comment_id).zfill(10000)) existing_ids = existing_ids or [] %>
% if ver_info:
v${comments_ver_divider} ${h.age_component(ver_info.created_on, time_is_local=True, tooltip=False)}
% else:
v${comments_ver_divider}
% endif
|
|||
${h.checkbox('submit_draft', id=None, value=comment_obj.comment_id)} | % endif
<%
version_info = ''
if is_pr:
version_info = (' made in older version (v{})'.format(comment_ver_index) if is_from_old_ver == 'true' else ' made in this version')
%>
## new comments, since refresh
% if existing_ids and comment_obj.comment_id not in existing_ids:
!
% endif
<%
data = h.json.dumps({
'comment_id': comment_obj.comment_id,
'version_info': version_info,
'file_name': comment_obj.f_path,
'line_no': comment_obj.line_no,
'outdated': comment_obj.outdated,
'inline': comment_obj.is_inline,
'is_todo': comment_obj.is_todo,
'created_on': h.format_date(comment_obj.created_on),
'datetime': '{}{}'.format(comment_obj.created_on, h.get_timezone(comment_obj.created_on, time_is_local=True)),
'review_status': (comment_obj.review_status or '')
})
icon = ''
if comment_obj.outdated:
icon += ' icon-comment-toggle'
elif comment_obj.is_inline:
icon += ' icon-code'
else:
icon += ' icon-comment'
if comment_obj.draft:
if comment_obj.is_todo:
icon = 'icon-flag-filled icon-draft'
else:
icon = 'icon-comment icon-draft'
%>
|
${base.gravatar(comment_obj.author.email, 16, user=comment_obj.author, tooltip=True, extra_class=['no-margin'])} |
${h.chop_at_smart(comment_obj.text, '\n', suffix_if_chopped='...')}
|