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