Show More
@@ -198,6 +198,10 b' class ChangesetController(BaseRepoContro' | |||
|
198 | 198 | c.lines_added = 0 |
|
199 | 199 | c.lines_deleted = 0 |
|
200 | 200 | |
|
201 | # auto collapse if we have more than limit | |
|
202 | collapse_limit = diffs.DiffProcessor._collapse_commits_over | |
|
203 | c.collapse_all_commits = len(c.commit_ranges) > collapse_limit | |
|
204 | ||
|
201 | 205 | c.commit_statuses = ChangesetStatus.STATUSES |
|
202 | 206 | c.inline_comments = [] |
|
203 | 207 | c.files = [] |
@@ -79,6 +79,7 b' class CompareController(BaseRepoControll' | |||
|
79 | 79 | def index(self, repo_name): |
|
80 | 80 | c.compare_home = True |
|
81 | 81 | c.commit_ranges = [] |
|
82 | c.collapse_all_commits = False | |
|
82 | 83 | c.diffset = None |
|
83 | 84 | c.limited_diff = False |
|
84 | 85 | source_repo = c.rhodecode_db_repo.repo_name |
@@ -209,6 +210,10 b' class CompareController(BaseRepoControll' | |||
|
209 | 210 | c.statuses = c.rhodecode_db_repo.statuses( |
|
210 | 211 | [x.raw_id for x in c.commit_ranges]) |
|
211 | 212 | |
|
213 | # auto collapse if we have more than limit | |
|
214 | collapse_limit = diffs.DiffProcessor._collapse_commits_over | |
|
215 | c.collapse_all_commits = len(c.commit_ranges) > collapse_limit | |
|
216 | ||
|
212 | 217 | if partial: # for PR ajax commits loader |
|
213 | 218 | if not c.ancestor: |
|
214 | 219 | return '' # cannot merge if there is no ancestor |
@@ -26,7 +26,7 b' import types' | |||
|
26 | 26 | import peppercorn |
|
27 | 27 | import formencode |
|
28 | 28 | import logging |
|
29 | ||
|
29 | import collections | |
|
30 | 30 | |
|
31 | 31 | from webob.exc import HTTPNotFound, HTTPForbidden, HTTPBadRequest |
|
32 | 32 | from pylons import request, tmpl_context as c, url |
@@ -45,7 +45,6 b' from rhodecode.lib.auth import (' | |||
|
45 | 45 | LoginRequired, HasRepoPermissionAnyDecorator, NotAnonymous, |
|
46 | 46 | HasAcceptedRepoType, XHRRequired) |
|
47 | 47 | from rhodecode.lib.channelstream import channelstream_request |
|
48 | from rhodecode.lib.compat import OrderedDict | |
|
49 | 48 | from rhodecode.lib.utils import jsonify |
|
50 | 49 | from rhodecode.lib.utils2 import ( |
|
51 | 50 | safe_int, safe_str, str2bool, safe_unicode) |
@@ -70,7 +69,7 b' class PullrequestsController(BaseRepoCon' | |||
|
70 | 69 | def __before__(self): |
|
71 | 70 | super(PullrequestsController, self).__before__() |
|
72 | 71 | |
|
73 |
def _load_compare_data(self, pull_request, inline_comments |
|
|
72 | def _load_compare_data(self, pull_request, inline_comments): | |
|
74 | 73 | """ |
|
75 | 74 | Load context data needed for generating compare diff |
|
76 | 75 | |
@@ -123,6 +122,10 b' class PullrequestsController(BaseRepoCon' | |||
|
123 | 122 | except RepositoryRequirementError: |
|
124 | 123 | c.missing_requirements = True |
|
125 | 124 | |
|
125 | # auto collapse if we have more than limit | |
|
126 | collapse_limit = diffs.DiffProcessor._collapse_commits_over | |
|
127 | c.collapse_all_commits = len(c.commit_ranges) > collapse_limit | |
|
128 | ||
|
126 | 129 | c.changes = {} |
|
127 | 130 | c.missing_commits = False |
|
128 | 131 | if (c.missing_requirements or |
@@ -135,13 +138,24 b' class PullrequestsController(BaseRepoCon' | |||
|
135 | 138 | diff_processor = diffs.DiffProcessor( |
|
136 | 139 | vcs_diff, format='newdiff', diff_limit=diff_limit, |
|
137 | 140 | file_limit=file_limit, show_full_diff=c.fulldiff) |
|
138 | _parsed = diff_processor.prepare() | |
|
139 | 141 | |
|
140 | commit_changes = OrderedDict() | |
|
141 | 142 | _parsed = diff_processor.prepare() |
|
142 | 143 | c.limited_diff = isinstance(_parsed, diffs.LimitedDiffContainer) |
|
143 | 144 | |
|
144 | _parsed = diff_processor.prepare() | |
|
145 | included_files = {} | |
|
146 | for f in _parsed: | |
|
147 | included_files[f['filename']] = f['stats'] | |
|
148 | ||
|
149 | c.deleted_files = [fname for fname in inline_comments if | |
|
150 | fname not in included_files] | |
|
151 | ||
|
152 | c.deleted_files_comments = collections.defaultdict(dict) | |
|
153 | for fname, per_line_comments in inline_comments.items(): | |
|
154 | if fname in c.deleted_files: | |
|
155 | c.deleted_files_comments[fname]['stats'] = 0 | |
|
156 | c.deleted_files_comments[fname]['comments'] = list() | |
|
157 | for lno, comments in per_line_comments.items(): | |
|
158 | c.deleted_files_comments[fname]['comments'].extend(comments) | |
|
145 | 159 | |
|
146 | 160 | def _node_getter(commit): |
|
147 | 161 | def get_node(fname): |
@@ -159,14 +173,6 b' class PullrequestsController(BaseRepoCon' | |||
|
159 | 173 | comments=inline_comments |
|
160 | 174 | ).render_patchset(_parsed, target_commit.raw_id, source_commit.raw_id) |
|
161 | 175 | |
|
162 | c.included_files = [] | |
|
163 | c.deleted_files = [] | |
|
164 | ||
|
165 | for f in _parsed: | |
|
166 | st = f['stats'] | |
|
167 | fid = h.FID('', f['filename']) | |
|
168 | c.included_files.append(f['filename']) | |
|
169 | ||
|
170 | 176 | def _extract_ordering(self, request): |
|
171 | 177 | column_index = safe_int(request.GET.get('order[0][column]')) |
|
172 | 178 | order_dir = request.GET.get('order[0][dir]', 'desc') |
@@ -802,36 +808,47 b' class PullrequestsController(BaseRepoCon' | |||
|
802 | 808 | c.pr_merge_status = False |
|
803 | 809 | |
|
804 | 810 | # inline comments |
|
805 |
|
|
|
806 | c.rhodecode_db_repo.repo_id, | |
|
807 | pull_request=pull_request_id) | |
|
811 | inline_comments = cc_model.get_inline_comments( | |
|
812 | c.rhodecode_db_repo.repo_id, pull_request=pull_request_id) | |
|
813 | ||
|
814 | _inline_cnt, c.inline_versions = cc_model.get_inline_comments_count( | |
|
815 | inline_comments, version=at_version, include_aggregates=True) | |
|
816 | ||
|
817 | c.at_version_num = at_version if at_version and at_version != 'latest' else None | |
|
818 | is_outdated = lambda co: \ | |
|
819 | not c.at_version_num \ | |
|
820 | or co.pull_request_version_id <= c.at_version_num | |
|
808 | 821 | |
|
809 | c.inline_cnt = cc_model.get_inline_comments_count( | |
|
810 | c.inline_comments, version=at_version) | |
|
811 | ||
|
812 | # load compare data into template context | |
|
813 | enable_comments = not pr_closed | |
|
814 | self._load_compare_data( | |
|
815 | pull_request_at_ver, | |
|
816 | c.inline_comments, enable_comments=enable_comments) | |
|
822 | # inline_comments_until_version | |
|
823 | if c.at_version_num: | |
|
824 | # if we use version, then do not show later comments | |
|
825 | # than current version | |
|
826 | paths = collections.defaultdict(lambda: collections.defaultdict(list)) | |
|
827 | for fname, per_line_comments in inline_comments.iteritems(): | |
|
828 | for lno, comments in per_line_comments.iteritems(): | |
|
829 | for co in comments: | |
|
830 | if co.pull_request_version_id and is_outdated(co): | |
|
831 | paths[co.f_path][co.line_no].append(co) | |
|
832 | inline_comments = paths | |
|
817 | 833 | |
|
818 | 834 | # outdated comments |
|
819 | c.outdated_comments = {} | |
|
820 | 835 | c.outdated_cnt = 0 |
|
821 | ||
|
822 | 836 | if ChangesetCommentsModel.use_outdated_comments(pull_request_latest): |
|
823 |
|
|
|
837 | outdated_comments = cc_model.get_outdated_comments( | |
|
824 | 838 | c.rhodecode_db_repo.repo_id, |
|
825 | 839 | pull_request=pull_request_at_ver) |
|
826 | 840 | |
|
827 | 841 | # Count outdated comments and check for deleted files |
|
828 | for file_name, lines in c.outdated_comments.iteritems(): | |
|
842 | is_outdated = lambda co: \ | |
|
843 | not c.at_version_num \ | |
|
844 | or co.pull_request_version_id < c.at_version_num | |
|
845 | for file_name, lines in outdated_comments.iteritems(): | |
|
829 | 846 | for comments in lines.values(): |
|
830 | comments = [comm for comm in comments | |
|
831 | if comm.outdated_at_version(at_version)] | |
|
847 | comments = [comm for comm in comments if is_outdated(comm)] | |
|
832 | 848 | c.outdated_cnt += len(comments) |
|
833 | if file_name not in c.included_files: | |
|
834 | c.deleted_files.append(file_name) | |
|
849 | ||
|
850 | # load compare data into template context | |
|
851 | self._load_compare_data(pull_request_at_ver, inline_comments) | |
|
835 | 852 | |
|
836 | 853 | # this is a hack to properly display links, when creating PR, the |
|
837 | 854 | # compare view and others uses different notation, and |
@@ -839,9 +856,9 b' class PullrequestsController(BaseRepoCon' | |||
|
839 | 856 | # We need to swap that here to generate it properly on the html side |
|
840 | 857 | c.target_repo = c.source_repo |
|
841 | 858 | |
|
842 | # comments | |
|
843 |
c.comments = cc_model.get_comments( |
|
|
844 | pull_request=pull_request_id) | |
|
859 | # general comments | |
|
860 | c.comments = cc_model.get_comments( | |
|
861 | c.rhodecode_db_repo.repo_id, pull_request=pull_request_id) | |
|
845 | 862 | |
|
846 | 863 | if c.allowed_to_update: |
|
847 | 864 | force_close = ('forced_closed', _('Close Pull Request')) |
@@ -859,7 +876,7 b' class PullrequestsController(BaseRepoCon' | |||
|
859 | 876 | c.changes = None |
|
860 | 877 | c.file_changes = None |
|
861 | 878 | |
|
862 | c.show_version_changes = 1 | |
|
879 | c.show_version_changes = 1 # control flag, not used yet | |
|
863 | 880 | |
|
864 | 881 | if at_version and c.show_version_changes: |
|
865 | 882 | c.changes, c.file_changes = self._get_pr_version_changes( |
@@ -203,6 +203,9 b' class DiffProcessor(object):' | |||
|
203 | 203 | # used for inline highlighter word split |
|
204 | 204 | _token_re = re.compile(r'()(>|<|&|\W+?)') |
|
205 | 205 | |
|
206 | # collapse ranges of commits over given number | |
|
207 | _collapse_commits_over = 5 | |
|
208 | ||
|
206 | 209 | def __init__(self, diff, format='gitdiff', diff_limit=None, |
|
207 | 210 | file_limit=None, show_full_diff=True): |
|
208 | 211 | """ |
@@ -355,13 +355,18 b' class ChangesetCommentsModel(BaseModel):' | |||
|
355 | 355 | return self._group_comments_by_path_and_line_number(q) |
|
356 | 356 | |
|
357 | 357 | def get_inline_comments_count(self, inline_comments, skip_outdated=True, |
|
358 | version=None): | |
|
358 | version=None, include_aggregates=False): | |
|
359 | version_aggregates = collections.defaultdict(list) | |
|
359 | 360 | inline_cnt = 0 |
|
360 | 361 | for fname, per_line_comments in inline_comments.iteritems(): |
|
361 | 362 | for lno, comments in per_line_comments.iteritems(): |
|
362 | inline_cnt += len( | |
|
363 | [comm for comm in comments | |
|
364 |
|
|
|
363 | for comm in comments: | |
|
364 | version_aggregates[comm.pull_request_version_id].append(comm) | |
|
365 | if not comm.outdated_at_version(version) and skip_outdated: | |
|
366 | inline_cnt += 1 | |
|
367 | ||
|
368 | if include_aggregates: | |
|
369 | return inline_cnt, version_aggregates | |
|
365 | 370 | return inline_cnt |
|
366 | 371 | |
|
367 | 372 | def get_outdated_comments(self, repo_id, pull_request): |
@@ -658,24 +658,30 b' input.filediff-collapse-state {' | |||
|
658 | 658 | display: none |
|
659 | 659 | } |
|
660 | 660 | .filediff-collapse-indicator { |
|
661 |
|
|
|
662 | border-color: transparent transparent transparent #ccc; | |
|
661 | width: 0; | |
|
662 | height: 0; | |
|
663 | border-style: solid; | |
|
664 | border-width: 6.5px 0 6.5px 11.3px; | |
|
665 | border-color: transparent transparent transparent #ccc; | |
|
663 | 666 | } |
|
664 | 667 | .filediff-menu { |
|
665 | 668 | display: none; |
|
666 | 669 | } |
|
667 |
margin: |
|
|
670 | margin: 10px 0 0 0; | |
|
668 | 671 | } |
|
669 | 672 | |
|
670 | 673 | &+ .filediff { /* file diff is expanded */ |
|
671 | 674 | .filediff-collapse-indicator { |
|
672 |
|
|
|
675 | width: 0; | |
|
676 | height: 0; | |
|
677 | border-style: solid; | |
|
678 | border-width: 11.3px 6.5px 0 6.5px; | |
|
673 | 679 | border-color: #ccc transparent transparent transparent; |
|
674 | 680 | } |
|
675 | 681 | .filediff-menu { |
|
676 | 682 | display: block; |
|
677 | 683 | } |
|
678 |
margin: |
|
|
684 | margin: 10px 0; | |
|
679 | 685 | &:nth-child(2) { |
|
680 | 686 | margin: 0; |
|
681 | 687 | } |
@@ -775,11 +781,9 b' input.filediff-collapse-state {' | |||
|
775 | 781 | } |
|
776 | 782 | |
|
777 | 783 | .filediff-collapse-indicator { |
|
778 | width: 0; | |
|
779 | height: 0; | |
|
780 | 784 | border-style: solid; |
|
781 | 785 | float: left; |
|
782 |
margin: |
|
|
786 | margin: 4px 0px 0 0; | |
|
783 | 787 | cursor: pointer; |
|
784 | 788 | } |
|
785 | 789 | |
@@ -800,11 +804,12 b' input.filediff-collapse-state {' | |||
|
800 | 804 | |
|
801 | 805 | .filediff-menu { |
|
802 | 806 | float: right; |
|
807 | text-align: right; | |
|
808 | padding: 5px 5px 5px 0px; | |
|
803 | 809 | |
|
804 |
&> a, |
|
|
805 |
|
|
|
806 |
|
|
|
807 | float: left | |
|
810 | &> a, | |
|
811 | &> span { | |
|
812 | padding: 1px; | |
|
808 | 813 | } |
|
809 | 814 | } |
|
810 | 815 | |
@@ -962,6 +967,13 b' input.filediff-collapse-state {' | |||
|
962 | 967 | |
|
963 | 968 | } |
|
964 | 969 | |
|
970 | .filediff-outdated { | |
|
971 | padding: 8px 0; | |
|
972 | ||
|
973 | .filediff-heading { | |
|
974 | opacity: .5; | |
|
975 | } | |
|
976 | } | |
|
965 | 977 | |
|
966 | 978 | table.cb { |
|
967 | 979 | width: 100%; |
@@ -1068,8 +1080,8 b' table.cb {' | |||
|
1068 | 1080 | |
|
1069 | 1081 | &> button.cb-comment-box-opener { |
|
1070 | 1082 | |
|
1071 |
padding: 2px |
|
|
1072 |
margin-left: |
|
|
1083 | padding: 2px 2px 1px 3px; | |
|
1084 | margin-left: -6px; | |
|
1073 | 1085 | margin-top: -1px; |
|
1074 | 1086 | |
|
1075 | 1087 | border-radius: @border-radius; |
@@ -110,7 +110,7 b' ul.simple-list{' | |||
|
110 | 110 | } |
|
111 | 111 | |
|
112 | 112 | .wide-mode-wrapper { |
|
113 |
max-width: |
|
|
113 | max-width:4000px !important; | |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | .wrapper { |
@@ -1623,6 +1623,12 b' BIN_FILENODE = 7' | |||
|
1623 | 1623 | .pull-request-merge span { |
|
1624 | 1624 | margin-right: 10px; |
|
1625 | 1625 | } |
|
1626 | ||
|
1627 | .pr-versions { | |
|
1628 | position: relative; | |
|
1629 | top: 6px; | |
|
1630 | } | |
|
1631 | ||
|
1626 | 1632 | #close_pull_request { |
|
1627 | 1633 | margin-right: 0px; |
|
1628 | 1634 | } |
@@ -445,6 +445,15 b' table.compare_view_commits {' | |||
|
445 | 445 | padding-left: .5em; |
|
446 | 446 | } |
|
447 | 447 | |
|
448 | // special case to not show hover actions on hidden indicator | |
|
449 | tr.compare_select_hidden:hover { | |
|
450 | cursor: inherit; | |
|
451 | ||
|
452 | td { | |
|
453 | background-color: inherit; | |
|
454 | } | |
|
455 | } | |
|
456 | ||
|
448 | 457 | tr:hover { |
|
449 | 458 | cursor: pointer; |
|
450 | 459 | |
@@ -452,6 +461,8 b' table.compare_view_commits {' | |||
|
452 | 461 | background-color: lighten(@alert4,25%); |
|
453 | 462 | } |
|
454 | 463 | } |
|
464 | ||
|
465 | ||
|
455 | 466 | } |
|
456 | 467 | |
|
457 | 468 | .file_history { |
@@ -411,23 +411,26 b' var CommentsController = function() { /*' | |||
|
411 | 411 | return $node.closest('td').attr('data-line-number'); |
|
412 | 412 | }; |
|
413 | 413 | |
|
414 | this.scrollToComment = function(node, offset) { | |
|
414 | this.scrollToComment = function(node, offset, outdated) { | |
|
415 | var outdated = outdated || false; | |
|
416 | var klass = outdated ? 'div.comment-outdated' : 'div.comment-current'; | |
|
417 | ||
|
415 | 418 | if (!node) { |
|
416 | 419 | node = $('.comment-selected'); |
|
417 | 420 | if (!node.length) { |
|
418 | 421 | node = $('comment-current') |
|
419 | 422 | } |
|
420 | 423 | } |
|
421 |
$comment = $(node).closest( |
|
|
422 |
$comments = $( |
|
|
424 | $comment = $(node).closest(klass); | |
|
425 | $comments = $(klass); | |
|
423 | 426 | |
|
424 | 427 | $('.comment-selected').removeClass('comment-selected'); |
|
425 | 428 | |
|
426 |
var nextIdx = $( |
|
|
429 | var nextIdx = $(klass).index($comment) + offset; | |
|
427 | 430 | if (nextIdx >= $comments.length) { |
|
428 | 431 | nextIdx = 0; |
|
429 | 432 | } |
|
430 |
var $next = $( |
|
|
433 | var $next = $(klass).eq(nextIdx); | |
|
431 | 434 | var $cb = $next.closest('.cb'); |
|
432 | 435 | $cb.removeClass('cb-collapsed'); |
|
433 | 436 | |
@@ -446,6 +449,14 b' var CommentsController = function() { /*' | |||
|
446 | 449 | return self.scrollToComment(node, -1); |
|
447 | 450 | }; |
|
448 | 451 | |
|
452 | this.nextOutdatedComment = function(node) { | |
|
453 | return self.scrollToComment(node, 1, true); | |
|
454 | }; | |
|
455 | ||
|
456 | this.prevOutdatedComment = function(node) { | |
|
457 | return self.scrollToComment(node, -1, true); | |
|
458 | }; | |
|
459 | ||
|
449 | 460 | this.deleteComment = function(node) { |
|
450 | 461 | if (!confirm(_gettext('Delete this comment?'))) { |
|
451 | 462 | return false; |
@@ -139,7 +139,7 b'' | |||
|
139 | 139 | <td class="td-comments comments-col"> |
|
140 | 140 | %if c.comments.get(commit.raw_id): |
|
141 | 141 | <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}"> |
|
142 |
<i class="icon-comment |
|
|
142 | <i class="icon-comment"></i> ${len(c.comments[commit.raw_id])} | |
|
143 | 143 | </a> |
|
144 | 144 | %endif |
|
145 | 145 | </td> |
@@ -34,7 +34,7 b'' | |||
|
34 | 34 | <td class="td-comments"> |
|
35 | 35 | %if c.comments.get(cs.raw_id,[]): |
|
36 | 36 | <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.comments[cs.raw_id][0].comment_id)}"> |
|
37 |
<i class="icon-comment |
|
|
37 | <i class="icon-comment"></i> ${len(c.comments[cs.raw_id])} | |
|
38 | 38 | </a> |
|
39 | 39 | %endif |
|
40 | 40 | </td> |
@@ -6,13 +6,15 b'' | |||
|
6 | 6 | <%namespace name="base" file="/base/base.html"/> |
|
7 | 7 | |
|
8 | 8 | <%def name="comment_block(comment, inline=False)"> |
|
9 | <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version', None)) %> | |
|
10 | ||
|
9 | 11 | <div class="comment |
|
10 | 12 | ${'comment-inline' if inline else ''} |
|
11 |
${'comment-outdated' if |
|
|
13 | ${'comment-outdated' if outdated_at_ver else 'comment-current'}" | |
|
12 | 14 | id="comment-${comment.comment_id}" |
|
13 | 15 | line="${comment.line_no}" |
|
14 | 16 | data-comment-id="${comment.comment_id}" |
|
15 |
style="${'display: none;' if |
|
|
17 | style="${'display: none;' if outdated_at_ver else ''}"> | |
|
16 | 18 | |
|
17 | 19 | <div class="meta"> |
|
18 | 20 | <div class="author"> |
@@ -52,12 +54,10 b'' | |||
|
52 | 54 | %endif |
|
53 | 55 | <a class="permalink" href="#comment-${comment.comment_id}"> ¶</a> |
|
54 | 56 | |
|
55 | ||
|
56 | 57 | <div class="comment-links-block"> |
|
57 | ||
|
58 | 58 | ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed |
|
59 | ## only super-admin, repo admin OR comment owner can delete | |
|
60 | %if not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed()): | |
|
59 | ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated | |
|
60 | %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): | |
|
61 | 61 | ## permissions to delete |
|
62 | 62 | %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id: |
|
63 | 63 | ## TODO: dan: add edit comment here |
@@ -68,7 +68,8 b'' | |||
|
68 | 68 | %else: |
|
69 | 69 | <button class="btn-link" disabled="disabled"> ${_('Delete')}</button> |
|
70 | 70 | %endif |
|
71 | %if not comment.outdated_at_version(getattr(c, 'at_version', None)): | |
|
71 | ||
|
72 | %if not outdated_at_ver: | |
|
72 | 73 | | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a> |
|
73 | 74 | | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a> |
|
74 | 75 | %endif |
@@ -40,6 +40,10 b" return h.url('', **new_args)" | |||
|
40 | 40 | # disable new comments |
|
41 | 41 | disable_new_comments=False, |
|
42 | 42 | |
|
43 | # special file-comments that were deleted in previous versions | |
|
44 | # it's used for showing outdated comments for deleted files in a PR | |
|
45 | deleted_files_comments=None | |
|
46 | ||
|
43 | 47 | )"> |
|
44 | 48 | |
|
45 | 49 | %if use_comments: |
@@ -126,7 +130,7 b' collapse_all = len(diffset.files) > coll' | |||
|
126 | 130 | height: 18px; |
|
127 | 131 | opacity: .2; |
|
128 | 132 | z-index: 10; |
|
129 | ## +5 to account for diff action (+/-) | |
|
133 | //## +5 to account for diff action (+/-) | |
|
130 | 134 | left: ${ruler_at_chars + 5}ch; |
|
131 | 135 | </style> |
|
132 | 136 | %endif |
@@ -145,7 +149,7 b' collapse_all = len(diffset.files) > coll' | |||
|
145 | 149 | ${h.age_component(commit.date)} - |
|
146 | 150 | %endif |
|
147 | 151 | %if diffset.limited_diff: |
|
148 | ${_('The requested commit is too big and content was truncated.')} | |
|
152 | ${_('The requested commit is too big and content was truncated.')} | |
|
149 | 153 | |
|
150 | 154 | ${ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}} |
|
151 | 155 | <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a> |
@@ -153,6 +157,14 b' collapse_all = len(diffset.files) > coll' | |||
|
153 | 157 | ${ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', |
|
154 | 158 | '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}} |
|
155 | 159 | %endif |
|
160 | ||
|
161 | <% at_ver = getattr(c, 'at_version_num', None) %> | |
|
162 | % if at_ver: | |
|
163 | <div class="pull-right"> | |
|
164 | ${_('Changes at version %d') % at_ver} | |
|
165 | </div> | |
|
166 | % endif | |
|
167 | ||
|
156 | 168 | </h2> |
|
157 | 169 | </div> |
|
158 | 170 | |
@@ -181,7 +193,7 b' collapse_all = len(diffset.files) > coll' | |||
|
181 | 193 | %if not filediff.hunks: |
|
182 | 194 | %for op_id, op_text in filediff['patch']['stats']['ops'].items(): |
|
183 | 195 | <tr> |
|
184 |
<td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan= |
|
|
196 | <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> | |
|
185 | 197 | %if op_id == DEL_FILENODE: |
|
186 | 198 | ${_('File was deleted')} |
|
187 | 199 | %elif op_id == BIN_FILENODE: |
@@ -193,26 +205,28 b' collapse_all = len(diffset.files) > coll' | |||
|
193 | 205 | </tr> |
|
194 | 206 | %endfor |
|
195 | 207 | %endif |
|
196 | %if over_lines_changed_limit: | |
|
197 | <tr class="cb-warning cb-collapser"> | |
|
198 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> | |
|
199 | ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)} | |
|
200 | <a href="#" class="cb-expand" | |
|
201 | onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')} | |
|
202 | </a> | |
|
203 | <a href="#" class="cb-collapse" | |
|
204 | onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')} | |
|
205 | </a> | |
|
206 | </td> | |
|
207 | </tr> | |
|
208 | %endif | |
|
209 | 208 | %if filediff.patch['is_limited_diff']: |
|
210 | 209 | <tr class="cb-warning cb-collapser"> |
|
211 | 210 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> |
|
212 | 211 | ${_('The requested commit is too big and content was truncated.')} <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a> |
|
213 | 212 | </td> |
|
214 | 213 | </tr> |
|
214 | %else: | |
|
215 | %if over_lines_changed_limit: | |
|
216 | <tr class="cb-warning cb-collapser"> | |
|
217 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> | |
|
218 | ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)} | |
|
219 | <a href="#" class="cb-expand" | |
|
220 | onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')} | |
|
221 | </a> | |
|
222 | <a href="#" class="cb-collapse" | |
|
223 | onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')} | |
|
224 | </a> | |
|
225 | </td> | |
|
226 | </tr> | |
|
227 | %endif | |
|
215 | 228 | %endif |
|
229 | ||
|
216 | 230 | %for hunk in filediff.hunks: |
|
217 | 231 | <tr class="cb-hunk"> |
|
218 | 232 | <td ${c.diffmode == 'unified' and 'colspan=3' or ''}> |
@@ -239,19 +253,82 b' collapse_all = len(diffset.files) > coll' | |||
|
239 | 253 | %endif |
|
240 | 254 | %endfor |
|
241 | 255 | |
|
242 | % for lineno, comments in filediff.left_comments.items(): | |
|
256 | ## outdated comments that do not fit into currently displayed lines | |
|
257 | % for lineno, comments in filediff.left_comments.items(): | |
|
258 | ||
|
259 | %if c.diffmode == 'unified': | |
|
260 | <tr class="cb-line"> | |
|
261 | <td class="cb-data cb-context"></td> | |
|
262 | <td class="cb-lineno cb-context"></td> | |
|
263 | <td class="cb-lineno cb-context"></td> | |
|
264 | <td class="cb-content cb-context"> | |
|
265 | ${inline_comments_container(comments)} | |
|
266 | </td> | |
|
267 | </tr> | |
|
268 | %elif c.diffmode == 'sideside': | |
|
269 | <tr class="cb-line"> | |
|
270 | <td class="cb-data cb-context"></td> | |
|
271 | <td class="cb-lineno cb-context"></td> | |
|
272 | <td class="cb-content cb-context"></td> | |
|
273 | ||
|
274 | <td class="cb-data cb-context"></td> | |
|
275 | <td class="cb-lineno cb-context"></td> | |
|
276 | <td class="cb-content cb-context"> | |
|
277 | ${inline_comments_container(comments)} | |
|
278 | </td> | |
|
279 | </tr> | |
|
280 | %endif | |
|
281 | ||
|
282 | % endfor | |
|
283 | ||
|
284 | </table> | |
|
285 | </div> | |
|
286 | %endfor | |
|
287 | ||
|
288 | ## outdated comments that are made for a file that has been deleted | |
|
289 | % for filename, comments_dict in (deleted_files_comments or {}).items(): | |
|
243 | 290 | |
|
244 | %if c.diffmode == 'unified': | |
|
245 | <tr class="cb-line"> | |
|
246 | <td class="cb-data cb-context"></td> | |
|
247 | <td class="cb-lineno cb-context"></td> | |
|
248 |
< |
|
|
249 |
< |
|
|
250 | ${inline_comments_container(comments)} | |
|
251 |
</ |
|
|
252 |
</ |
|
|
253 | %elif c.diffmode == 'sideside': | |
|
254 | <tr class="cb-line"> | |
|
291 | <div class="filediffs filediff-outdated" style="display: none"> | |
|
292 | <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox"> | |
|
293 | <div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}"> | |
|
294 | <label for="filediff-collapse-${id(filename)}" class="filediff-heading"> | |
|
295 | <div class="filediff-collapse-indicator"></div> | |
|
296 | <span class="pill"> | |
|
297 | ## file was deleted | |
|
298 | <strong>${filename}</strong> | |
|
299 | </span> | |
|
300 | <span class="pill-group" style="float: left"> | |
|
301 | ## file op, doesn't need translation | |
|
302 | <span class="pill" op="removed">removed in this version</span> | |
|
303 | </span> | |
|
304 | <a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">ΒΆ</a> | |
|
305 | <span class="pill-group" style="float: right"> | |
|
306 | <span class="pill" op="deleted">-${comments_dict['stats']}</span> | |
|
307 | </span> | |
|
308 | </label> | |
|
309 | ||
|
310 | <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}"> | |
|
311 | <tr> | |
|
312 | % if c.diffmode == 'unified': | |
|
313 | <td></td> | |
|
314 | %endif | |
|
315 | ||
|
316 | <td></td> | |
|
317 | <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=5'}> | |
|
318 | ${_('File was deleted in this version, and outdated comments were made on it')} | |
|
319 | </td> | |
|
320 | </tr> | |
|
321 | %if c.diffmode == 'unified': | |
|
322 | <tr class="cb-line"> | |
|
323 | <td class="cb-data cb-context"></td> | |
|
324 | <td class="cb-lineno cb-context"></td> | |
|
325 | <td class="cb-lineno cb-context"></td> | |
|
326 | <td class="cb-content cb-context"> | |
|
327 | ${inline_comments_container(comments_dict['comments'])} | |
|
328 | </td> | |
|
329 | </tr> | |
|
330 | %elif c.diffmode == 'sideside': | |
|
331 | <tr class="cb-line"> | |
|
255 | 332 | <td class="cb-data cb-context"></td> |
|
256 | 333 | <td class="cb-lineno cb-context"></td> |
|
257 | 334 | <td class="cb-content cb-context"></td> |
@@ -259,17 +336,15 b' collapse_all = len(diffset.files) > coll' | |||
|
259 | 336 | <td class="cb-data cb-context"></td> |
|
260 | 337 | <td class="cb-lineno cb-context"></td> |
|
261 | 338 | <td class="cb-content cb-context"> |
|
262 | ${inline_comments_container(comments)} | |
|
339 | ${inline_comments_container(comments_dict['comments'])} | |
|
263 | 340 | </td> |
|
264 | </tr> | |
|
265 | %endif | |
|
341 | </tr> | |
|
342 | %endif | |
|
343 | </table> | |
|
344 | </div> | |
|
345 | </div> | |
|
346 | % endfor | |
|
266 | 347 | |
|
267 | % endfor | |
|
268 | ||
|
269 | </table> | |
|
270 | </div> | |
|
271 | %endfor | |
|
272 | </div> | |
|
273 | 348 | </div> |
|
274 | 349 | </%def> |
|
275 | 350 | |
@@ -358,14 +433,14 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
358 | 433 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
359 | 434 | > |
|
360 | 435 | ${_('Show file before')} |
|
361 | </a> | |
|
436 | </a> | | |
|
362 | 437 | %else: |
|
363 | 438 | <span |
|
364 | 439 | class="tooltip" |
|
365 | 440 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
366 | 441 | > |
|
367 | 442 | ${_('Show file before')} |
|
368 | </span> | |
|
443 | </span> | | |
|
369 | 444 | %endif |
|
370 | 445 | %if filediff.patch['operation'] in ['A', 'M']: |
|
371 | 446 | <a |
@@ -374,14 +449,14 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
374 | 449 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
375 | 450 | > |
|
376 | 451 | ${_('Show file after')} |
|
377 | </a> | |
|
452 | </a> | | |
|
378 | 453 | %else: |
|
379 | 454 | <span |
|
380 | 455 | class="tooltip" |
|
381 | 456 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
382 | 457 | > |
|
383 | 458 | ${_('Show file after')} |
|
384 | </span> | |
|
459 | </span> | | |
|
385 | 460 | %endif |
|
386 | 461 | <a |
|
387 | 462 | class="tooltip" |
@@ -389,7 +464,7 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
389 | 464 | href="${h.url('files_diff_home',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path,diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='raw')}" |
|
390 | 465 | > |
|
391 | 466 | ${_('Raw diff')} |
|
392 | </a> | |
|
467 | </a> | | |
|
393 | 468 | <a |
|
394 | 469 | class="tooltip" |
|
395 | 470 | title="${h.tooltip(_('Download diff'))}" |
@@ -397,6 +472,9 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
397 | 472 | > |
|
398 | 473 | ${_('Download diff')} |
|
399 | 474 | </a> |
|
475 | % if use_comments: | |
|
476 | | | |
|
477 | % endif | |
|
400 | 478 | |
|
401 | 479 | ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks) |
|
402 | 480 | %if hasattr(c, 'ignorews_url'): |
@@ -406,7 +484,6 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
406 | 484 | ${c.context_url(request.GET, h.FID('', filediff['patch']['filename']))} |
|
407 | 485 | %endif |
|
408 | 486 | |
|
409 | ||
|
410 | 487 | %if use_comments: |
|
411 | 488 | <a href="#" onclick="return Rhodecode.comments.toggleComments(this);"> |
|
412 | 489 | <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span> |
@@ -424,11 +501,17 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
424 | 501 | ${commentblock.comment_block(comment, inline=True)} |
|
425 | 502 | %endfor |
|
426 | 503 | |
|
427 | <span onclick="return Rhodecode.comments.createComment(this)" | |
|
428 |
|
|
|
429 | style="${'display: none;' if comments and comments[-1].outdated else ''}"> | |
|
504 | % if comments and comments[-1].outdated: | |
|
505 | <span class="btn btn-secondary cb-comment-add-button comment-outdated}" | |
|
506 | style="display: none;}"> | |
|
430 | 507 | ${_('Add another comment')} |
|
431 | 508 | </span> |
|
509 | % else: | |
|
510 | <span onclick="return Rhodecode.comments.createComment(this)" | |
|
511 | class="btn btn-secondary cb-comment-add-button"> | |
|
512 | ${_('Add another comment')} | |
|
513 | </span> | |
|
514 | % endif | |
|
432 | 515 | |
|
433 | 516 | </div> |
|
434 | 517 | </%def> |
@@ -563,10 +646,9 b' from rhodecode.lib.diffs import NEW_FILE' | |||
|
563 | 646 | </%def> |
|
564 | 647 | |
|
565 | 648 | <%def name="render_add_comment_button()"> |
|
566 | <button | |
|
567 | class="btn btn-small btn-primary cb-comment-box-opener" | |
|
568 | onclick="return Rhodecode.comments.createComment(this)" | |
|
569 | ><span>+</span></button> | |
|
649 | <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)"> | |
|
650 | <span><i class="icon-comment"></i></span> | |
|
651 | </button> | |
|
570 | 652 | </%def> |
|
571 | 653 | |
|
572 | 654 | <%def name="render_diffset_menu()"> |
@@ -25,6 +25,7 b'' | |||
|
25 | 25 | <tr id="row-${commit.raw_id}" |
|
26 | 26 | commit_id="${commit.raw_id}" |
|
27 | 27 | class="compare_select" |
|
28 | style="${'display: none' if c.collapse_all_commits else ''}" | |
|
28 | 29 | > |
|
29 | 30 | <td class="td-time"> |
|
30 | 31 | ${h.age_component(commit.date)} |
@@ -63,9 +64,10 b'' | |||
|
63 | 64 | </td> |
|
64 | 65 | </tr> |
|
65 | 66 | %endfor |
|
66 | <tr class="compare_select_hidden" style="display: none"> | |
|
67 | <tr class="compare_select_hidden" style="${'' if c.collapse_all_commits else 'display: none'}"> | |
|
67 | 68 | <td colspan="5"> |
|
68 | ${ungettext('%s commit hidden','%s commits hidden', len(c.commit_ranges)) % len(c.commit_ranges)} | |
|
69 | ${ungettext('%s commit hidden','%s commits hidden', len(c.commit_ranges)) % len(c.commit_ranges)}, | |
|
70 | <a href="#" onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">${ungettext('show it','show them', len(c.commit_ranges))}</a> | |
|
69 | 71 | </td> |
|
70 | 72 | </tr> |
|
71 | 73 | % if not c.commit_ranges: |
@@ -295,7 +295,7 b'' | |||
|
295 | 295 | </%def> |
|
296 | 296 | |
|
297 | 297 | <%def name="pullrequest_comments(comments_nr)"> |
|
298 |
<i class="icon-comment |
|
|
298 | <i class="icon-comment"></i> ${comments_nr} | |
|
299 | 299 | </%def> |
|
300 | 300 | |
|
301 | 301 | <%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)"> |
@@ -278,7 +278,7 b'' | |||
|
278 | 278 | <td>td-comments</td> |
|
279 | 279 | <td>Comments indicator icon.</td> |
|
280 | 280 | <td> |
|
281 |
<i class="icon-comment |
|
|
281 | <i class="icon-comment"></i> 0 | |
|
282 | 282 | </td> |
|
283 | 283 | </tr> |
|
284 | 284 | <tr> |
@@ -58,7 +58,7 b'' | |||
|
58 | 58 | % endif |
|
59 | 59 | </div> |
|
60 | 60 | <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div> |
|
61 |
<div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel |
|
|
61 | <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div> | |
|
62 | 62 | %endif |
|
63 | 63 | </div> |
|
64 | 64 | |
@@ -161,40 +161,6 b'' | |||
|
161 | 161 | <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea> |
|
162 | 162 | </div> |
|
163 | 163 | </div> |
|
164 | <div class="field"> | |
|
165 | <div class="label-summary"> | |
|
166 | <label>${_('Comments')}:</label> | |
|
167 | </div> | |
|
168 | <div class="input"> | |
|
169 | <div> | |
|
170 | <div class="comments-number"> | |
|
171 | %if c.comments: | |
|
172 | <a href="#comments">${ungettext("%d General Comment", "%d General Comments", len(c.comments)) % len(c.comments)}</a>, | |
|
173 | %else: | |
|
174 | ${ungettext("%d General Comment", "%d General Comments", len(c.comments)) % len(c.comments)} | |
|
175 | %endif | |
|
176 | ||
|
177 | %if c.inline_cnt: | |
|
178 | <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a> | |
|
179 | %else: | |
|
180 | ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt} | |
|
181 | %endif | |
|
182 | ||
|
183 | %if c.outdated_cnt: | |
|
184 | , ${ungettext("%d Outdated Comment", "%d Outdated Comments", c.outdated_cnt) % c.outdated_cnt} <span id="show-outdated-comments" class="btn btn-link">${_('(Show)')}</span> | |
|
185 | %endif | |
|
186 | </div> | |
|
187 | </div> | |
|
188 | </div> | |
|
189 | ||
|
190 | </div> | |
|
191 | ||
|
192 | <style> | |
|
193 | .pr-versions { | |
|
194 | position: relative; | |
|
195 | top: 6px; | |
|
196 | } | |
|
197 | </style> | |
|
198 | 164 | |
|
199 | 165 | <div class="field"> |
|
200 | 166 | <div class="label-summary"> |
@@ -204,11 +170,13 b'' | |||
|
204 | 170 | <div class="pr-versions"> |
|
205 | 171 | % if c.show_version_changes: |
|
206 | 172 | <table> |
|
207 | ## current visible version | |
|
208 |
<tr class="version-pr" style="display: ${'' if c.at_version |
|
|
173 | ## CURRENTLY SELECT PR VERSION | |
|
174 | <tr class="version-pr" style="display: ${'' if c.at_version_num is None else 'none'}"> | |
|
209 | 175 | <td> |
|
210 | 176 | % if c.at_version in [None, 'latest']: |
|
211 | 177 | <i class="icon-ok link"></i> |
|
178 | % else: | |
|
179 | <i class="icon-comment"></i> <code>${len(c.inline_versions[None])}</code> | |
|
212 | 180 | % endif |
|
213 | 181 | </td> |
|
214 | 182 | <td> |
@@ -223,57 +191,104 b'' | |||
|
223 | 191 | <td> |
|
224 | 192 | <code>${c.pull_request_latest.source_ref_parts.commit_id[:6]}</code> |
|
225 | 193 | </td> |
|
226 | <td>${_('created')} ${h.age_component(c.pull_request_latest.updated_on)}</td> | |
|
227 | 194 | <td> |
|
228 | % if c.versions and c.at_version in [None, 'latest']: | |
|
229 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('(Show all)')}</span> | |
|
195 | ${_('created')} ${h.age_component(c.pull_request_latest.updated_on)} | |
|
196 | </td> | |
|
197 | <td align="right"> | |
|
198 | % if c.versions and c.at_version_num in [None, 'latest']: | |
|
199 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('Show all versions')}</span> | |
|
230 | 200 | % endif |
|
231 | 201 | </td> |
|
232 | 202 | </tr> |
|
233 | 203 | |
|
204 | ## SHOW ALL VERSIONS OF PR | |
|
205 | <% ver_pr = None %> | |
|
234 | 206 | % for ver in reversed(c.pull_request.versions()): |
|
235 |
< |
|
|
207 | <% ver_pr = ver.pull_request_version_id %> | |
|
208 | <tr class="version-pr" style="display: ${'' if c.at_version == ver_pr else 'none'}"> | |
|
236 | 209 | <td> |
|
237 |
% if c.at_version == ver |
|
|
210 | % if c.at_version == ver_pr: | |
|
238 | 211 | <i class="icon-ok link"></i> |
|
212 | % else: | |
|
213 | <i class="icon-comment"></i> <code>${len(c.inline_versions[ver_pr])}</code> | |
|
239 | 214 | % endif |
|
240 | 215 | </td> |
|
241 | <td><code><a href="${h.url.current(version=ver.pull_request_version_id)}">version ${ver.pull_request_version_id}</a></code></td> | |
|
216 | <td> | |
|
217 | <code><a href="${h.url.current(version=ver_pr)}">version ${ver_pr}</a></code> | |
|
218 | </td> | |
|
242 | 219 | <td> |
|
243 | 220 | <code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
244 | 221 | </td> |
|
245 | <td>${_('created')} ${h.age_component(ver.updated_on)}</td> | |
|
246 | 222 | <td> |
|
247 | % if c.at_version == ver.pull_request_version_id: | |
|
248 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('(Show all)')}</span> | |
|
223 | ${_('created')} ${h.age_component(ver.updated_on)} | |
|
224 | </td> | |
|
225 | <td align="right"> | |
|
226 | % if c.at_version == ver_pr: | |
|
227 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('Show all versions')}</span> | |
|
249 | 228 | % endif |
|
250 | 229 | </td> |
|
251 | 230 | </tr> |
|
252 | 231 | % endfor |
|
253 | </table> | |
|
232 | ||
|
233 | ## show comment/inline comments summary | |
|
234 | <tr> | |
|
235 | <td> | |
|
236 | </td> | |
|
254 | 237 | |
|
255 | % if c.at_version: | |
|
256 | <pre> | |
|
257 | Changed commits: | |
|
258 | * added: ${len(c.changes.added)} | |
|
259 | * removed: ${len(c.changes.removed)} | |
|
238 | <% inline_comm_count_ver = len(c.inline_versions[ver_pr])%> | |
|
239 | <td colspan="4" style="border-top: 1px dashed #dbd9da"> | |
|
240 | ${_('Comments for this version')}: | |
|
241 | %if c.comments: | |
|
242 | <a href="#comments">${_("%d General ") % len(c.comments)}</a> | |
|
243 | %else: | |
|
244 | ${_("%d General ") % len(c.comments)} | |
|
245 | %endif | |
|
246 | ||
|
247 | <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num])%> | |
|
248 | %if inline_comm_count_ver: | |
|
249 | , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a> | |
|
250 | %else: | |
|
251 | , ${_("%d Inline") % inline_comm_count_ver} | |
|
252 | %endif | |
|
260 | 253 | |
|
261 | % if not (c.file_changes.added+c.file_changes.modified+c.file_changes.removed): | |
|
262 | No file changes found | |
|
263 | % else: | |
|
264 | Changed files: | |
|
265 | %for file_name in c.file_changes.added: | |
|
266 | * A <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> | |
|
267 | %endfor | |
|
268 | %for file_name in c.file_changes.modified: | |
|
269 | * M <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> | |
|
270 | %endfor | |
|
271 | %for file_name in c.file_changes.removed: | |
|
272 | * R ${file_name} | |
|
273 | %endfor | |
|
274 | % endif | |
|
254 | %if c.outdated_cnt: | |
|
255 | , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % c.outdated_cnt}</a> | |
|
256 | <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a> | |
|
257 | <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a> | |
|
258 | %else: | |
|
259 | , ${_("%d Outdated") % c.outdated_cnt} | |
|
260 | %endif | |
|
261 | </td> | |
|
262 | </tr> | |
|
263 | ||
|
264 | <tr> | |
|
265 | <td></td> | |
|
266 | <td colspan="4"> | |
|
267 | % if c.at_version: | |
|
268 | <pre> | |
|
269 | Changed commits: | |
|
270 | * added: ${len(c.changes.added)} | |
|
271 | * removed: ${len(c.changes.removed)} | |
|
272 | ||
|
273 | % if not (c.file_changes.added+c.file_changes.modified+c.file_changes.removed): | |
|
274 | No file changes found | |
|
275 | % else: | |
|
276 | Changed files: | |
|
277 | %for file_name in c.file_changes.added: | |
|
278 | * A <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> | |
|
279 | %endfor | |
|
280 | %for file_name in c.file_changes.modified: | |
|
281 | * M <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> | |
|
282 | %endfor | |
|
283 | %for file_name in c.file_changes.removed: | |
|
284 | * R ${file_name} | |
|
285 | %endfor | |
|
286 | % endif | |
|
275 | 287 | </pre> |
|
276 | % endif | |
|
288 | % endif | |
|
289 | </td> | |
|
290 | </tr> | |
|
291 | </table> | |
|
277 | 292 | % else: |
|
278 | 293 | ${_('Pull request versions not available')}. |
|
279 | 294 | % endif |
@@ -423,7 +438,8 b'' | |||
|
423 | 438 | ${cbdiffs.render_diffset( |
|
424 | 439 | c.diffset, use_comments=True, |
|
425 | 440 | collapse_when_files_over=30, |
|
426 |
disable_new_comments=not c.allowed_to_comment |
|
|
441 | disable_new_comments=not c.allowed_to_comment, | |
|
442 | deleted_files_comments=c.deleted_files_comments)} | |
|
427 | 443 | |
|
428 | 444 | </div> |
|
429 | 445 | % endif |
@@ -517,9 +533,25 b'' | |||
|
517 | 533 | PRDetails.init(); |
|
518 | 534 | ReviewersPanel.init(); |
|
519 | 535 | |
|
536 | showOutdated = function(self){ | |
|
537 | $('.comment-outdated').show(); | |
|
538 | $('.filediff-outdated').show(); | |
|
539 | $('.showOutdatedComments').hide(); | |
|
540 | $('.hideOutdatedComments').show(); | |
|
541 | ||
|
542 | }; | |
|
543 | ||
|
544 | hideOutdated = function(self){ | |
|
545 | $('.comment-outdated').hide(); | |
|
546 | $('.filediff-outdated').hide(); | |
|
547 | $('.hideOutdatedComments').hide(); | |
|
548 | $('.showOutdatedComments').show(); | |
|
549 | }; | |
|
550 | ||
|
520 | 551 | $('#show-outdated-comments').on('click', function(e){ |
|
521 | 552 | var button = $(this); |
|
522 | 553 | var outdated = $('.comment-outdated'); |
|
554 | ||
|
523 | 555 | if (button.html() === "(Show)") { |
|
524 | 556 | button.html("(Hide)"); |
|
525 | 557 | outdated.show(); |
General Comments 0
You need to be logged in to leave comments.
Login now