##// END OF EJS Templates
comments: fix scroll to comments that are outdated. Auto-show them on scroll.
marcink -
r1388:bae19fab default
parent child Browse files
Show More
@@ -1,395 +1,395 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 % if inline:
10 % if inline:
11 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
11 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
12 % else:
12 % else:
13 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
13 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
14 % endif
14 % endif
15
15
16
16
17 <div class="comment
17 <div class="comment
18 ${'comment-inline' if inline else 'comment-general'}
18 ${'comment-inline' if inline else 'comment-general'}
19 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
19 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
20 id="comment-${comment.comment_id}"
20 id="comment-${comment.comment_id}"
21 line="${comment.line_no}"
21 line="${comment.line_no}"
22 data-comment-id="${comment.comment_id}"
22 data-comment-id="${comment.comment_id}"
23 data-comment-type="${comment.comment_type}"
23 data-comment-type="${comment.comment_type}"
24 data-comment-inline=${h.json.dumps(inline)}
24 data-comment-inline=${h.json.dumps(inline)}
25 style="${'display: none;' if outdated_at_ver else ''}">
25 style="${'display: none;' if outdated_at_ver else ''}">
26
26
27 <div class="meta">
27 <div class="meta">
28 <div class="comment-type-label">
28 <div class="comment-type-label">
29 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
29 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
30 % if comment.comment_type == 'todo':
30 % if comment.comment_type == 'todo':
31 % if comment.resolved:
31 % if comment.resolved:
32 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
32 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
33 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
33 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
34 </div>
34 </div>
35 % else:
35 % else:
36 <div class="resolved tooltip" style="display: none">
36 <div class="resolved tooltip" style="display: none">
37 <span>${comment.comment_type}</span>
37 <span>${comment.comment_type}</span>
38 </div>
38 </div>
39 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
39 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
40 ${comment.comment_type}
40 ${comment.comment_type}
41 </div>
41 </div>
42 % endif
42 % endif
43 % else:
43 % else:
44 % if comment.resolved_comment:
44 % if comment.resolved_comment:
45 fix
45 fix
46 % else:
46 % else:
47 ${comment.comment_type or 'note'}
47 ${comment.comment_type or 'note'}
48 % endif
48 % endif
49 % endif
49 % endif
50 </div>
50 </div>
51 </div>
51 </div>
52
52
53 <div class="author ${'author-inline' if inline else 'author-general'}">
53 <div class="author ${'author-inline' if inline else 'author-general'}">
54 ${base.gravatar_with_user(comment.author.email, 16)}
54 ${base.gravatar_with_user(comment.author.email, 16)}
55 </div>
55 </div>
56 <div class="date">
56 <div class="date">
57 ${h.age_component(comment.modified_at, time_is_local=True)}
57 ${h.age_component(comment.modified_at, time_is_local=True)}
58 </div>
58 </div>
59 % if inline:
59 % if inline:
60 <span></span>
60 <span></span>
61 % else:
61 % else:
62 <div class="status-change">
62 <div class="status-change">
63 % if comment.pull_request:
63 % if comment.pull_request:
64 <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
64 <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
65 % if comment.status_change:
65 % if comment.status_change:
66 ${_('pull request #%s') % comment.pull_request.pull_request_id}:
66 ${_('pull request #%s') % comment.pull_request.pull_request_id}:
67 % else:
67 % else:
68 ${_('pull request #%s') % comment.pull_request.pull_request_id}
68 ${_('pull request #%s') % comment.pull_request.pull_request_id}
69 % endif
69 % endif
70 </a>
70 </a>
71 % else:
71 % else:
72 % if comment.status_change:
72 % if comment.status_change:
73 ${_('Status change on commit')}:
73 ${_('Status change on commit')}:
74 % endif
74 % endif
75 % endif
75 % endif
76 </div>
76 </div>
77 % endif
77 % endif
78
78
79 % if comment.status_change:
79 % if comment.status_change:
80 <div class="${'flag_status %s' % comment.status_change[0].status}"></div>
80 <div class="${'flag_status %s' % comment.status_change[0].status}"></div>
81 <div title="${_('Commit status')}" class="changeset-status-lbl">
81 <div title="${_('Commit status')}" class="changeset-status-lbl">
82 ${comment.status_change[0].status_lbl}
82 ${comment.status_change[0].status_lbl}
83 </div>
83 </div>
84 % endif
84 % endif
85
85
86 % if comment.resolved_comment:
86 % if comment.resolved_comment:
87 <a class="has-spacer-before" href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'))">
87 <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)})">
88 ${_('resolves comment #{}').format(comment.resolved_comment.comment_id)}
88 ${_('resolves comment #{}').format(comment.resolved_comment.comment_id)}
89 </a>
89 </a>
90 % endif
90 % endif
91
91
92 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
92 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
93
93
94 <div class="comment-links-block">
94 <div class="comment-links-block">
95
95
96 % if inline:
96 % if inline:
97 <div class="pr-version-inline">
97 <div class="pr-version-inline">
98 <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}">
98 <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}">
99 % if outdated_at_ver:
99 % if outdated_at_ver:
100 <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}">
100 <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}">
101 outdated ${'v{}'.format(pr_index_ver)} |
101 outdated ${'v{}'.format(pr_index_ver)} |
102 </code>
102 </code>
103 % elif pr_index_ver:
103 % elif pr_index_ver:
104 <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
104 <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
105 ${'v{}'.format(pr_index_ver)} |
105 ${'v{}'.format(pr_index_ver)} |
106 </code>
106 </code>
107 % endif
107 % endif
108 </a>
108 </a>
109 </div>
109 </div>
110 % else:
110 % else:
111 % if comment.pull_request_version_id and pr_index_ver:
111 % if comment.pull_request_version_id and pr_index_ver:
112 |
112 |
113 <div class="pr-version">
113 <div class="pr-version">
114 % if comment.outdated:
114 % if comment.outdated:
115 <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}">
115 <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}">
116 ${_('Outdated comment from pull request version {}').format(pr_index_ver)}
116 ${_('Outdated comment from pull request version {}').format(pr_index_ver)}
117 </a>
117 </a>
118 % else:
118 % else:
119 <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
119 <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
120 <a href="${h.url('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)}">
120 <a href="${h.url('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)}">
121 <code class="pr-version-num">
121 <code class="pr-version-num">
122 ${'v{}'.format(pr_index_ver)}
122 ${'v{}'.format(pr_index_ver)}
123 </code>
123 </code>
124 </a>
124 </a>
125 </div>
125 </div>
126 % endif
126 % endif
127 </div>
127 </div>
128 % endif
128 % endif
129 % endif
129 % endif
130
130
131 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
131 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
132 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
132 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
133 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
133 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
134 ## permissions to delete
134 ## permissions to delete
135 %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id:
135 %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id:
136 ## TODO: dan: add edit comment here
136 ## TODO: dan: add edit comment here
137 <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a>
137 <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a>
138 %else:
138 %else:
139 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
139 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
140 %endif
140 %endif
141 %else:
141 %else:
142 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
142 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
143 %endif
143 %endif
144
144
145 % if outdated_at_ver:
145 % if outdated_at_ver:
146 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a>
146 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a>
147 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a>
147 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a>
148 % else:
148 % else:
149 | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a>
149 | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a>
150 | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a>
150 | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a>
151 % endif
151 % endif
152
152
153 </div>
153 </div>
154 </div>
154 </div>
155 <div class="text">
155 <div class="text">
156 ${comment.render(mentions=True)|n}
156 ${comment.render(mentions=True)|n}
157 </div>
157 </div>
158
158
159 </div>
159 </div>
160 </%def>
160 </%def>
161
161
162 ## generate main comments
162 ## generate main comments
163 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
163 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
164 <div class="general-comments" id="comments">
164 <div class="general-comments" id="comments">
165 %for comment in comments:
165 %for comment in comments:
166 <div id="comment-tr-${comment.comment_id}">
166 <div id="comment-tr-${comment.comment_id}">
167 ## only render comments that are not from pull request, or from
167 ## only render comments that are not from pull request, or from
168 ## pull request and a status change
168 ## pull request and a status change
169 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
169 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
170 ${comment_block(comment)}
170 ${comment_block(comment)}
171 %endif
171 %endif
172 </div>
172 </div>
173 %endfor
173 %endfor
174 ## to anchor ajax comments
174 ## to anchor ajax comments
175 <div id="injected_page_comments"></div>
175 <div id="injected_page_comments"></div>
176 </div>
176 </div>
177 </%def>
177 </%def>
178
178
179
179
180 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
180 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
181
181
182 <div class="comments">
182 <div class="comments">
183 <%
183 <%
184 if is_pull_request:
184 if is_pull_request:
185 placeholder = _('Leave a comment on this Pull Request.')
185 placeholder = _('Leave a comment on this Pull Request.')
186 elif is_compare:
186 elif is_compare:
187 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
187 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
188 else:
188 else:
189 placeholder = _('Leave a comment on this Commit.')
189 placeholder = _('Leave a comment on this Commit.')
190 %>
190 %>
191
191
192 % if c.rhodecode_user.username != h.DEFAULT_USER:
192 % if c.rhodecode_user.username != h.DEFAULT_USER:
193 <div class="js-template" id="cb-comment-general-form-template">
193 <div class="js-template" id="cb-comment-general-form-template">
194 ## template generated for injection
194 ## template generated for injection
195 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
195 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
196 </div>
196 </div>
197
197
198 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
198 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
199 ## inject form here
199 ## inject form here
200 </div>
200 </div>
201 <script type="text/javascript">
201 <script type="text/javascript">
202 var lineNo = 'general';
202 var lineNo = 'general';
203 var resolvesCommentId = null;
203 var resolvesCommentId = null;
204 var generalCommentForm = Rhodecode.comments.createGeneralComment(
204 var generalCommentForm = Rhodecode.comments.createGeneralComment(
205 lineNo, "${placeholder}", resolvesCommentId);
205 lineNo, "${placeholder}", resolvesCommentId);
206
206
207 // set custom success callback on rangeCommit
207 // set custom success callback on rangeCommit
208 % if is_compare:
208 % if is_compare:
209 generalCommentForm.setHandleFormSubmit(function(o) {
209 generalCommentForm.setHandleFormSubmit(function(o) {
210 var self = generalCommentForm;
210 var self = generalCommentForm;
211
211
212 var text = self.cm.getValue();
212 var text = self.cm.getValue();
213 var status = self.getCommentStatus();
213 var status = self.getCommentStatus();
214 var commentType = self.getCommentType();
214 var commentType = self.getCommentType();
215
215
216 if (text === "" && !status) {
216 if (text === "" && !status) {
217 return;
217 return;
218 }
218 }
219
219
220 // we can pick which commits we want to make the comment by
220 // we can pick which commits we want to make the comment by
221 // selecting them via click on preview pane, this will alter the hidden inputs
221 // selecting them via click on preview pane, this will alter the hidden inputs
222 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
222 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
223
223
224 var commitIds = [];
224 var commitIds = [];
225 $('#changeset_compare_view_content .compare_select').each(function(el) {
225 $('#changeset_compare_view_content .compare_select').each(function(el) {
226 var commitId = this.id.replace('row-', '');
226 var commitId = this.id.replace('row-', '');
227 if ($(this).hasClass('hl') || !cherryPicked) {
227 if ($(this).hasClass('hl') || !cherryPicked) {
228 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
228 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
229 commitIds.push(commitId);
229 commitIds.push(commitId);
230 } else {
230 } else {
231 $("input[data-commit-id='{0}']".format(commitId)).val('')
231 $("input[data-commit-id='{0}']".format(commitId)).val('')
232 }
232 }
233 });
233 });
234
234
235 self.setActionButtonsDisabled(true);
235 self.setActionButtonsDisabled(true);
236 self.cm.setOption("readOnly", true);
236 self.cm.setOption("readOnly", true);
237 var postData = {
237 var postData = {
238 'text': text,
238 'text': text,
239 'changeset_status': status,
239 'changeset_status': status,
240 'comment_type': commentType,
240 'comment_type': commentType,
241 'commit_ids': commitIds,
241 'commit_ids': commitIds,
242 'csrf_token': CSRF_TOKEN
242 'csrf_token': CSRF_TOKEN
243 };
243 };
244
244
245 var submitSuccessCallback = function(o) {
245 var submitSuccessCallback = function(o) {
246 location.reload(true);
246 location.reload(true);
247 };
247 };
248 var submitFailCallback = function(){
248 var submitFailCallback = function(){
249 self.resetCommentFormState(text)
249 self.resetCommentFormState(text)
250 };
250 };
251 self.submitAjaxPOST(
251 self.submitAjaxPOST(
252 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
252 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
253 });
253 });
254 % endif
254 % endif
255
255
256
256
257 </script>
257 </script>
258 % else:
258 % else:
259 ## form state when not logged in
259 ## form state when not logged in
260 <div class="comment-form ac">
260 <div class="comment-form ac">
261
261
262 <div class="comment-area">
262 <div class="comment-area">
263 <div class="comment-area-header">
263 <div class="comment-area-header">
264 <ul class="nav-links clearfix">
264 <ul class="nav-links clearfix">
265 <li class="active">
265 <li class="active">
266 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
266 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
267 </li>
267 </li>
268 <li class="">
268 <li class="">
269 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
269 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
270 </li>
270 </li>
271 </ul>
271 </ul>
272 </div>
272 </div>
273
273
274 <div class="comment-area-write" style="display: block;">
274 <div class="comment-area-write" style="display: block;">
275 <div id="edit-container">
275 <div id="edit-container">
276 <div style="padding: 40px 0">
276 <div style="padding: 40px 0">
277 ${_('You need to be logged in to leave comments.')}
277 ${_('You need to be logged in to leave comments.')}
278 <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
278 <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
279 </div>
279 </div>
280 </div>
280 </div>
281 <div id="preview-container" class="clearfix" style="display: none;">
281 <div id="preview-container" class="clearfix" style="display: none;">
282 <div id="preview-box" class="preview-box"></div>
282 <div id="preview-box" class="preview-box"></div>
283 </div>
283 </div>
284 </div>
284 </div>
285
285
286 <div class="comment-area-footer">
286 <div class="comment-area-footer">
287 <div class="toolbar">
287 <div class="toolbar">
288 <div class="toolbar-text">
288 <div class="toolbar-text">
289 </div>
289 </div>
290 </div>
290 </div>
291 </div>
291 </div>
292 </div>
292 </div>
293
293
294 <div class="comment-footer">
294 <div class="comment-footer">
295 </div>
295 </div>
296
296
297 </div>
297 </div>
298 % endif
298 % endif
299
299
300 <script type="text/javascript">
300 <script type="text/javascript">
301 bindToggleButtons();
301 bindToggleButtons();
302 </script>
302 </script>
303 </div>
303 </div>
304 </%def>
304 </%def>
305
305
306
306
307 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
307 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
308 ## comment injected based on assumption that user is logged in
308 ## comment injected based on assumption that user is logged in
309
309
310 <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET">
310 <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET">
311
311
312 <div class="comment-area">
312 <div class="comment-area">
313 <div class="comment-area-header">
313 <div class="comment-area-header">
314 <ul class="nav-links clearfix">
314 <ul class="nav-links clearfix">
315 <li class="active">
315 <li class="active">
316 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
316 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
317 </li>
317 </li>
318 <li class="">
318 <li class="">
319 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
319 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
320 </li>
320 </li>
321 <li class="pull-right">
321 <li class="pull-right">
322 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
322 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
323 % for val in c.visual.comment_types:
323 % for val in c.visual.comment_types:
324 <option value="${val}">${val.upper()}</option>
324 <option value="${val}">${val.upper()}</option>
325 % endfor
325 % endfor
326 </select>
326 </select>
327 </li>
327 </li>
328 </ul>
328 </ul>
329 </div>
329 </div>
330
330
331 <div class="comment-area-write" style="display: block;">
331 <div class="comment-area-write" style="display: block;">
332 <div id="edit-container_${lineno_id}">
332 <div id="edit-container_${lineno_id}">
333 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
333 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
334 </div>
334 </div>
335 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
335 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
336 <div id="preview-box_${lineno_id}" class="preview-box"></div>
336 <div id="preview-box_${lineno_id}" class="preview-box"></div>
337 </div>
337 </div>
338 </div>
338 </div>
339
339
340 <div class="comment-area-footer">
340 <div class="comment-area-footer">
341 <div class="toolbar">
341 <div class="toolbar">
342 <div class="toolbar-text">
342 <div class="toolbar-text">
343 ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
343 ${(_('Comments parsed using %s syntax with %s, and %s actions support.') % (
344 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
344 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
345 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
345 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')),
346 ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
346 ('<span class="tooltip" title="%s">`/`</span>' % _('Start typing with / for certain actions to be triggered via text box.'))
347 )
347 )
348 )|n}
348 )|n}
349 </div>
349 </div>
350 </div>
350 </div>
351 </div>
351 </div>
352 </div>
352 </div>
353
353
354 <div class="comment-footer">
354 <div class="comment-footer">
355
355
356 % if review_statuses:
356 % if review_statuses:
357 <div class="status_box">
357 <div class="status_box">
358 <select id="change_status_${lineno_id}" name="changeset_status">
358 <select id="change_status_${lineno_id}" name="changeset_status">
359 <option></option> ## Placeholder
359 <option></option> ## Placeholder
360 % for status, lbl in review_statuses:
360 % for status, lbl in review_statuses:
361 <option value="${status}" data-status="${status}">${lbl}</option>
361 <option value="${status}" data-status="${status}">${lbl}</option>
362 %if is_pull_request and change_status and status in ('approved', 'rejected'):
362 %if is_pull_request and change_status and status in ('approved', 'rejected'):
363 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
363 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
364 %endif
364 %endif
365 % endfor
365 % endfor
366 </select>
366 </select>
367 </div>
367 </div>
368 % endif
368 % endif
369
369
370 ## inject extra inputs into the form
370 ## inject extra inputs into the form
371 % if form_extras and isinstance(form_extras, (list, tuple)):
371 % if form_extras and isinstance(form_extras, (list, tuple)):
372 <div id="comment_form_extras">
372 <div id="comment_form_extras">
373 % for form_ex_el in form_extras:
373 % for form_ex_el in form_extras:
374 ${form_ex_el|n}
374 ${form_ex_el|n}
375 % endfor
375 % endfor
376 </div>
376 </div>
377 % endif
377 % endif
378
378
379 <div class="action-buttons">
379 <div class="action-buttons">
380 ## inline for has a file, and line-number together with cancel hide button.
380 ## inline for has a file, and line-number together with cancel hide button.
381 % if form_type == 'inline':
381 % if form_type == 'inline':
382 <input type="hidden" name="f_path" value="{0}">
382 <input type="hidden" name="f_path" value="{0}">
383 <input type="hidden" name="line" value="${lineno_id}">
383 <input type="hidden" name="line" value="${lineno_id}">
384 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
384 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
385 ${_('Cancel')}
385 ${_('Cancel')}
386 </button>
386 </button>
387 % endif
387 % endif
388 ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')}
388 ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')}
389
389
390 </div>
390 </div>
391 </div>
391 </div>
392
392
393 </form>
393 </form>
394
394
395 </%def> No newline at end of file
395 </%def>
@@ -1,50 +1,50 b''
1
1
2 <div class="pull-request-wrap">
2 <div class="pull-request-wrap">
3
3
4
4
5 % if c.pr_merge_possible:
5 % if c.pr_merge_possible:
6 <h2 class="merge-status">
6 <h2 class="merge-status">
7 <span class="merge-icon success"><i class="icon-true"></i></span>
7 <span class="merge-icon success"><i class="icon-true"></i></span>
8 ${_('This pull request can be merged automatically.')}
8 ${_('This pull request can be merged automatically.')}
9 </h2>
9 </h2>
10 % else:
10 % else:
11 <h2 class="merge-status">
11 <h2 class="merge-status">
12 <span class="merge-icon warning"><i class="icon-false"></i></span>
12 <span class="merge-icon warning"><i class="icon-false"></i></span>
13 ${_('Merge is not currently possible because of below failed checks.')}
13 ${_('Merge is not currently possible because of below failed checks.')}
14 </h2>
14 </h2>
15 % endif
15 % endif
16
16
17 <ul>
17 <ul>
18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
19 <% pr_check_type = pr_check_details['error_type'] %>
19 <% pr_check_type = pr_check_details['error_type'] %>
20 <li>
20 <li>
21 <span class="merge-message ${pr_check_type}" data-role="merge-message">
21 <span class="merge-message ${pr_check_type}" data-role="merge-message">
22 - ${pr_check_details['message']}
22 - ${pr_check_details['message']}
23 % if pr_check_key == 'todo':
23 % if pr_check_key == 'todo':
24 % for co in pr_check_details['details']:
24 % for co in pr_check_details['details']:
25 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
25 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'), 0, ${h.json.dumps(co.outdated)})"> #${co.comment_id}</a>${'' if loop.last else ','}
26 % endfor
26 % endfor
27 % endif
27 % endif
28 </span>
28 </span>
29 </li>
29 </li>
30 % endfor
30 % endfor
31 </ul>
31 </ul>
32
32
33 <div class="pull-request-merge-actions">
33 <div class="pull-request-merge-actions">
34 % if c.allowed_to_merge:
34 % if c.allowed_to_merge:
35 <div class="pull-right">
35 <div class="pull-right">
36 ${h.secure_form(url('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form')}
36 ${h.secure_form(url('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form')}
37 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
37 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
38 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
38 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
39 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
39 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
40 ${h.end_form()}
40 ${h.end_form()}
41 </div>
41 </div>
42 % elif c.rhodecode_user.username != h.DEFAULT_USER:
42 % elif c.rhodecode_user.username != h.DEFAULT_USER:
43 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
43 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
44 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
44 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
45 % else:
45 % else:
46 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
46 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
47 % endif
47 % endif
48 </div>
48 </div>
49 </div>
49 </div>
50
50
General Comments 0
You need to be logged in to leave comments. Login now