# HG changeset patch # User Marcin Kuzminski # Date 2019-12-16 12:12:12 # Node ID eb578430016d2efc4c37b270db5c87e4eb076d0e # Parent 2c25109da085358921ce056995d3b05d3c2d91a9 pull-requests: expose TODO box in dedicated panel - TODOs are important for merging and code-review we make them important now and shown next to votes for reviewers. - fixed some scrollToComment logic - small UI fixes diff --git a/rhodecode/public/css/helpers.less b/rhodecode/public/css/helpers.less --- a/rhodecode/public/css/helpers.less +++ b/rhodecode/public/css/helpers.less @@ -52,6 +52,16 @@ a { cursor: pointer; } } } +.noselect { + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + supported by Chrome and Opera */ +} + //--- DEVICE-SPECIFIC CLASSES ---------------// //regular tablet and up @media (min-width:768px) { diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -434,7 +434,8 @@ ul.auth_plugins { input { border: 1px transparent; color: black; - opacity: 1 + opacity: 1; + background: #fff; } } @@ -507,13 +508,21 @@ ul.auth_plugins { vertical-align: top; } +#open_edit_pullrequest { + padding: 0; +} + #close_edit_pullrequest { - padding-left: 1em + } #delete_pullrequest { clear: inherit; - padding: 0 + + form { + display: inline; + } + } .perms_section_head { @@ -820,6 +829,11 @@ label { padding: 0 0 0 .17em; line-height: 1em; } + + & + .no-margin { + margin: 0 + } + } .user-inline-data { @@ -836,7 +850,7 @@ label { max-width: 200px; min-height: (@gravatar-size + @border-thickness * 2); // account for border display: block; - padding: 0 0 0 (@gravatar-size + @basefontsize/2 + @border-thickness * 2); + padding: 0 0 0 (@gravatar-size + @basefontsize/4); .gravatar { @@ -1566,14 +1580,52 @@ table.integrations { } } .pr-details-content { - margin-top: @textmargin; - margin-bottom: @textmargin; + margin-top: @textmargin - 5; + margin-bottom: @textmargin - 5; } .pr-reviewer-rules { padding: 10px 0px 20px 0px; } +.todo-resolved { + text-decoration: line-through; +} + +.todo-table { + width: 100%; + + td { + padding: 5px 0px; + } + + .td-todo-number { + text-align: left; + white-space: nowrap; + width: 15%; + } + + .td-todo-gravatar { + width: 5%; + + img { + margin: -3px 0; + } + } + +} + +.todo-comment-text-wrapper { + display: inline-grid; +} + +.todo-comment-text { + margin-left: 5px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .group_members { margin-top: 0; padding: 0; diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -511,15 +511,17 @@ var CommentsController = function() { node = $('comment-current') } } + $wrapper = $(node).closest('div.comment'); - $comment = $(node).closest(klass); - $comments = $(klass); // show hidden comment when referenced. if (!$wrapper.is(':visible')){ $wrapper.show(); } + $comment = $(node).closest(klass); + $comments = $(klass); + $('.comment-selected').removeClass('comment-selected'); var nextIdx = $(klass).index($comment) + offset; @@ -629,7 +631,7 @@ var CommentsController = function() { var cm = commentForm.getCmInstance(); if (resolvesCommentId){ - var placeholderText = _gettext('Leave a comment, or click resolve button to resolve TODO comment #{0}').format(resolvesCommentId); + var placeholderText = _gettext('Leave a resolution comment, or click resolve button to resolve TODO comment #{0}').format(resolvesCommentId); } setTimeout(function() { diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -198,7 +198,7 @@ -<%def name="gravatar(email, size=16, tooltip=False, tooltip_alt=None, user=None)"> +<%def name="gravatar(email, size=16, tooltip=False, tooltip_alt=None, user=None, extra_class=None)"> <% if size > 16: gravatar_class = ['gravatar','gravatar-large'] @@ -210,7 +210,8 @@ if tooltip: gravatar_class += ['tooltip-hovercard'] - + if extra_class: + gravatar_class += extra_class if tooltip and user: if user.username == h.DEFAULT_USER: gravatar_class.pop(-1) diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -50,7 +50,10 @@ return '%s_%s_%i' % (h.md5_safe(commit+f inline_comments=None, # additional menu for PRs - pull_request_menu=None + pull_request_menu=None, + + # show/hide todo next to comments + show_todos=True, )"> @@ -128,12 +131,12 @@ return '%s_%s_%i' % (h.md5_safe(commit+f ## todos - % if getattr(c, 'at_version', None): + % if show_todos and getattr(c, 'at_version', None):
TODOs: ${_('not available in this view')}
- % else: + % elif show_todos:
% if hasattr(c, 'unresolved_comments') and hasattr(c, 'resolved_comments'): @@ -310,7 +313,7 @@ return '%s_%s_%i' % (h.md5_safe(commit+f
- ${_('Unmatched inline comments below')} + ${_('Unmatched/outdated inline comments below')}
@@ -329,13 +332,13 @@ return '%s_%s_%i' % (h.md5_safe(commit+f
- ${_('Unmatched inline comments below')} + ${_('Unmatched/outdated inline comments below')}
- ${_('Unmatched comments below')} + ${_('Unmatched/outdated comments below')}
diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -59,19 +59,22 @@
%if c.allowed_to_update: -
- % if c.allowed_to_delete: - ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)} - ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'), - class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")} - ${h.end_form()} - % else: - ${_('Delete')} - % endif +
+ + +
${_('Edit')}
+
-
${_('Edit')}
- - + %endif
@@ -266,7 +269,7 @@ % else: -
+
${_('Pull request versions not available')}.
% endif @@ -350,20 +353,82 @@ %endif
-## ## TODOs will be listed here -##
-##
-## ${_('TODOs')} -##
-##
-##
-##
    -##
  • -## XXXX -##
  • -##
-##
-##
+ ## TODOs will be listed here +
+
+ ## Only show unresolved, that is only what matters + TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))} + + % if not c.at_version: + % if c.resolved_comments: + Show resolved + % else: + Show resolved + % endif + % endif +
+
+
+ + + <% + 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(resolved, user_id, str(entry.comment_id).zfill(100)) + %> + + % if c.at_version: + + + + % else: + % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter): + <% resolved = todo_comment.resolved %> + % if inline: + <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> + % else: + <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %> + % endif + + + + + + + + + % endfor + + % if len(c.unresolved_comments) == 0: + + + + % endif + + % endif + +
${_('unresolved TODOs unavailable in this view')}.
+ % if resolved: + + % else: + + % endif + + ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])} + +
+ ${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')} +
+
${_('No unresolved TODOs')}.
+ +
+ @@ -561,7 +626,7 @@ disable_new_comments=True, deleted_files_comments=c.deleted_files_comments, inline_comments=c.inline_comments, - pull_request_menu=pr_menu_data)} + pull_request_menu=pr_menu_data, show_todos=False)} % endfor % else: ${cbdiffs.render_diffset( @@ -570,7 +635,7 @@ disable_new_comments=not c.allowed_to_comment, deleted_files_comments=c.deleted_files_comments, inline_comments=c.inline_comments, - pull_request_menu=pr_menu_data)} + pull_request_menu=pr_menu_data, show_todos=False)} % endif