##// END OF EJS Templates
pull-requests: show more info about version of comment vs latest version.
marcink -
r2809:f9dcd621 default
parent child Browse files
Show More
@@ -1,406 +1,407 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 ## usage:
2 ## usage:
3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
4 ## ${comment.comment_block(comment)}
4 ## ${comment.comment_block(comment)}
5 ##
5 ##
6 <%namespace name="base" file="/base/base.mako"/>
6 <%namespace name="base" file="/base/base.mako"/>
7
7
8 <%def name="comment_block(comment, inline=False)">
8 <%def name="comment_block(comment, inline=False)">
9 <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %>
9 <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %>
10 <% latest_ver = len(getattr(c, 'versions', [])) %>
10 % if inline:
11 % if inline:
11 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
12 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
12 % else:
13 % else:
13 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
14 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
14 % endif
15 % endif
15
16
16
17
17 <div class="comment
18 <div class="comment
18 ${'comment-inline' if inline else 'comment-general'}
19 ${'comment-inline' if inline else 'comment-general'}
19 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
20 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
20 id="comment-${comment.comment_id}"
21 id="comment-${comment.comment_id}"
21 line="${comment.line_no}"
22 line="${comment.line_no}"
22 data-comment-id="${comment.comment_id}"
23 data-comment-id="${comment.comment_id}"
23 data-comment-type="${comment.comment_type}"
24 data-comment-type="${comment.comment_type}"
24 data-comment-line-no="${comment.line_no}"
25 data-comment-line-no="${comment.line_no}"
25 data-comment-inline=${h.json.dumps(inline)}
26 data-comment-inline=${h.json.dumps(inline)}
26 style="${'display: none;' if outdated_at_ver else ''}">
27 style="${'display: none;' if outdated_at_ver else ''}">
27
28
28 <div class="meta">
29 <div class="meta">
29 <div class="comment-type-label">
30 <div class="comment-type-label">
30 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
31 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
31 % if comment.comment_type == 'todo':
32 % if comment.comment_type == 'todo':
32 % if comment.resolved:
33 % if comment.resolved:
33 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
34 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
34 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
35 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
35 </div>
36 </div>
36 % else:
37 % else:
37 <div class="resolved tooltip" style="display: none">
38 <div class="resolved tooltip" style="display: none">
38 <span>${comment.comment_type}</span>
39 <span>${comment.comment_type}</span>
39 </div>
40 </div>
40 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
41 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
41 ${comment.comment_type}
42 ${comment.comment_type}
42 </div>
43 </div>
43 % endif
44 % endif
44 % else:
45 % else:
45 % if comment.resolved_comment:
46 % if comment.resolved_comment:
46 fix
47 fix
47 % else:
48 % else:
48 ${comment.comment_type or 'note'}
49 ${comment.comment_type or 'note'}
49 % endif
50 % endif
50 % endif
51 % endif
51 </div>
52 </div>
52 </div>
53 </div>
53
54
54 <div class="author ${'author-inline' if inline else 'author-general'}">
55 <div class="author ${'author-inline' if inline else 'author-general'}">
55 ${base.gravatar_with_user(comment.author.email, 16)}
56 ${base.gravatar_with_user(comment.author.email, 16)}
56 </div>
57 </div>
57 <div class="date">
58 <div class="date">
58 ${h.age_component(comment.modified_at, time_is_local=True)}
59 ${h.age_component(comment.modified_at, time_is_local=True)}
59 </div>
60 </div>
60 % if inline:
61 % if inline:
61 <span></span>
62 <span></span>
62 % else:
63 % else:
63 <div class="status-change">
64 <div class="status-change">
64 % if comment.pull_request:
65 % if comment.pull_request:
65 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
66 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
66 % if comment.status_change:
67 % if comment.status_change:
67 ${_('pull request #%s') % comment.pull_request.pull_request_id}:
68 ${_('pull request #%s') % comment.pull_request.pull_request_id}:
68 % else:
69 % else:
69 ${_('pull request #%s') % comment.pull_request.pull_request_id}
70 ${_('pull request #%s') % comment.pull_request.pull_request_id}
70 % endif
71 % endif
71 </a>
72 </a>
72 % else:
73 % else:
73 % if comment.status_change:
74 % if comment.status_change:
74 ${_('Status change on commit')}:
75 ${_('Status change on commit')}:
75 % endif
76 % endif
76 % endif
77 % endif
77 </div>
78 </div>
78 % endif
79 % endif
79
80
80 % if comment.status_change:
81 % if comment.status_change:
81 <div class="${'flag_status %s' % comment.status_change[0].status}"></div>
82 <div class="${'flag_status %s' % comment.status_change[0].status}"></div>
82 <div title="${_('Commit status')}" class="changeset-status-lbl">
83 <div title="${_('Commit status')}" class="changeset-status-lbl">
83 ${comment.status_change[0].status_lbl}
84 ${comment.status_change[0].status_lbl}
84 </div>
85 </div>
85 % endif
86 % endif
86
87
87 % if comment.resolved_comment:
88 % if comment.resolved_comment:
88 <a class="has-spacer-before" href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.json.dumps(comment.resolved_comment.outdated)})">
89 <a class="has-spacer-before" href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.json.dumps(comment.resolved_comment.outdated)})">
89 ${_('resolves comment #{}').format(comment.resolved_comment.comment_id)}
90 ${_('resolves comment #{}').format(comment.resolved_comment.comment_id)}
90 </a>
91 </a>
91 % endif
92 % endif
92
93
93 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
94 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
94
95
95 <div class="comment-links-block">
96 <div class="comment-links-block">
96 % if comment.pull_request and comment.pull_request.author.user_id == comment.author.user_id:
97 % if comment.pull_request and comment.pull_request.author.user_id == comment.author.user_id:
97 <span class="tag authortag tooltip" title="${_('Pull request author')}">
98 <span class="tag authortag tooltip" title="${_('Pull request author')}">
98 ${_('author')}
99 ${_('author')}
99 </span>
100 </span>
100 |
101 |
101 % endif
102 % endif
102 % if inline:
103 % if inline:
103 <div class="pr-version-inline">
104 <div class="pr-version-inline">
104 <a href="${request.current_route_path(_query=dict(version=comment.pull_request_version_id), _anchor='comment-{}'.format(comment.comment_id))}">
105 <a href="${request.current_route_path(_query=dict(version=comment.pull_request_version_id), _anchor='comment-{}'.format(comment.comment_id))}">
105 % if outdated_at_ver:
106 % if outdated_at_ver:
106 <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}">
107 <code class="pr-version-num" title="${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
107 outdated ${'v{}'.format(pr_index_ver)} |
108 outdated ${'v{}'.format(pr_index_ver)} |
108 </code>
109 </code>
109 % elif pr_index_ver:
110 % elif pr_index_ver:
110 <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
111 <code class="pr-version-num" title="${_('Comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
111 ${'v{}'.format(pr_index_ver)} |
112 ${'v{}'.format(pr_index_ver)} |
112 </code>
113 </code>
113 % endif
114 % endif
114 </a>
115 </a>
115 </div>
116 </div>
116 % else:
117 % else:
117 % if comment.pull_request_version_id and pr_index_ver:
118 % if comment.pull_request_version_id and pr_index_ver:
118 |
119 |
119 <div class="pr-version">
120 <div class="pr-version">
120 % if comment.outdated:
121 % if comment.outdated:
121 <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}">
122 <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}">
122 ${_('Outdated comment from pull request version {}').format(pr_index_ver)}
123 ${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}
123 </a>
124 </a>
124 % else:
125 % else:
125 <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
126 <div title="${_('Comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)}">
126 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}">
127 <a href="${h.route_path('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}">
127 <code class="pr-version-num">
128 <code class="pr-version-num">
128 ${'v{}'.format(pr_index_ver)}
129 ${'v{}'.format(pr_index_ver)}
129 </code>
130 </code>
130 </a>
131 </a>
131 </div>
132 </div>
132 % endif
133 % endif
133 </div>
134 </div>
134 % endif
135 % endif
135 % endif
136 % endif
136
137
137 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
138 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
138 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
139 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
139 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
140 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
140 ## permissions to delete
141 ## permissions to delete
141 %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id:
142 %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id:
142 ## TODO: dan: add edit comment here
143 ## TODO: dan: add edit comment here
143 <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a>
144 <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a>
144 %else:
145 %else:
145 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
146 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
146 %endif
147 %endif
147 %else:
148 %else:
148 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
149 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
149 %endif
150 %endif
150
151
151 % if outdated_at_ver:
152 % if outdated_at_ver:
152 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a>
153 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a>
153 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a>
154 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a>
154 % else:
155 % else:
155 | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a>
156 | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a>
156 | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a>
157 | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a>
157 % endif
158 % endif
158
159
159 </div>
160 </div>
160 </div>
161 </div>
161 <div class="text">
162 <div class="text">
162 ${h.render(comment.text, renderer=comment.renderer, mentions=True)}
163 ${h.render(comment.text, renderer=comment.renderer, mentions=True)}
163 </div>
164 </div>
164
165
165 </div>
166 </div>
166 </%def>
167 </%def>
167
168
168 ## generate main comments
169 ## generate main comments
169 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
170 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
170 <div class="general-comments" id="comments">
171 <div class="general-comments" id="comments">
171 %for comment in comments:
172 %for comment in comments:
172 <div id="comment-tr-${comment.comment_id}">
173 <div id="comment-tr-${comment.comment_id}">
173 ## only render comments that are not from pull request, or from
174 ## only render comments that are not from pull request, or from
174 ## pull request and a status change
175 ## pull request and a status change
175 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
176 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
176 ${comment_block(comment)}
177 ${comment_block(comment)}
177 %endif
178 %endif
178 </div>
179 </div>
179 %endfor
180 %endfor
180 ## to anchor ajax comments
181 ## to anchor ajax comments
181 <div id="injected_page_comments"></div>
182 <div id="injected_page_comments"></div>
182 </div>
183 </div>
183 </%def>
184 </%def>
184
185
185
186
186 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
187 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
187
188
188 <div class="comments">
189 <div class="comments">
189 <%
190 <%
190 if is_pull_request:
191 if is_pull_request:
191 placeholder = _('Leave a comment on this Pull Request.')
192 placeholder = _('Leave a comment on this Pull Request.')
192 elif is_compare:
193 elif is_compare:
193 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
194 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
194 else:
195 else:
195 placeholder = _('Leave a comment on this Commit.')
196 placeholder = _('Leave a comment on this Commit.')
196 %>
197 %>
197
198
198 % if c.rhodecode_user.username != h.DEFAULT_USER:
199 % if c.rhodecode_user.username != h.DEFAULT_USER:
199 <div class="js-template" id="cb-comment-general-form-template">
200 <div class="js-template" id="cb-comment-general-form-template">
200 ## template generated for injection
201 ## template generated for injection
201 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
202 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
202 </div>
203 </div>
203
204
204 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
205 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
205 ## inject form here
206 ## inject form here
206 </div>
207 </div>
207 <script type="text/javascript">
208 <script type="text/javascript">
208 var lineNo = 'general';
209 var lineNo = 'general';
209 var resolvesCommentId = null;
210 var resolvesCommentId = null;
210 var generalCommentForm = Rhodecode.comments.createGeneralComment(
211 var generalCommentForm = Rhodecode.comments.createGeneralComment(
211 lineNo, "${placeholder}", resolvesCommentId);
212 lineNo, "${placeholder}", resolvesCommentId);
212
213
213 // set custom success callback on rangeCommit
214 // set custom success callback on rangeCommit
214 % if is_compare:
215 % if is_compare:
215 generalCommentForm.setHandleFormSubmit(function(o) {
216 generalCommentForm.setHandleFormSubmit(function(o) {
216 var self = generalCommentForm;
217 var self = generalCommentForm;
217
218
218 var text = self.cm.getValue();
219 var text = self.cm.getValue();
219 var status = self.getCommentStatus();
220 var status = self.getCommentStatus();
220 var commentType = self.getCommentType();
221 var commentType = self.getCommentType();
221
222
222 if (text === "" && !status) {
223 if (text === "" && !status) {
223 return;
224 return;
224 }
225 }
225
226
226 // we can pick which commits we want to make the comment by
227 // we can pick which commits we want to make the comment by
227 // selecting them via click on preview pane, this will alter the hidden inputs
228 // selecting them via click on preview pane, this will alter the hidden inputs
228 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
229 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
229
230
230 var commitIds = [];
231 var commitIds = [];
231 $('#changeset_compare_view_content .compare_select').each(function(el) {
232 $('#changeset_compare_view_content .compare_select').each(function(el) {
232 var commitId = this.id.replace('row-', '');
233 var commitId = this.id.replace('row-', '');
233 if ($(this).hasClass('hl') || !cherryPicked) {
234 if ($(this).hasClass('hl') || !cherryPicked) {
234 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
235 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
235 commitIds.push(commitId);
236 commitIds.push(commitId);
236 } else {
237 } else {
237 $("input[data-commit-id='{0}']".format(commitId)).val('')
238 $("input[data-commit-id='{0}']".format(commitId)).val('')
238 }
239 }
239 });
240 });
240
241
241 self.setActionButtonsDisabled(true);
242 self.setActionButtonsDisabled(true);
242 self.cm.setOption("readOnly", true);
243 self.cm.setOption("readOnly", true);
243 var postData = {
244 var postData = {
244 'text': text,
245 'text': text,
245 'changeset_status': status,
246 'changeset_status': status,
246 'comment_type': commentType,
247 'comment_type': commentType,
247 'commit_ids': commitIds,
248 'commit_ids': commitIds,
248 'csrf_token': CSRF_TOKEN
249 'csrf_token': CSRF_TOKEN
249 };
250 };
250
251
251 var submitSuccessCallback = function(o) {
252 var submitSuccessCallback = function(o) {
252 location.reload(true);
253 location.reload(true);
253 };
254 };
254 var submitFailCallback = function(){
255 var submitFailCallback = function(){
255 self.resetCommentFormState(text)
256 self.resetCommentFormState(text)
256 };
257 };
257 self.submitAjaxPOST(
258 self.submitAjaxPOST(
258 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
259 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
259 });
260 });
260 % endif
261 % endif
261
262
262
263
263 </script>
264 </script>
264 % else:
265 % else:
265 ## form state when not logged in
266 ## form state when not logged in
266 <div class="comment-form ac">
267 <div class="comment-form ac">
267
268
268 <div class="comment-area">
269 <div class="comment-area">
269 <div class="comment-area-header">
270 <div class="comment-area-header">
270 <ul class="nav-links clearfix">
271 <ul class="nav-links clearfix">
271 <li class="active">
272 <li class="active">
272 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
273 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
273 </li>
274 </li>
274 <li class="">
275 <li class="">
275 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
276 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
276 </li>
277 </li>
277 </ul>
278 </ul>
278 </div>
279 </div>
279
280
280 <div class="comment-area-write" style="display: block;">
281 <div class="comment-area-write" style="display: block;">
281 <div id="edit-container">
282 <div id="edit-container">
282 <div style="padding: 40px 0">
283 <div style="padding: 40px 0">
283 ${_('You need to be logged in to leave comments.')}
284 ${_('You need to be logged in to leave comments.')}
284 <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
285 <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
285 </div>
286 </div>
286 </div>
287 </div>
287 <div id="preview-container" class="clearfix" style="display: none;">
288 <div id="preview-container" class="clearfix" style="display: none;">
288 <div id="preview-box" class="preview-box"></div>
289 <div id="preview-box" class="preview-box"></div>
289 </div>
290 </div>
290 </div>
291 </div>
291
292
292 <div class="comment-area-footer">
293 <div class="comment-area-footer">
293 <div class="toolbar">
294 <div class="toolbar">
294 <div class="toolbar-text">
295 <div class="toolbar-text">
295 </div>
296 </div>
296 </div>
297 </div>
297 </div>
298 </div>
298 </div>
299 </div>
299
300
300 <div class="comment-footer">
301 <div class="comment-footer">
301 </div>
302 </div>
302
303
303 </div>
304 </div>
304 % endif
305 % endif
305
306
306 <script type="text/javascript">
307 <script type="text/javascript">
307 bindToggleButtons();
308 bindToggleButtons();
308 </script>
309 </script>
309 </div>
310 </div>
310 </%def>
311 </%def>
311
312
312
313
313 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
314 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
314 ## comment injected based on assumption that user is logged in
315 ## comment injected based on assumption that user is logged in
315
316
316 <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET">
317 <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET">
317
318
318 <div class="comment-area">
319 <div class="comment-area">
319 <div class="comment-area-header">
320 <div class="comment-area-header">
320 <ul class="nav-links clearfix">
321 <ul class="nav-links clearfix">
321 <li class="active">
322 <li class="active">
322 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
323 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
323 </li>
324 </li>
324 <li class="">
325 <li class="">
325 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
326 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
326 </li>
327 </li>
327 <li class="pull-right">
328 <li class="pull-right">
328 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
329 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
329 % for val in c.visual.comment_types:
330 % for val in c.visual.comment_types:
330 <option value="${val}">${val.upper()}</option>
331 <option value="${val}">${val.upper()}</option>
331 % endfor
332 % endfor
332 </select>
333 </select>
333 </li>
334 </li>
334 </ul>
335 </ul>
335 </div>
336 </div>
336
337
337 <div class="comment-area-write" style="display: block;">
338 <div class="comment-area-write" style="display: block;">
338 <div id="edit-container_${lineno_id}">
339 <div id="edit-container_${lineno_id}">
339 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
340 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
340 </div>
341 </div>
341 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
342 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
342 <div id="preview-box_${lineno_id}" class="preview-box"></div>
343 <div id="preview-box_${lineno_id}" class="preview-box"></div>
343 </div>
344 </div>
344 </div>
345 </div>
345
346
346 <div class="comment-area-footer">
347 <div class="comment-area-footer">
347 <div class="toolbar">
348 <div class="toolbar">
348 <div class="toolbar-text">
349 <div class="toolbar-text">
349 ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
350 ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
350 ('<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
351 ('<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
351 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
352 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
352 ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
353 ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
353 )
354 )
354 )|n}
355 )|n}
355 </div>
356 </div>
356 </div>
357 </div>
357 </div>
358 </div>
358 </div>
359 </div>
359
360
360 <div class="comment-footer">
361 <div class="comment-footer">
361
362
362 % if review_statuses:
363 % if review_statuses:
363 <div class="status_box">
364 <div class="status_box">
364 <select id="change_status_${lineno_id}" name="changeset_status">
365 <select id="change_status_${lineno_id}" name="changeset_status">
365 <option></option> ## Placeholder
366 <option></option> ## Placeholder
366 % for status, lbl in review_statuses:
367 % for status, lbl in review_statuses:
367 <option value="${status}" data-status="${status}">${lbl}</option>
368 <option value="${status}" data-status="${status}">${lbl}</option>
368 %if is_pull_request and change_status and status in ('approved', 'rejected'):
369 %if is_pull_request and change_status and status in ('approved', 'rejected'):
369 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
370 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
370 %endif
371 %endif
371 % endfor
372 % endfor
372 </select>
373 </select>
373 </div>
374 </div>
374 % endif
375 % endif
375
376
376 ## inject extra inputs into the form
377 ## inject extra inputs into the form
377 % if form_extras and isinstance(form_extras, (list, tuple)):
378 % if form_extras and isinstance(form_extras, (list, tuple)):
378 <div id="comment_form_extras">
379 <div id="comment_form_extras">
379 % for form_ex_el in form_extras:
380 % for form_ex_el in form_extras:
380 ${form_ex_el|n}
381 ${form_ex_el|n}
381 % endfor
382 % endfor
382 </div>
383 </div>
383 % endif
384 % endif
384
385
385 <div class="action-buttons">
386 <div class="action-buttons">
386 ## inline for has a file, and line-number together with cancel hide button.
387 ## inline for has a file, and line-number together with cancel hide button.
387 % if form_type == 'inline':
388 % if form_type == 'inline':
388 <input type="hidden" name="f_path" value="{0}">
389 <input type="hidden" name="f_path" value="{0}">
389 <input type="hidden" name="line" value="${lineno_id}">
390 <input type="hidden" name="line" value="${lineno_id}">
390 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
391 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
391 ${_('Cancel')}
392 ${_('Cancel')}
392 </button>
393 </button>
393 % endif
394 % endif
394
395
395 % if form_type != 'inline':
396 % if form_type != 'inline':
396 <div class="action-buttons-extra"></div>
397 <div class="action-buttons-extra"></div>
397 % endif
398 % endif
398
399
399 ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')}
400 ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')}
400
401
401 </div>
402 </div>
402 </div>
403 </div>
403
404
404 </form>
405 </form>
405
406
406 </%def> No newline at end of file
407 </%def>
@@ -1,856 +1,856 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
5 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <span id="pr-title">
12 <span id="pr-title">
13 ${c.pull_request.title}
13 ${c.pull_request.title}
14 %if c.pull_request.is_closed():
14 %if c.pull_request.is_closed():
15 (${_('Closed')})
15 (${_('Closed')})
16 %endif
16 %endif
17 </span>
17 </span>
18 <div id="pr-title-edit" class="input" style="display: none;">
18 <div id="pr-title-edit" class="input" style="display: none;">
19 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
19 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
20 </div>
20 </div>
21 </%def>
21 </%def>
22
22
23 <%def name="menu_bar_nav()">
23 <%def name="menu_bar_nav()">
24 ${self.menu_items(active='repositories')}
24 ${self.menu_items(active='repositories')}
25 </%def>
25 </%def>
26
26
27 <%def name="menu_bar_subnav()">
27 <%def name="menu_bar_subnav()">
28 ${self.repo_menu(active='showpullrequest')}
28 ${self.repo_menu(active='showpullrequest')}
29 </%def>
29 </%def>
30
30
31 <%def name="main()">
31 <%def name="main()">
32
32
33 <script type="text/javascript">
33 <script type="text/javascript">
34 // TODO: marcink switch this to pyroutes
34 // TODO: marcink switch this to pyroutes
35 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
35 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
36 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
36 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
37 </script>
37 </script>
38 <div class="box">
38 <div class="box">
39
39
40 <div class="title">
40 <div class="title">
41 ${self.repo_page_title(c.rhodecode_db_repo)}
41 ${self.repo_page_title(c.rhodecode_db_repo)}
42 </div>
42 </div>
43
43
44 ${self.breadcrumbs()}
44 ${self.breadcrumbs()}
45
45
46 <div class="box pr-summary">
46 <div class="box pr-summary">
47
47
48 <div class="summary-details block-left">
48 <div class="summary-details block-left">
49 <% summary = lambda n:{False:'summary-short'}.get(n) %>
49 <% summary = lambda n:{False:'summary-short'}.get(n) %>
50 <div class="pr-details-title">
50 <div class="pr-details-title">
51 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
51 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
52 %if c.allowed_to_update:
52 %if c.allowed_to_update:
53 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
53 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
54 % if c.allowed_to_delete:
54 % if c.allowed_to_delete:
55 ${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)}
55 ${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)}
56 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
56 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
57 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
57 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
58 ${h.end_form()}
58 ${h.end_form()}
59 % else:
59 % else:
60 ${_('Delete')}
60 ${_('Delete')}
61 % endif
61 % endif
62 </div>
62 </div>
63 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
63 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
64 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
64 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
65 %endif
65 %endif
66 </div>
66 </div>
67
67
68 <div id="summary" class="fields pr-details-content">
68 <div id="summary" class="fields pr-details-content">
69 <div class="field">
69 <div class="field">
70 <div class="label-summary">
70 <div class="label-summary">
71 <label>${_('Source')}:</label>
71 <label>${_('Source')}:</label>
72 </div>
72 </div>
73 <div class="input">
73 <div class="input">
74 <div class="pr-origininfo">
74 <div class="pr-origininfo">
75 ## branch link is only valid if it is a branch
75 ## branch link is only valid if it is a branch
76 <span class="tag">
76 <span class="tag">
77 %if c.pull_request.source_ref_parts.type == 'branch':
77 %if c.pull_request.source_ref_parts.type == 'branch':
78 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
78 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
79 %else:
79 %else:
80 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
80 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
81 %endif
81 %endif
82 </span>
82 </span>
83 <span class="clone-url">
83 <span class="clone-url">
84 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
84 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
85 </span>
85 </span>
86 <br/>
86 <br/>
87 % if c.ancestor_commit:
87 % if c.ancestor_commit:
88 ${_('Common ancestor')}:
88 ${_('Common ancestor')}:
89 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
89 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
90 % endif
90 % endif
91 </div>
91 </div>
92 %if h.is_hg(c.pull_request.source_repo):
92 %if h.is_hg(c.pull_request.source_repo):
93 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
93 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
94 %elif h.is_git(c.pull_request.source_repo):
94 %elif h.is_git(c.pull_request.source_repo):
95 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
95 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
96 %endif
96 %endif
97
97
98 <div class="">
98 <div class="">
99 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
99 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
100 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
100 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
101 </div>
101 </div>
102
102
103 </div>
103 </div>
104 </div>
104 </div>
105 <div class="field">
105 <div class="field">
106 <div class="label-summary">
106 <div class="label-summary">
107 <label>${_('Target')}:</label>
107 <label>${_('Target')}:</label>
108 </div>
108 </div>
109 <div class="input">
109 <div class="input">
110 <div class="pr-targetinfo">
110 <div class="pr-targetinfo">
111 ## branch link is only valid if it is a branch
111 ## branch link is only valid if it is a branch
112 <span class="tag">
112 <span class="tag">
113 %if c.pull_request.target_ref_parts.type == 'branch':
113 %if c.pull_request.target_ref_parts.type == 'branch':
114 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
114 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
115 %else:
115 %else:
116 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
116 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
117 %endif
117 %endif
118 </span>
118 </span>
119 <span class="clone-url">
119 <span class="clone-url">
120 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
120 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
121 </span>
121 </span>
122 </div>
122 </div>
123 </div>
123 </div>
124 </div>
124 </div>
125
125
126 ## Link to the shadow repository.
126 ## Link to the shadow repository.
127 <div class="field">
127 <div class="field">
128 <div class="label-summary">
128 <div class="label-summary">
129 <label>${_('Merge')}:</label>
129 <label>${_('Merge')}:</label>
130 </div>
130 </div>
131 <div class="input">
131 <div class="input">
132 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
132 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
133 %if h.is_hg(c.pull_request.target_repo):
133 %if h.is_hg(c.pull_request.target_repo):
134 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
134 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
135 %elif h.is_git(c.pull_request.target_repo):
135 %elif h.is_git(c.pull_request.target_repo):
136 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
136 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
137 %endif
137 %endif
138 <div class="">
138 <div class="">
139 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
139 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
140 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
140 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
141 </div>
141 </div>
142 % else:
142 % else:
143 <div class="">
143 <div class="">
144 ${_('Shadow repository data not available')}.
144 ${_('Shadow repository data not available')}.
145 </div>
145 </div>
146 % endif
146 % endif
147 </div>
147 </div>
148 </div>
148 </div>
149
149
150 <div class="field">
150 <div class="field">
151 <div class="label-summary">
151 <div class="label-summary">
152 <label>${_('Review')}:</label>
152 <label>${_('Review')}:</label>
153 </div>
153 </div>
154 <div class="input">
154 <div class="input">
155 %if c.pull_request_review_status:
155 %if c.pull_request_review_status:
156 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
156 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
157 <span class="changeset-status-lbl tooltip">
157 <span class="changeset-status-lbl tooltip">
158 %if c.pull_request.is_closed():
158 %if c.pull_request.is_closed():
159 ${_('Closed')},
159 ${_('Closed')},
160 %endif
160 %endif
161 ${h.commit_status_lbl(c.pull_request_review_status)}
161 ${h.commit_status_lbl(c.pull_request_review_status)}
162 </span>
162 </span>
163 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
163 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
164 %endif
164 %endif
165 </div>
165 </div>
166 </div>
166 </div>
167 <div class="field">
167 <div class="field">
168 <div class="pr-description-label label-summary">
168 <div class="pr-description-label label-summary">
169 <label>${_('Description')}:</label>
169 <label>${_('Description')}:</label>
170 </div>
170 </div>
171 <div id="pr-desc" class="input">
171 <div id="pr-desc" class="input">
172 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
172 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
173 </div>
173 </div>
174 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
174 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
175 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
175 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
176 </div>
176 </div>
177 </div>
177 </div>
178
178
179 <div class="field">
179 <div class="field">
180 <div class="label-summary">
180 <div class="label-summary">
181 <label>${_('Versions')}:</label>
181 <label>${_('Versions')}:</label>
182 </div>
182 </div>
183
183
184 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
184 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
185 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
185 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
186
186
187 <div class="pr-versions">
187 <div class="pr-versions">
188 % if c.show_version_changes:
188 % if c.show_version_changes:
189 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
189 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
190 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
190 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
191 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
191 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
192 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
192 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
193 data-toggle-off="${_('Hide all versions of this pull request')}">
193 data-toggle-off="${_('Hide all versions of this pull request')}">
194 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
194 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
195 </a>
195 </a>
196 <table>
196 <table>
197 ## SHOW ALL VERSIONS OF PR
197 ## SHOW ALL VERSIONS OF PR
198 <% ver_pr = None %>
198 <% ver_pr = None %>
199
199
200 % for data in reversed(list(enumerate(c.versions, 1))):
200 % for data in reversed(list(enumerate(c.versions, 1))):
201 <% ver_pos = data[0] %>
201 <% ver_pos = data[0] %>
202 <% ver = data[1] %>
202 <% ver = data[1] %>
203 <% ver_pr = ver.pull_request_version_id %>
203 <% ver_pr = ver.pull_request_version_id %>
204 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
204 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
205
205
206 <tr class="version-pr" style="display: ${display_row}">
206 <tr class="version-pr" style="display: ${display_row}">
207 <td>
207 <td>
208 <code>
208 <code>
209 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
209 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
210 </code>
210 </code>
211 </td>
211 </td>
212 <td>
212 <td>
213 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
213 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
214 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
214 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
215 </td>
215 </td>
216 <td>
216 <td>
217 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
217 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
218 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
218 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
219 </div>
219 </div>
220 </td>
220 </td>
221 <td>
221 <td>
222 % if c.at_version_num != ver_pr:
222 % if c.at_version_num != ver_pr:
223 <i class="icon-comment"></i>
223 <i class="icon-comment"></i>
224 <code class="tooltip" title="${_('Comment from pull request version {0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
224 <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
225 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
225 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
226 </code>
226 </code>
227 % endif
227 % endif
228 </td>
228 </td>
229 <td>
229 <td>
230 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
230 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
231 </td>
231 </td>
232 <td>
232 <td>
233 ${h.age_component(ver.updated_on, time_is_local=True)}
233 ${h.age_component(ver.updated_on, time_is_local=True)}
234 </td>
234 </td>
235 </tr>
235 </tr>
236 % endfor
236 % endfor
237
237
238 <tr>
238 <tr>
239 <td colspan="6">
239 <td colspan="6">
240 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
240 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
241 data-label-text-locked="${_('select versions to show changes')}"
241 data-label-text-locked="${_('select versions to show changes')}"
242 data-label-text-diff="${_('show changes between versions')}"
242 data-label-text-diff="${_('show changes between versions')}"
243 data-label-text-show="${_('show pull request for this version')}"
243 data-label-text-show="${_('show pull request for this version')}"
244 >
244 >
245 ${_('select versions to show changes')}
245 ${_('select versions to show changes')}
246 </button>
246 </button>
247 </td>
247 </td>
248 </tr>
248 </tr>
249
249
250 ## show comment/inline comments summary
250 ## show comment/inline comments summary
251 <%def name="comments_summary()">
251 <%def name="comments_summary()">
252 <tr>
252 <tr>
253 <td colspan="6" class="comments-summary-td">
253 <td colspan="6" class="comments-summary-td">
254
254
255 % if c.at_version:
255 % if c.at_version:
256 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
256 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
257 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
257 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
258 ${_('Comments at this version')}:
258 ${_('Comments at this version')}:
259 % else:
259 % else:
260 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
260 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
261 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
261 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
262 ${_('Comments for this pull request')}:
262 ${_('Comments for this pull request')}:
263 % endif
263 % endif
264
264
265
265
266 %if general_comm_count_ver:
266 %if general_comm_count_ver:
267 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
267 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
268 %else:
268 %else:
269 ${_("%d General ") % general_comm_count_ver}
269 ${_("%d General ") % general_comm_count_ver}
270 %endif
270 %endif
271
271
272 %if inline_comm_count_ver:
272 %if inline_comm_count_ver:
273 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
273 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
274 %else:
274 %else:
275 , ${_("%d Inline") % inline_comm_count_ver}
275 , ${_("%d Inline") % inline_comm_count_ver}
276 %endif
276 %endif
277
277
278 %if outdated_comm_count_ver:
278 %if outdated_comm_count_ver:
279 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
279 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
280 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
280 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
281 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
281 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
282 %else:
282 %else:
283 , ${_("%d Outdated") % outdated_comm_count_ver}
283 , ${_("%d Outdated") % outdated_comm_count_ver}
284 %endif
284 %endif
285 </td>
285 </td>
286 </tr>
286 </tr>
287 </%def>
287 </%def>
288 ${comments_summary()}
288 ${comments_summary()}
289 </table>
289 </table>
290 % else:
290 % else:
291 <div class="input">
291 <div class="input">
292 ${_('Pull request versions not available')}.
292 ${_('Pull request versions not available')}.
293 </div>
293 </div>
294 <div>
294 <div>
295 <table>
295 <table>
296 ${comments_summary()}
296 ${comments_summary()}
297 </table>
297 </table>
298 </div>
298 </div>
299 % endif
299 % endif
300 </div>
300 </div>
301 </div>
301 </div>
302
302
303 <div id="pr-save" class="field" style="display: none;">
303 <div id="pr-save" class="field" style="display: none;">
304 <div class="label-summary"></div>
304 <div class="label-summary"></div>
305 <div class="input">
305 <div class="input">
306 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
306 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
307 </div>
307 </div>
308 </div>
308 </div>
309 </div>
309 </div>
310 </div>
310 </div>
311 <div>
311 <div>
312 ## AUTHOR
312 ## AUTHOR
313 <div class="reviewers-title block-right">
313 <div class="reviewers-title block-right">
314 <div class="pr-details-title">
314 <div class="pr-details-title">
315 ${_('Author of this pull request')}
315 ${_('Author of this pull request')}
316 </div>
316 </div>
317 </div>
317 </div>
318 <div class="block-right pr-details-content reviewers">
318 <div class="block-right pr-details-content reviewers">
319 <ul class="group_members">
319 <ul class="group_members">
320 <li>
320 <li>
321 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
321 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
322 </li>
322 </li>
323 </ul>
323 </ul>
324 </div>
324 </div>
325
325
326 ## REVIEW RULES
326 ## REVIEW RULES
327 <div id="review_rules" style="display: none" class="reviewers-title block-right">
327 <div id="review_rules" style="display: none" class="reviewers-title block-right">
328 <div class="pr-details-title">
328 <div class="pr-details-title">
329 ${_('Reviewer rules')}
329 ${_('Reviewer rules')}
330 %if c.allowed_to_update:
330 %if c.allowed_to_update:
331 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
331 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
332 %endif
332 %endif
333 </div>
333 </div>
334 <div class="pr-reviewer-rules">
334 <div class="pr-reviewer-rules">
335 ## review rules will be appended here, by default reviewers logic
335 ## review rules will be appended here, by default reviewers logic
336 </div>
336 </div>
337 <input id="review_data" type="hidden" name="review_data" value="">
337 <input id="review_data" type="hidden" name="review_data" value="">
338 </div>
338 </div>
339
339
340 ## REVIEWERS
340 ## REVIEWERS
341 <div class="reviewers-title block-right">
341 <div class="reviewers-title block-right">
342 <div class="pr-details-title">
342 <div class="pr-details-title">
343 ${_('Pull request reviewers')}
343 ${_('Pull request reviewers')}
344 %if c.allowed_to_update:
344 %if c.allowed_to_update:
345 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
345 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
346 %endif
346 %endif
347 </div>
347 </div>
348 </div>
348 </div>
349 <div id="reviewers" class="block-right pr-details-content reviewers">
349 <div id="reviewers" class="block-right pr-details-content reviewers">
350
350
351 ## members redering block
351 ## members redering block
352 <input type="hidden" name="__start__" value="review_members:sequence">
352 <input type="hidden" name="__start__" value="review_members:sequence">
353 <ul id="review_members" class="group_members">
353 <ul id="review_members" class="group_members">
354
354
355 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
355 % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers:
356 <script>
356 <script>
357 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
357 var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n};
358 var status = "${(status[0][1].status if status else 'not_reviewed')}";
358 var status = "${(status[0][1].status if status else 'not_reviewed')}";
359 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
359 var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}";
360 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
360 var allowed_to_update = ${h.json.dumps(c.allowed_to_update)};
361
361
362 var entry = renderTemplate('reviewMemberEntry', {
362 var entry = renderTemplate('reviewMemberEntry', {
363 'member': member,
363 'member': member,
364 'mandatory': member.mandatory,
364 'mandatory': member.mandatory,
365 'reasons': member.reasons,
365 'reasons': member.reasons,
366 'allowed_to_update': allowed_to_update,
366 'allowed_to_update': allowed_to_update,
367 'review_status': status,
367 'review_status': status,
368 'review_status_label': status_lbl,
368 'review_status_label': status_lbl,
369 'user_group': member.user_group,
369 'user_group': member.user_group,
370 'create': false
370 'create': false
371 });
371 });
372 $('#review_members').append(entry)
372 $('#review_members').append(entry)
373 </script>
373 </script>
374
374
375 % endfor
375 % endfor
376
376
377 </ul>
377 </ul>
378 <input type="hidden" name="__end__" value="review_members:sequence">
378 <input type="hidden" name="__end__" value="review_members:sequence">
379 ## end members redering block
379 ## end members redering block
380
380
381 %if not c.pull_request.is_closed():
381 %if not c.pull_request.is_closed():
382 <div id="add_reviewer" class="ac" style="display: none;">
382 <div id="add_reviewer" class="ac" style="display: none;">
383 %if c.allowed_to_update:
383 %if c.allowed_to_update:
384 % if not c.forbid_adding_reviewers:
384 % if not c.forbid_adding_reviewers:
385 <div id="add_reviewer_input" class="reviewer_ac">
385 <div id="add_reviewer_input" class="reviewer_ac">
386 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
386 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
387 <div id="reviewers_container"></div>
387 <div id="reviewers_container"></div>
388 </div>
388 </div>
389 % endif
389 % endif
390 <div class="pull-right">
390 <div class="pull-right">
391 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
391 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
392 </div>
392 </div>
393 %endif
393 %endif
394 </div>
394 </div>
395 %endif
395 %endif
396 </div>
396 </div>
397 </div>
397 </div>
398 </div>
398 </div>
399 <div class="box">
399 <div class="box">
400 ##DIFF
400 ##DIFF
401 <div class="table" >
401 <div class="table" >
402 <div id="changeset_compare_view_content">
402 <div id="changeset_compare_view_content">
403 ##CS
403 ##CS
404 % if c.missing_requirements:
404 % if c.missing_requirements:
405 <div class="box">
405 <div class="box">
406 <div class="alert alert-warning">
406 <div class="alert alert-warning">
407 <div>
407 <div>
408 <strong>${_('Missing requirements:')}</strong>
408 <strong>${_('Missing requirements:')}</strong>
409 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
409 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
410 </div>
410 </div>
411 </div>
411 </div>
412 </div>
412 </div>
413 % elif c.missing_commits:
413 % elif c.missing_commits:
414 <div class="box">
414 <div class="box">
415 <div class="alert alert-warning">
415 <div class="alert alert-warning">
416 <div>
416 <div>
417 <strong>${_('Missing commits')}:</strong>
417 <strong>${_('Missing commits')}:</strong>
418 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
418 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
419 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
419 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
420 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
420 ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n}
421 </div>
421 </div>
422 </div>
422 </div>
423 </div>
423 </div>
424 % endif
424 % endif
425
425
426 <div class="compare_view_commits_title">
426 <div class="compare_view_commits_title">
427 % if not c.compare_mode:
427 % if not c.compare_mode:
428
428
429 % if c.at_version_pos:
429 % if c.at_version_pos:
430 <h4>
430 <h4>
431 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
431 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
432 </h4>
432 </h4>
433 % endif
433 % endif
434
434
435 <div class="pull-left">
435 <div class="pull-left">
436 <div class="btn-group">
436 <div class="btn-group">
437 <a
437 <a
438 class="btn"
438 class="btn"
439 href="#"
439 href="#"
440 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
440 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
441 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
441 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
442 </a>
442 </a>
443 <a
443 <a
444 class="btn"
444 class="btn"
445 href="#"
445 href="#"
446 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
446 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
447 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
447 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
448 </a>
448 </a>
449 </div>
449 </div>
450 </div>
450 </div>
451
451
452 <div class="pull-right">
452 <div class="pull-right">
453 % if c.allowed_to_update and not c.pull_request.is_closed():
453 % if c.allowed_to_update and not c.pull_request.is_closed():
454 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
454 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
455 % else:
455 % else:
456 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
456 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
457 % endif
457 % endif
458
458
459 </div>
459 </div>
460 % endif
460 % endif
461 </div>
461 </div>
462
462
463 % if not c.missing_commits:
463 % if not c.missing_commits:
464 % if c.compare_mode:
464 % if c.compare_mode:
465 % if c.at_version:
465 % if c.at_version:
466 <h4>
466 <h4>
467 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
467 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
468 </h4>
468 </h4>
469
469
470 <div class="subtitle-compare">
470 <div class="subtitle-compare">
471 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
471 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
472 </div>
472 </div>
473
473
474 <div class="container">
474 <div class="container">
475 <table class="rctable compare_view_commits">
475 <table class="rctable compare_view_commits">
476 <tr>
476 <tr>
477 <th></th>
477 <th></th>
478 <th>${_('Time')}</th>
478 <th>${_('Time')}</th>
479 <th>${_('Author')}</th>
479 <th>${_('Author')}</th>
480 <th>${_('Commit')}</th>
480 <th>${_('Commit')}</th>
481 <th></th>
481 <th></th>
482 <th>${_('Description')}</th>
482 <th>${_('Description')}</th>
483 </tr>
483 </tr>
484
484
485 % for c_type, commit in c.commit_changes:
485 % for c_type, commit in c.commit_changes:
486 % if c_type in ['a', 'r']:
486 % if c_type in ['a', 'r']:
487 <%
487 <%
488 if c_type == 'a':
488 if c_type == 'a':
489 cc_title = _('Commit added in displayed changes')
489 cc_title = _('Commit added in displayed changes')
490 elif c_type == 'r':
490 elif c_type == 'r':
491 cc_title = _('Commit removed in displayed changes')
491 cc_title = _('Commit removed in displayed changes')
492 else:
492 else:
493 cc_title = ''
493 cc_title = ''
494 %>
494 %>
495 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
495 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
496 <td>
496 <td>
497 <div class="commit-change-indicator color-${c_type}-border">
497 <div class="commit-change-indicator color-${c_type}-border">
498 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
498 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
499 ${c_type.upper()}
499 ${c_type.upper()}
500 </div>
500 </div>
501 </div>
501 </div>
502 </td>
502 </td>
503 <td class="td-time">
503 <td class="td-time">
504 ${h.age_component(commit.date)}
504 ${h.age_component(commit.date)}
505 </td>
505 </td>
506 <td class="td-user">
506 <td class="td-user">
507 ${base.gravatar_with_user(commit.author, 16)}
507 ${base.gravatar_with_user(commit.author, 16)}
508 </td>
508 </td>
509 <td class="td-hash">
509 <td class="td-hash">
510 <code>
510 <code>
511 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
511 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
512 r${commit.revision}:${h.short_id(commit.raw_id)}
512 r${commit.revision}:${h.short_id(commit.raw_id)}
513 </a>
513 </a>
514 ${h.hidden('revisions', commit.raw_id)}
514 ${h.hidden('revisions', commit.raw_id)}
515 </code>
515 </code>
516 </td>
516 </td>
517 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
517 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
518 <div class="show_more_col">
518 <div class="show_more_col">
519 <i class="show_more"></i>
519 <i class="show_more"></i>
520 </div>
520 </div>
521 </td>
521 </td>
522 <td class="mid td-description">
522 <td class="mid td-description">
523 <div class="log-container truncate-wrap">
523 <div class="log-container truncate-wrap">
524 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
524 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
525 ${h.urlify_commit_message(commit.message, c.repo_name)}
525 ${h.urlify_commit_message(commit.message, c.repo_name)}
526 </div>
526 </div>
527 </div>
527 </div>
528 </td>
528 </td>
529 </tr>
529 </tr>
530 % endif
530 % endif
531 % endfor
531 % endfor
532 </table>
532 </table>
533 </div>
533 </div>
534
534
535 <script>
535 <script>
536 $('.expand_commit').on('click',function(e){
536 $('.expand_commit').on('click',function(e){
537 var target_expand = $(this);
537 var target_expand = $(this);
538 var cid = target_expand.data('commitId');
538 var cid = target_expand.data('commitId');
539
539
540 if (target_expand.hasClass('open')){
540 if (target_expand.hasClass('open')){
541 $('#c-'+cid).css({
541 $('#c-'+cid).css({
542 'height': '1.5em',
542 'height': '1.5em',
543 'white-space': 'nowrap',
543 'white-space': 'nowrap',
544 'text-overflow': 'ellipsis',
544 'text-overflow': 'ellipsis',
545 'overflow':'hidden'
545 'overflow':'hidden'
546 });
546 });
547 target_expand.removeClass('open');
547 target_expand.removeClass('open');
548 }
548 }
549 else {
549 else {
550 $('#c-'+cid).css({
550 $('#c-'+cid).css({
551 'height': 'auto',
551 'height': 'auto',
552 'white-space': 'pre-line',
552 'white-space': 'pre-line',
553 'text-overflow': 'initial',
553 'text-overflow': 'initial',
554 'overflow':'visible'
554 'overflow':'visible'
555 });
555 });
556 target_expand.addClass('open');
556 target_expand.addClass('open');
557 }
557 }
558 });
558 });
559 </script>
559 </script>
560
560
561 % endif
561 % endif
562
562
563 % else:
563 % else:
564 <%include file="/compare/compare_commits.mako" />
564 <%include file="/compare/compare_commits.mako" />
565 % endif
565 % endif
566
566
567 <div class="cs_files">
567 <div class="cs_files">
568 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
568 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
569 ${cbdiffs.render_diffset_menu()}
569 ${cbdiffs.render_diffset_menu()}
570 ${cbdiffs.render_diffset(
570 ${cbdiffs.render_diffset(
571 c.diffset, use_comments=True,
571 c.diffset, use_comments=True,
572 collapse_when_files_over=30,
572 collapse_when_files_over=30,
573 disable_new_comments=not c.allowed_to_comment,
573 disable_new_comments=not c.allowed_to_comment,
574 deleted_files_comments=c.deleted_files_comments,
574 deleted_files_comments=c.deleted_files_comments,
575 inline_comments=c.inline_comments)}
575 inline_comments=c.inline_comments)}
576 </div>
576 </div>
577 % else:
577 % else:
578 ## skipping commits we need to clear the view for missing commits
578 ## skipping commits we need to clear the view for missing commits
579 <div style="clear:both;"></div>
579 <div style="clear:both;"></div>
580 % endif
580 % endif
581
581
582 </div>
582 </div>
583 </div>
583 </div>
584
584
585 ## template for inline comment form
585 ## template for inline comment form
586 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
586 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
587
587
588 ## render general comments
588 ## render general comments
589
589
590 <div id="comment-tr-show">
590 <div id="comment-tr-show">
591 <div class="comment">
591 <div class="comment">
592 % if general_outdated_comm_count_ver:
592 % if general_outdated_comm_count_ver:
593 <div class="meta">
593 <div class="meta">
594 % if general_outdated_comm_count_ver == 1:
594 % if general_outdated_comm_count_ver == 1:
595 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
595 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
596 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
596 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
597 % else:
597 % else:
598 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
598 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
599 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
599 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
600 % endif
600 % endif
601 </div>
601 </div>
602 % endif
602 % endif
603 </div>
603 </div>
604 </div>
604 </div>
605
605
606 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
606 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
607
607
608 % if not c.pull_request.is_closed():
608 % if not c.pull_request.is_closed():
609 ## merge status, and merge action
609 ## merge status, and merge action
610 <div class="pull-request-merge">
610 <div class="pull-request-merge">
611 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
611 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
612 </div>
612 </div>
613
613
614 ## main comment form and it status
614 ## main comment form and it status
615 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
615 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
616 pull_request_id=c.pull_request.pull_request_id),
616 pull_request_id=c.pull_request.pull_request_id),
617 c.pull_request_review_status,
617 c.pull_request_review_status,
618 is_pull_request=True, change_status=c.allowed_to_change_status)}
618 is_pull_request=True, change_status=c.allowed_to_change_status)}
619 %endif
619 %endif
620
620
621 <script type="text/javascript">
621 <script type="text/javascript">
622 if (location.hash) {
622 if (location.hash) {
623 var result = splitDelimitedHash(location.hash);
623 var result = splitDelimitedHash(location.hash);
624 var line = $('html').find(result.loc);
624 var line = $('html').find(result.loc);
625 // show hidden comments if we use location.hash
625 // show hidden comments if we use location.hash
626 if (line.hasClass('comment-general')) {
626 if (line.hasClass('comment-general')) {
627 $(line).show();
627 $(line).show();
628 } else if (line.hasClass('comment-inline')) {
628 } else if (line.hasClass('comment-inline')) {
629 $(line).show();
629 $(line).show();
630 var $cb = $(line).closest('.cb');
630 var $cb = $(line).closest('.cb');
631 $cb.removeClass('cb-collapsed')
631 $cb.removeClass('cb-collapsed')
632 }
632 }
633 if (line.length > 0){
633 if (line.length > 0){
634 offsetScroll(line, 70);
634 offsetScroll(line, 70);
635 }
635 }
636 }
636 }
637
637
638 versionController = new VersionController();
638 versionController = new VersionController();
639 versionController.init();
639 versionController.init();
640
640
641 reviewersController = new ReviewersController();
641 reviewersController = new ReviewersController();
642
642
643 $(function(){
643 $(function(){
644
644
645 // custom code mirror
645 // custom code mirror
646 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
646 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
647
647
648 var PRDetails = {
648 var PRDetails = {
649 editButton: $('#open_edit_pullrequest'),
649 editButton: $('#open_edit_pullrequest'),
650 closeButton: $('#close_edit_pullrequest'),
650 closeButton: $('#close_edit_pullrequest'),
651 deleteButton: $('#delete_pullrequest'),
651 deleteButton: $('#delete_pullrequest'),
652 viewFields: $('#pr-desc, #pr-title'),
652 viewFields: $('#pr-desc, #pr-title'),
653 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
653 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
654
654
655 init: function() {
655 init: function() {
656 var that = this;
656 var that = this;
657 this.editButton.on('click', function(e) { that.edit(); });
657 this.editButton.on('click', function(e) { that.edit(); });
658 this.closeButton.on('click', function(e) { that.view(); });
658 this.closeButton.on('click', function(e) { that.view(); });
659 },
659 },
660
660
661 edit: function(event) {
661 edit: function(event) {
662 this.viewFields.hide();
662 this.viewFields.hide();
663 this.editButton.hide();
663 this.editButton.hide();
664 this.deleteButton.hide();
664 this.deleteButton.hide();
665 this.closeButton.show();
665 this.closeButton.show();
666 this.editFields.show();
666 this.editFields.show();
667 codeMirrorInstance.refresh();
667 codeMirrorInstance.refresh();
668 },
668 },
669
669
670 view: function(event) {
670 view: function(event) {
671 this.editButton.show();
671 this.editButton.show();
672 this.deleteButton.show();
672 this.deleteButton.show();
673 this.editFields.hide();
673 this.editFields.hide();
674 this.closeButton.hide();
674 this.closeButton.hide();
675 this.viewFields.show();
675 this.viewFields.show();
676 }
676 }
677 };
677 };
678
678
679 var ReviewersPanel = {
679 var ReviewersPanel = {
680 editButton: $('#open_edit_reviewers'),
680 editButton: $('#open_edit_reviewers'),
681 closeButton: $('#close_edit_reviewers'),
681 closeButton: $('#close_edit_reviewers'),
682 addButton: $('#add_reviewer'),
682 addButton: $('#add_reviewer'),
683 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
683 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'),
684
684
685 init: function() {
685 init: function() {
686 var self = this;
686 var self = this;
687 this.editButton.on('click', function(e) { self.edit(); });
687 this.editButton.on('click', function(e) { self.edit(); });
688 this.closeButton.on('click', function(e) { self.close(); });
688 this.closeButton.on('click', function(e) { self.close(); });
689 },
689 },
690
690
691 edit: function(event) {
691 edit: function(event) {
692 this.editButton.hide();
692 this.editButton.hide();
693 this.closeButton.show();
693 this.closeButton.show();
694 this.addButton.show();
694 this.addButton.show();
695 this.removeButtons.css('visibility', 'visible');
695 this.removeButtons.css('visibility', 'visible');
696 // review rules
696 // review rules
697 reviewersController.loadReviewRules(
697 reviewersController.loadReviewRules(
698 ${c.pull_request.reviewer_data_json | n});
698 ${c.pull_request.reviewer_data_json | n});
699 },
699 },
700
700
701 close: function(event) {
701 close: function(event) {
702 this.editButton.show();
702 this.editButton.show();
703 this.closeButton.hide();
703 this.closeButton.hide();
704 this.addButton.hide();
704 this.addButton.hide();
705 this.removeButtons.css('visibility', 'hidden');
705 this.removeButtons.css('visibility', 'hidden');
706 // hide review rules
706 // hide review rules
707 reviewersController.hideReviewRules()
707 reviewersController.hideReviewRules()
708 }
708 }
709 };
709 };
710
710
711 PRDetails.init();
711 PRDetails.init();
712 ReviewersPanel.init();
712 ReviewersPanel.init();
713
713
714 showOutdated = function(self){
714 showOutdated = function(self){
715 $('.comment-inline.comment-outdated').show();
715 $('.comment-inline.comment-outdated').show();
716 $('.filediff-outdated').show();
716 $('.filediff-outdated').show();
717 $('.showOutdatedComments').hide();
717 $('.showOutdatedComments').hide();
718 $('.hideOutdatedComments').show();
718 $('.hideOutdatedComments').show();
719 };
719 };
720
720
721 hideOutdated = function(self){
721 hideOutdated = function(self){
722 $('.comment-inline.comment-outdated').hide();
722 $('.comment-inline.comment-outdated').hide();
723 $('.filediff-outdated').hide();
723 $('.filediff-outdated').hide();
724 $('.hideOutdatedComments').hide();
724 $('.hideOutdatedComments').hide();
725 $('.showOutdatedComments').show();
725 $('.showOutdatedComments').show();
726 };
726 };
727
727
728 refreshMergeChecks = function(){
728 refreshMergeChecks = function(){
729 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
729 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
730 $('.pull-request-merge').css('opacity', 0.3);
730 $('.pull-request-merge').css('opacity', 0.3);
731 $('.action-buttons-extra').css('opacity', 0.3);
731 $('.action-buttons-extra').css('opacity', 0.3);
732
732
733 $('.pull-request-merge').load(
733 $('.pull-request-merge').load(
734 loadUrl, function() {
734 loadUrl, function() {
735 $('.pull-request-merge').css('opacity', 1);
735 $('.pull-request-merge').css('opacity', 1);
736
736
737 $('.action-buttons-extra').css('opacity', 1);
737 $('.action-buttons-extra').css('opacity', 1);
738 injectCloseAction();
738 injectCloseAction();
739 }
739 }
740 );
740 );
741 };
741 };
742
742
743 injectCloseAction = function() {
743 injectCloseAction = function() {
744 var closeAction = $('#close-pull-request-action').html();
744 var closeAction = $('#close-pull-request-action').html();
745 var $actionButtons = $('.action-buttons-extra');
745 var $actionButtons = $('.action-buttons-extra');
746 // clear the action before
746 // clear the action before
747 $actionButtons.html("");
747 $actionButtons.html("");
748 $actionButtons.html(closeAction);
748 $actionButtons.html(closeAction);
749 };
749 };
750
750
751 closePullRequest = function (status) {
751 closePullRequest = function (status) {
752 // inject closing flag
752 // inject closing flag
753 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
753 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
754 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
754 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
755 $(generalCommentForm.submitForm).submit();
755 $(generalCommentForm.submitForm).submit();
756 };
756 };
757
757
758 $('#show-outdated-comments').on('click', function(e){
758 $('#show-outdated-comments').on('click', function(e){
759 var button = $(this);
759 var button = $(this);
760 var outdated = $('.comment-outdated');
760 var outdated = $('.comment-outdated');
761
761
762 if (button.html() === "(Show)") {
762 if (button.html() === "(Show)") {
763 button.html("(Hide)");
763 button.html("(Hide)");
764 outdated.show();
764 outdated.show();
765 } else {
765 } else {
766 button.html("(Show)");
766 button.html("(Show)");
767 outdated.hide();
767 outdated.hide();
768 }
768 }
769 });
769 });
770
770
771 $('.show-inline-comments').on('change', function(e){
771 $('.show-inline-comments').on('change', function(e){
772 var show = 'none';
772 var show = 'none';
773 var target = e.currentTarget;
773 var target = e.currentTarget;
774 if(target.checked){
774 if(target.checked){
775 show = ''
775 show = ''
776 }
776 }
777 var boxid = $(target).attr('id_for');
777 var boxid = $(target).attr('id_for');
778 var comments = $('#{0} .inline-comments'.format(boxid));
778 var comments = $('#{0} .inline-comments'.format(boxid));
779 var fn_display = function(idx){
779 var fn_display = function(idx){
780 $(this).css('display', show);
780 $(this).css('display', show);
781 };
781 };
782 $(comments).each(fn_display);
782 $(comments).each(fn_display);
783 var btns = $('#{0} .inline-comments-button'.format(boxid));
783 var btns = $('#{0} .inline-comments-button'.format(boxid));
784 $(btns).each(fn_display);
784 $(btns).each(fn_display);
785 });
785 });
786
786
787 $('#merge_pull_request_form').submit(function() {
787 $('#merge_pull_request_form').submit(function() {
788 if (!$('#merge_pull_request').attr('disabled')) {
788 if (!$('#merge_pull_request').attr('disabled')) {
789 $('#merge_pull_request').attr('disabled', 'disabled');
789 $('#merge_pull_request').attr('disabled', 'disabled');
790 }
790 }
791 return true;
791 return true;
792 });
792 });
793
793
794 $('#edit_pull_request').on('click', function(e){
794 $('#edit_pull_request').on('click', function(e){
795 var title = $('#pr-title-input').val();
795 var title = $('#pr-title-input').val();
796 var description = codeMirrorInstance.getValue();
796 var description = codeMirrorInstance.getValue();
797 editPullRequest(
797 editPullRequest(
798 "${c.repo_name}", "${c.pull_request.pull_request_id}",
798 "${c.repo_name}", "${c.pull_request.pull_request_id}",
799 title, description);
799 title, description);
800 });
800 });
801
801
802 $('#update_pull_request').on('click', function(e){
802 $('#update_pull_request').on('click', function(e){
803 $(this).attr('disabled', 'disabled');
803 $(this).attr('disabled', 'disabled');
804 $(this).addClass('disabled');
804 $(this).addClass('disabled');
805 $(this).html(_gettext('Saving...'));
805 $(this).html(_gettext('Saving...'));
806 reviewersController.updateReviewers(
806 reviewersController.updateReviewers(
807 "${c.repo_name}", "${c.pull_request.pull_request_id}");
807 "${c.repo_name}", "${c.pull_request.pull_request_id}");
808 });
808 });
809
809
810 $('#update_commits').on('click', function(e){
810 $('#update_commits').on('click', function(e){
811 var isDisabled = !$(e.currentTarget).attr('disabled');
811 var isDisabled = !$(e.currentTarget).attr('disabled');
812 $(e.currentTarget).attr('disabled', 'disabled');
812 $(e.currentTarget).attr('disabled', 'disabled');
813 $(e.currentTarget).addClass('disabled');
813 $(e.currentTarget).addClass('disabled');
814 $(e.currentTarget).removeClass('btn-primary');
814 $(e.currentTarget).removeClass('btn-primary');
815 $(e.currentTarget).text(_gettext('Updating...'));
815 $(e.currentTarget).text(_gettext('Updating...'));
816 if(isDisabled){
816 if(isDisabled){
817 updateCommits(
817 updateCommits(
818 "${c.repo_name}", "${c.pull_request.pull_request_id}");
818 "${c.repo_name}", "${c.pull_request.pull_request_id}");
819 }
819 }
820 });
820 });
821 // fixing issue with caches on firefox
821 // fixing issue with caches on firefox
822 $('#update_commits').removeAttr("disabled");
822 $('#update_commits').removeAttr("disabled");
823
823
824 $('.show-inline-comments').on('click', function(e){
824 $('.show-inline-comments').on('click', function(e){
825 var boxid = $(this).attr('data-comment-id');
825 var boxid = $(this).attr('data-comment-id');
826 var button = $(this);
826 var button = $(this);
827
827
828 if(button.hasClass("comments-visible")) {
828 if(button.hasClass("comments-visible")) {
829 $('#{0} .inline-comments'.format(boxid)).each(function(index){
829 $('#{0} .inline-comments'.format(boxid)).each(function(index){
830 $(this).hide();
830 $(this).hide();
831 });
831 });
832 button.removeClass("comments-visible");
832 button.removeClass("comments-visible");
833 } else {
833 } else {
834 $('#{0} .inline-comments'.format(boxid)).each(function(index){
834 $('#{0} .inline-comments'.format(boxid)).each(function(index){
835 $(this).show();
835 $(this).show();
836 });
836 });
837 button.addClass("comments-visible");
837 button.addClass("comments-visible");
838 }
838 }
839 });
839 });
840
840
841 // register submit callback on commentForm form to track TODOs
841 // register submit callback on commentForm form to track TODOs
842 window.commentFormGlobalSubmitSuccessCallback = function(){
842 window.commentFormGlobalSubmitSuccessCallback = function(){
843 refreshMergeChecks();
843 refreshMergeChecks();
844 };
844 };
845 // initial injection
845 // initial injection
846 injectCloseAction();
846 injectCloseAction();
847
847
848 ReviewerAutoComplete('#user');
848 ReviewerAutoComplete('#user');
849
849
850 })
850 })
851 </script>
851 </script>
852
852
853 </div>
853 </div>
854 </div>
854 </div>
855
855
856 </%def>
856 </%def>
General Comments 0
You need to be logged in to leave comments. Login now