##// END OF EJS Templates
sidebar: introduce tooltips for observers
marcink -
r4515:3f5e9d55 stable
parent child Browse files
Show More
@@ -1,994 +1,999 b''
1 1 <%inherit file="/base/base.mako"/>
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4 4 <%namespace name="sidebar" file="/base/sidebar.mako"/>
5 5
6 6
7 7 <%def name="title()">
8 8 ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)}
9 9 %if c.rhodecode_name:
10 10 &middot; ${h.branding(c.rhodecode_name)}
11 11 %endif
12 12 </%def>
13 13
14 14 <%def name="breadcrumbs_links()">
15 15
16 16 </%def>
17 17
18 18 <%def name="menu_bar_nav()">
19 19 ${self.menu_items(active='repositories')}
20 20 </%def>
21 21
22 22 <%def name="menu_bar_subnav()">
23 23 ${self.repo_menu(active='showpullrequest')}
24 24 </%def>
25 25
26 26
27 27 <%def name="main()">
28 28 ## Container to gather extracted Tickets
29 29 <%
30 30 c.referenced_commit_issues = []
31 31 c.referenced_desc_issues = []
32 32 %>
33 33
34 34 <script type="text/javascript">
35 35 // TODO: marcink switch this to pyroutes
36 36 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__')}";
37 37 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
38 38 templateContext.pull_request_data.pull_request_version = '${request.GET.get('version', '')}';
39 39 </script>
40 40
41 41 <div class="box">
42 42
43 43 <div class="box pr-summary">
44 44
45 45 <div class="summary-details block-left">
46 46 <div id="pr-title">
47 47 % if c.pull_request.is_closed():
48 48 <span class="pr-title-closed-tag tag">${_('Closed')}</span>
49 49 % endif
50 50 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}">
51 51 </div>
52 52 <div id="pr-title-edit" class="input" style="display: none;">
53 53 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
54 54 </div>
55 55
56 56 <% summary = lambda n:{False:'summary-short'}.get(n) %>
57 57 <div class="pr-details-title">
58 58 <div class="pull-left">
59 59 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a>
60 60 ${_('Created on')}
61 61 <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span>
62 62 <span class="pr-details-title-author-pref">${_('by')}</span>
63 63 </div>
64 64
65 65 <div class="pull-left">
66 66 ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)}
67 67 </div>
68 68
69 69 %if c.allowed_to_update:
70 70 <div class="pull-right">
71 71 <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div>
72 72 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
73 73 % if c.allowed_to_delete:
74 74 ${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)}
75 75 <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}"
76 76 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
77 77 type="submit" value="${_('Delete pull request')}">
78 78 ${h.end_form()}
79 79 % else:
80 80 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
81 81 % endif
82 82 </div>
83 83 <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div>
84 84 <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div>
85 85 </div>
86 86
87 87 %endif
88 88 </div>
89 89
90 90 <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}">
91 91 ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name, issues_container=c.referenced_desc_issues)}
92 92 </div>
93 93
94 94 <div id="pr-desc-edit" class="input textarea" style="display: none;">
95 95 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
96 96 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
97 97 </div>
98 98
99 99 <div id="summary" class="fields pr-details-content">
100 100
101 101 ## source
102 102 <div class="field">
103 103 <div class="label-pr-detail">
104 104 <label>${_('Commit flow')}:</label>
105 105 </div>
106 106 <div class="input">
107 107 <div class="pr-commit-flow">
108 108 ## Source
109 109 %if c.pull_request.source_ref_parts.type == 'branch':
110 110 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a>
111 111 %else:
112 112 <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code>
113 113 %endif
114 114 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a>
115 115 &rarr;
116 116 ## Target
117 117 %if c.pull_request.target_ref_parts.type == 'branch':
118 118 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a>
119 119 %else:
120 120 <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code>
121 121 %endif
122 122
123 123 ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a>
124 124
125 125 <a class="source-details-action" href="#expand-source-details" onclick="return toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'>
126 126 <i class="icon-angle-down">more details</i>
127 127 </a>
128 128
129 129 </div>
130 130
131 131 <div class="source-details" style="display: none">
132 132
133 133 <ul>
134 134
135 135 ## common ancestor
136 136 <li>
137 137 ${_('Common ancestor')}:
138 138 % if c.ancestor_commit:
139 139 <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>
140 140 % else:
141 141 ${_('not available')}
142 142 % endif
143 143 </li>
144 144
145 145 ## pull url
146 146 <li>
147 147 %if h.is_hg(c.pull_request.source_repo):
148 148 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
149 149 %elif h.is_git(c.pull_request.source_repo):
150 150 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
151 151 %endif
152 152
153 153 <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
154 154 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
155 155 </li>
156 156
157 157 ## Shadow repo
158 158 <li>
159 159 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
160 160 %if h.is_hg(c.pull_request.target_repo):
161 161 <% 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) %>
162 162 %elif h.is_git(c.pull_request.target_repo):
163 163 <% 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) %>
164 164 %endif
165 165
166 166 <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
167 167 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
168 168
169 169 % else:
170 170 <div class="">
171 171 ${_('Shadow repository data not available')}.
172 172 </div>
173 173 % endif
174 174 </li>
175 175
176 176 </ul>
177 177
178 178 </div>
179 179
180 180 </div>
181 181
182 182 </div>
183 183
184 184 ## versions
185 185 <div class="field">
186 186 <div class="label-pr-detail">
187 187 <label>${_('Versions')}:</label>
188 188 </div>
189 189
190 190 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
191 191 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
192 192
193 193 <div class="pr-versions">
194 194 % if c.show_version_changes:
195 195 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
196 196 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
197 197 ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))}
198 198 <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
199 199 data-toggle-on="${_('show versions')}."
200 200 data-toggle-off="${_('hide versions')}.">
201 201 ${_('show versions')}.
202 202 </a>
203 203 <table>
204 204 ## SHOW ALL VERSIONS OF PR
205 205 <% ver_pr = None %>
206 206
207 207 % for data in reversed(list(enumerate(c.versions, 1))):
208 208 <% ver_pos = data[0] %>
209 209 <% ver = data[1] %>
210 210 <% ver_pr = ver.pull_request_version_id %>
211 211 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
212 212
213 213 <tr class="version-pr" style="display: ${display_row}">
214 214 <td>
215 215 <code>
216 216 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
217 217 </code>
218 218 </td>
219 219 <td>
220 220 <input ${('checked="checked"' if c.from_version_index == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
221 221 <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}"/>
222 222 </td>
223 223 <td>
224 224 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
225 225 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
226 226
227 227 </td>
228 228 <td>
229 229 % if c.at_version_num != ver_pr:
230 230 <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i>
231 231 <code>
232 232 General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])}
233 233 </code>
234 234 % endif
235 235 </td>
236 236 <td>
237 237 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
238 238 </td>
239 239 <td>
240 240 <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code>
241 241 </td>
242 242 </tr>
243 243 % endfor
244 244
245 245 <tr>
246 246 <td colspan="6">
247 247 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
248 248 data-label-text-locked="${_('select versions to show changes')}"
249 249 data-label-text-diff="${_('show changes between versions')}"
250 250 data-label-text-show="${_('show pull request for this version')}"
251 251 >
252 252 ${_('select versions to show changes')}
253 253 </button>
254 254 </td>
255 255 </tr>
256 256 </table>
257 257 % else:
258 258 <div>
259 259 ${_('Pull request versions not available')}.
260 260 </div>
261 261 % endif
262 262 </div>
263 263 </div>
264 264
265 265 </div>
266 266
267 267 </div>
268 268
269 269
270 270 </div>
271 271
272 272 </div>
273 273
274 274 <div class="box">
275 275
276 276 % if c.state_progressing:
277 277
278 278 <h2 style="text-align: center">
279 279 ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span>
280 280
281 281 % if c.is_super_admin:
282 282 <br/>
283 283 If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state.
284 284 % endif
285 285 </h2>
286 286
287 287 % else:
288 288
289 289 ## Diffs rendered here
290 290 <div class="table" >
291 291 <div id="changeset_compare_view_content">
292 292 ##CS
293 293 % if c.missing_requirements:
294 294 <div class="box">
295 295 <div class="alert alert-warning">
296 296 <div>
297 297 <strong>${_('Missing requirements:')}</strong>
298 298 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
299 299 </div>
300 300 </div>
301 301 </div>
302 302 % elif c.missing_commits:
303 303 <div class="box">
304 304 <div class="alert alert-warning">
305 305 <div>
306 306 <strong>${_('Missing commits')}:</strong>
307 307 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}<br/>
308 308 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}<br/>
309 309 ${_('Consider doing a `force update commits` in case you think this is an error.')}
310 310 </div>
311 311 </div>
312 312 </div>
313 313 % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed():
314 314 <div class="box">
315 315 <div class="alert alert-info">
316 316 <div>
317 317 <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong>
318 318 </div>
319 319 </div>
320 320 </div>
321 321 % endif
322 322
323 323 <div class="compare_view_commits_title">
324 324 % if not c.compare_mode:
325 325
326 326 % if c.at_version_index:
327 327 <h4>
328 328 ${_('Showing changes at v{}, commenting is disabled.').format(c.at_version_index)}
329 329 </h4>
330 330 % endif
331 331
332 332 <div class="pull-left">
333 333 <div class="btn-group">
334 334 <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} >
335 335 % if c.collapse_all_commits:
336 336 <i class="icon-plus-squared-alt icon-no-margin"></i>
337 337 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
338 338 % else:
339 339 <i class="icon-minus-squared-alt icon-no-margin"></i>
340 340 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
341 341 % endif
342 342 </a>
343 343 </div>
344 344 </div>
345 345
346 346 <div class="pull-right">
347 347 % if c.allowed_to_update and not c.pull_request.is_closed():
348 348
349 349 <div class="btn-group btn-group-actions">
350 350 <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false">
351 351 ${_('Update commits')}
352 352 </a>
353 353
354 354 <a id="update_commits_switcher" class="tooltip btn btn-primary btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}">
355 355 <i class="icon-down"></i>
356 356 </a>
357 357
358 358 <div class="btn-action-switcher-container right-align" id="update-commits-switcher">
359 359 <ul class="btn-action-switcher" role="menu" style="min-width: 300px;">
360 360 <li>
361 361 <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false">
362 362 ${_('Force update commits')}
363 363 </a>
364 364 <div class="action-help-block">
365 365 ${_('Update commits and force refresh this pull request.')}
366 366 </div>
367 367 </li>
368 368 </ul>
369 369 </div>
370 370 </div>
371 371
372 372 % else:
373 373 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
374 374 % endif
375 375
376 376 </div>
377 377 % endif
378 378 </div>
379 379
380 380 % if not c.missing_commits:
381 381 ## COMPARE RANGE DIFF MODE
382 382 % if c.compare_mode:
383 383 % if c.at_version:
384 384 <h4>
385 385 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_index, ver_to=c.at_version_index if c.at_version_index else 'latest')}:
386 386 </h4>
387 387
388 388 <div class="subtitle-compare">
389 389 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
390 390 </div>
391 391
392 392 <div class="container">
393 393 <table class="rctable compare_view_commits">
394 394 <tr>
395 395 <th></th>
396 396 <th>${_('Time')}</th>
397 397 <th>${_('Author')}</th>
398 398 <th>${_('Commit')}</th>
399 399 <th></th>
400 400 <th>${_('Description')}</th>
401 401 </tr>
402 402
403 403 % for c_type, commit in c.commit_changes:
404 404 % if c_type in ['a', 'r']:
405 405 <%
406 406 if c_type == 'a':
407 407 cc_title = _('Commit added in displayed changes')
408 408 elif c_type == 'r':
409 409 cc_title = _('Commit removed in displayed changes')
410 410 else:
411 411 cc_title = ''
412 412 %>
413 413 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
414 414 <td>
415 415 <div class="commit-change-indicator color-${c_type}-border">
416 416 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
417 417 ${c_type.upper()}
418 418 </div>
419 419 </div>
420 420 </td>
421 421 <td class="td-time">
422 422 ${h.age_component(commit.date)}
423 423 </td>
424 424 <td class="td-user">
425 425 ${base.gravatar_with_user(commit.author, 16, tooltip=True)}
426 426 </td>
427 427 <td class="td-hash">
428 428 <code>
429 429 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
430 430 r${commit.idx}:${h.short_id(commit.raw_id)}
431 431 </a>
432 432 ${h.hidden('revisions', commit.raw_id)}
433 433 </code>
434 434 </td>
435 435 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
436 436 <i class="icon-expand-linked"></i>
437 437 </td>
438 438 <td class="mid td-description">
439 439 <div class="log-container truncate-wrap">
440 440 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name, issues_container=c.referenced_commit_issues)}</div>
441 441 </div>
442 442 </td>
443 443 </tr>
444 444 % endif
445 445 % endfor
446 446 </table>
447 447 </div>
448 448
449 449 % endif
450 450
451 451 ## Regular DIFF
452 452 % else:
453 453 <%include file="/compare/compare_commits.mako" />
454 454 % endif
455 455
456 456 <div class="cs_files">
457 457 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
458 458
459 459 <%
460 460 pr_menu_data = {
461 461 'outdated_comm_count_ver': outdated_comm_count_ver,
462 462 'pull_request': c.pull_request
463 463 }
464 464 %>
465 465
466 466 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on, pull_request_menu=pr_menu_data)}
467 467
468 468 % if c.range_diff_on:
469 469 % for commit in c.commit_ranges:
470 470 ${cbdiffs.render_diffset(
471 471 c.changes[commit.raw_id],
472 472 commit=commit, use_comments=True,
473 473 collapse_when_files_over=5,
474 474 disable_new_comments=True,
475 475 deleted_files_comments=c.deleted_files_comments,
476 476 inline_comments=c.inline_comments,
477 477 pull_request_menu=pr_menu_data, show_todos=False)}
478 478 % endfor
479 479 % else:
480 480 ${cbdiffs.render_diffset(
481 481 c.diffset, use_comments=True,
482 482 collapse_when_files_over=30,
483 483 disable_new_comments=not c.allowed_to_comment,
484 484 deleted_files_comments=c.deleted_files_comments,
485 485 inline_comments=c.inline_comments,
486 486 pull_request_menu=pr_menu_data, show_todos=False)}
487 487 % endif
488 488
489 489 </div>
490 490 % else:
491 491 ## skipping commits we need to clear the view for missing commits
492 492 <div style="clear:both;"></div>
493 493 % endif
494 494
495 495 </div>
496 496 </div>
497 497
498 498 ## template for inline comment form
499 499 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
500 500
501 501 ## comments heading with count
502 502 <div class="comments-heading">
503 503 <i class="icon-comment"></i>
504 504 ${_('General Comments')} ${len(c.comments)}
505 505 </div>
506 506
507 507 ## render general comments
508 508 <div id="comment-tr-show">
509 509 % if general_outdated_comm_count_ver:
510 510 <div class="info-box">
511 511 % if general_outdated_comm_count_ver == 1:
512 512 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
513 513 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
514 514 % else:
515 515 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
516 516 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
517 517 % endif
518 518 </div>
519 519 % endif
520 520 </div>
521 521
522 522 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
523 523
524 524 % if not c.pull_request.is_closed():
525 525 ## main comment form and it status
526 526 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
527 527 pull_request_id=c.pull_request.pull_request_id),
528 528 c.pull_request_review_status,
529 529 is_pull_request=True, change_status=c.allowed_to_change_status)}
530 530
531 531 ## merge status, and merge action
532 532 <div class="pull-request-merge">
533 533 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
534 534 </div>
535 535
536 536 %endif
537 537
538 538 % endif
539 539 </div>
540 540
541 541
542 542 ### NAV SIDEBAR
543 543 <aside class="right-sidebar right-sidebar-expanded" id="pr-nav-sticky" style="display: none">
544 544 <div class="sidenav navbar__inner" >
545 545 ## TOGGLE
546 546 <div class="sidebar-toggle" onclick="toggleSidebar(); return false">
547 547 <a href="#toggleSidebar" class="grey-link-action">
548 548
549 549 </a>
550 550 </div>
551 551
552 552 ## CONTENT
553 553 <div class="sidebar-content">
554 554
555 555 ## RULES SUMMARY/RULES
556 556 <div class="sidebar-element clear-both">
557 557 <% vote_title = _ungettext(
558 558 'Status calculated based on votes from {} reviewer',
559 559 'Status calculated based on votes from {} reviewers', c.reviewers_count).format(c.reviewers_count)
560 560 %>
561 561
562 562 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
563 563 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
564 564 ${c.reviewers_count}
565 565 </div>
566 566
567 567 ## REVIEW RULES
568 568 <div id="review_rules" style="display: none" class="">
569 569 <div class="right-sidebar-expanded-state pr-details-title">
570 570 <span class="sidebar-heading">
571 571 ${_('Reviewer rules')}
572 572 </span>
573 573
574 574 </div>
575 575 <div class="pr-reviewer-rules">
576 576 ## review rules will be appended here, by default reviewers logic
577 577 </div>
578 578 <input id="review_data" type="hidden" name="review_data" value="">
579 579 </div>
580 580
581 581 ## REVIEWERS
582 582 <div class="right-sidebar-expanded-state pr-details-title">
583 583 <span class="tooltip sidebar-heading" title="${vote_title}">
584 584 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
585 585 ${_('Reviewers')}
586 586 </span>
587 587 %if c.allowed_to_update:
588 588 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
589 589 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
590 590 %else:
591 591 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Show rules')}</span>
592 592 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
593 593 %endif
594 594 </div>
595 595
596 596 <div id="reviewers" class="right-sidebar-expanded-state pr-details-content reviewers">
597 597
598 598 ## members redering block
599 599 <input type="hidden" name="__start__" value="review_members:sequence">
600 600
601 601 <table id="review_members" class="group_members">
602 602 ## This content is loaded via JS and ReviewersPanel
603 603 </table>
604 604
605 605 <input type="hidden" name="__end__" value="review_members:sequence">
606 606 ## end members redering block
607 607
608 608 %if not c.pull_request.is_closed():
609 609 <div id="add_reviewer" class="ac" style="display: none;">
610 610 %if c.allowed_to_update:
611 611 % if not c.forbid_adding_reviewers:
612 612 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px">
613 613 <input class="ac-input" id="user" name="user" placeholder="${_('Add reviewer or reviewer group')}" type="text" autocomplete="off">
614 614 <div id="reviewers_container"></div>
615 615 </div>
616 616 % endif
617 617 <div class="pull-right" style="margin-bottom: 15px">
618 618 <button data-role="reviewer" id="update_reviewers" class="btn btn-small no-margin">${_('Save Changes')}</button>
619 619 </div>
620 620 %endif
621 621 </div>
622 622 %endif
623 623 </div>
624 624 </div>
625 625
626 626 ## OBSERVERS
627 627 <div class="sidebar-element clear-both">
628 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Observers')}">
628 <% vote_title = _ungettext(
629 '{} observer without voting right.',
630 '{} observers without voting right.', c.observers_count).format(c.observers_count)
631 %>
632
633 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
629 634 <i class="icon-circle-thin"></i>
630 635 ${c.observers_count}
631 636 </div>
632 637
633 638 <div class="right-sidebar-expanded-state pr-details-title">
634 <span class="sidebar-heading">
639 <span class="tooltip sidebar-heading" title="${vote_title}">
635 640 <i class="icon-circle-thin"></i>
636 641 ${_('Observers')}
637 642 </span>
638 643 %if c.allowed_to_update:
639 644 <span id="open_edit_observers" class="block-right action_button last-item">${_('Edit')}</span>
640 645 <span id="close_edit_observers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
641 646 %endif
642 647 </div>
643 648
644 649 <div id="observers" class="right-sidebar-expanded-state pr-details-content reviewers">
645 650 ## members redering block
646 651 <input type="hidden" name="__start__" value="observer_members:sequence">
647 652
648 653 <table id="observer_members" class="group_members">
649 654 ## This content is loaded via JS and ReviewersPanel
650 655 </table>
651 656
652 657 <input type="hidden" name="__end__" value="observer_members:sequence">
653 658 ## end members redering block
654 659
655 660 %if not c.pull_request.is_closed():
656 661 <div id="add_observer" class="ac" style="display: none;">
657 662 %if c.allowed_to_update:
658 663 % if not c.forbid_adding_reviewers or 1:
659 664 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px" >
660 665 <input class="ac-input" id="observer" name="observer" placeholder="${_('Add observer or observer group')}" type="text" autocomplete="off">
661 666 <div id="observers_container"></div>
662 667 </div>
663 668 % endif
664 669 <div class="pull-right" style="margin-bottom: 15px">
665 670 <button data-role="observer" id="update_observers" class="btn btn-small no-margin">${_('Save Changes')}</button>
666 671 </div>
667 672 %endif
668 673 </div>
669 674 %endif
670 675 </div>
671 676 </div>
672 677
673 678 ## TODOs
674 679 <div class="sidebar-element clear-both">
675 680 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="TODOs">
676 681 <i class="icon-flag-filled"></i>
677 682 <span id="todos-count">${len(c.unresolved_comments)}</span>
678 683 </div>
679 684
680 685 <div class="right-sidebar-expanded-state pr-details-title">
681 686 ## Only show unresolved, that is only what matters
682 687 <span class="sidebar-heading noselect" onclick="refreshTODOs(); return false">
683 688 <i class="icon-flag-filled"></i>
684 689 TODOs
685 690 </span>
686 691
687 692 % if not c.at_version:
688 693 % if c.resolved_comments:
689 694 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return toggleElement(this, '.resolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
690 695 % else:
691 696 <span class="block-right last-item noselect">Show resolved</span>
692 697 % endif
693 698 % endif
694 699 </div>
695 700
696 701 <div class="right-sidebar-expanded-state pr-details-content">
697 702
698 703 % if c.at_version:
699 704 <table>
700 705 <tr>
701 706 <td class="unresolved-todo-text">${_('TODOs unavailable when browsing versions')}.</td>
702 707 </tr>
703 708 </table>
704 709 % else:
705 710 % if c.unresolved_comments + c.resolved_comments:
706 711 ${sidebar.comments_table(c.unresolved_comments + c.resolved_comments, len(c.unresolved_comments), todo_comments=True)}
707 712 % else:
708 713 <table>
709 714 <tr>
710 715 <td>
711 716 ${_('No TODOs yet')}
712 717 </td>
713 718 </tr>
714 719 </table>
715 720 % endif
716 721 % endif
717 722 </div>
718 723 </div>
719 724
720 725 ## COMMENTS
721 726 <div class="sidebar-element clear-both">
722 727 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Comments')}">
723 728 <i class="icon-comment" style="color: #949494"></i>
724 729 <span id="comments-count">${len(c.inline_comments_flat+c.comments)}</span>
725 730 <span class="display-none" id="general-comments-count">${len(c.comments)}</span>
726 731 <span class="display-none" id="inline-comments-count">${len(c.inline_comments_flat)}</span>
727 732 </div>
728 733
729 734 <div class="right-sidebar-expanded-state pr-details-title">
730 735 <span class="sidebar-heading noselect" onclick="refreshComments(); return false">
731 736 <i class="icon-comment" style="color: #949494"></i>
732 737 ${_('Comments')}
733 738
734 739 ## % if outdated_comm_count_ver:
735 740 ## <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">
736 741 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
737 742 ## </a>
738 743 ## <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated')}</a>
739 744 ## <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated')}</a>
740 745
741 746 ## % else:
742 747 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
743 748 ## % endif
744 749
745 750 </span>
746 751
747 752 % if outdated_comm_count_ver:
748 753 <span class="block-right action_button last-item noselect" onclick="return toggleElement(this, '.hidden-comment');" data-toggle-on="Show outdated" data-toggle-off="Hide outdated">Show outdated</span>
749 754 % else:
750 755 <span class="block-right last-item noselect">Show hidden</span>
751 756 % endif
752 757
753 758 </div>
754 759
755 760 <div class="right-sidebar-expanded-state pr-details-content">
756 761 % if c.inline_comments_flat + c.comments:
757 762 ${sidebar.comments_table(c.inline_comments_flat + c.comments, len(c.inline_comments_flat+c.comments))}
758 763 % else:
759 764 <table>
760 765 <tr>
761 766 <td>
762 767 ${_('No Comments yet')}
763 768 </td>
764 769 </tr>
765 770 </table>
766 771 % endif
767 772 </div>
768 773
769 774 </div>
770 775
771 776 ## Referenced Tickets
772 777 <div class="sidebar-element clear-both">
773 778 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Referenced Tickets')}">
774 779 <i class="icon-info-circled"></i>
775 780 ${(len(c.referenced_desc_issues) + len(c.referenced_commit_issues))}
776 781 </div>
777 782
778 783 <div class="right-sidebar-expanded-state pr-details-title">
779 784 <span class="sidebar-heading">
780 785 <i class="icon-info-circled"></i>
781 786 ${_('Referenced Tickets')}
782 787 </span>
783 788 </div>
784 789 <div class="right-sidebar-expanded-state pr-details-content">
785 790 <table>
786 791
787 792 <tr><td><code>${_('In pull request description')}:</code></td></tr>
788 793 % if c.referenced_desc_issues:
789 794 % for ticket_dict in sorted(c.referenced_desc_issues):
790 795 <tr>
791 796 <td>
792 797 <a href="${ticket_dict.get('url')}">
793 798 ${ticket_dict.get('id')}
794 799 </a>
795 800 </td>
796 801 </tr>
797 802 % endfor
798 803 % else:
799 804 <tr>
800 805 <td>
801 806 ${_('No Ticket data found.')}
802 807 </td>
803 808 </tr>
804 809 % endif
805 810
806 811 <tr><td style="padding-top: 10px"><code>${_('In commit messages')}:</code></td></tr>
807 812 % if c.referenced_commit_issues:
808 813 % for ticket_dict in sorted(c.referenced_commit_issues):
809 814 <tr>
810 815 <td>
811 816 <a href="${ticket_dict.get('url')}">
812 817 ${ticket_dict.get('id')}
813 818 </a>
814 819 </td>
815 820 </tr>
816 821 % endfor
817 822 % else:
818 823 <tr>
819 824 <td>
820 825 ${_('No Ticket data found.')}
821 826 </td>
822 827 </tr>
823 828 % endif
824 829 </table>
825 830
826 831 </div>
827 832 </div>
828 833
829 834 </div>
830 835
831 836 </div>
832 837 </aside>
833 838
834 839 ## This JS needs to be at the end
835 840 <script type="text/javascript">
836 841
837 842 versionController = new VersionController();
838 843 versionController.init();
839 844
840 845 reviewersController = new ReviewersController();
841 846 commitsController = new CommitsController();
842 847
843 848 updateController = new UpdatePrController();
844 849
845 850 window.reviewerRulesData = ${c.pull_request_default_reviewers_data_json | n};
846 851 window.setReviewersData = ${c.pull_request_set_reviewers_data_json | n};
847 852 window.setObserversData = ${c.pull_request_set_observers_data_json | n};
848 853
849 854 (function () {
850 855 "use strict";
851 856
852 857 // custom code mirror
853 858 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
854 859
855 860 PRDetails.init();
856 861 ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
857 862 ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
858 863
859 864 window.showOutdated = function (self) {
860 865 $('.comment-inline.comment-outdated').show();
861 866 $('.filediff-outdated').show();
862 867 $('.showOutdatedComments').hide();
863 868 $('.hideOutdatedComments').show();
864 869 };
865 870
866 871 window.hideOutdated = function (self) {
867 872 $('.comment-inline.comment-outdated').hide();
868 873 $('.filediff-outdated').hide();
869 874 $('.hideOutdatedComments').hide();
870 875 $('.showOutdatedComments').show();
871 876 };
872 877
873 878 window.refreshMergeChecks = function () {
874 879 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
875 880 $('.pull-request-merge').css('opacity', 0.3);
876 881 $('.action-buttons-extra').css('opacity', 0.3);
877 882
878 883 $('.pull-request-merge').load(
879 884 loadUrl, function () {
880 885 $('.pull-request-merge').css('opacity', 1);
881 886
882 887 $('.action-buttons-extra').css('opacity', 1);
883 888 }
884 889 );
885 890 };
886 891
887 892 window.closePullRequest = function (status) {
888 893 if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) {
889 894 return false;
890 895 }
891 896 // inject closing flag
892 897 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
893 898 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
894 899 $(generalCommentForm.submitForm).submit();
895 900 };
896 901
897 902 //TODO this functionality is now missing
898 903 $('#show-outdated-comments').on('click', function (e) {
899 904 var button = $(this);
900 905 var outdated = $('.comment-outdated');
901 906
902 907 if (button.html() === "(Show)") {
903 908 button.html("(Hide)");
904 909 outdated.show();
905 910 } else {
906 911 button.html("(Show)");
907 912 outdated.hide();
908 913 }
909 914 });
910 915
911 916 $('#merge_pull_request_form').submit(function () {
912 917 if (!$('#merge_pull_request').attr('disabled')) {
913 918 $('#merge_pull_request').attr('disabled', 'disabled');
914 919 }
915 920 return true;
916 921 });
917 922
918 923 $('#edit_pull_request').on('click', function (e) {
919 924 var title = $('#pr-title-input').val();
920 925 var description = codeMirrorInstance.getValue();
921 926 var renderer = $('#pr-renderer-input').val();
922 927 editPullRequest(
923 928 "${c.repo_name}", "${c.pull_request.pull_request_id}",
924 929 title, description, renderer);
925 930 });
926 931
927 932 var $updateButtons = $('#update_reviewers,#update_observers');
928 933 $updateButtons.on('click', function (e) {
929 934 var role = $(this).data('role');
930 935 $updateButtons.attr('disabled', 'disabled');
931 936 $updateButtons.addClass('disabled');
932 937 $updateButtons.html(_gettext('Saving...'));
933 938 reviewersController.updateReviewers(
934 939 templateContext.repo_name,
935 940 templateContext.pull_request_data.pull_request_id,
936 941 role
937 942 );
938 943 });
939 944
940 945 // fixing issue with caches on firefox
941 946 $('#update_commits').removeAttr("disabled");
942 947
943 948 $('.show-inline-comments').on('click', function (e) {
944 949 var boxid = $(this).attr('data-comment-id');
945 950 var button = $(this);
946 951
947 952 if (button.hasClass("comments-visible")) {
948 953 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
949 954 $(this).hide();
950 955 });
951 956 button.removeClass("comments-visible");
952 957 } else {
953 958 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
954 959 $(this).show();
955 960 });
956 961 button.addClass("comments-visible");
957 962 }
958 963 });
959 964
960 965 $('.show-inline-comments').on('change', function (e) {
961 966 var show = 'none';
962 967 var target = e.currentTarget;
963 968 if (target.checked) {
964 969 show = ''
965 970 }
966 971 var boxid = $(target).attr('id_for');
967 972 var comments = $('#{0} .inline-comments'.format(boxid));
968 973 var fn_display = function (idx) {
969 974 $(this).css('display', show);
970 975 };
971 976 $(comments).each(fn_display);
972 977 var btns = $('#{0} .inline-comments-button'.format(boxid));
973 978 $(btns).each(fn_display);
974 979 });
975 980
976 981 // register submit callback on commentForm form to track TODOs
977 982 window.commentFormGlobalSubmitSuccessCallback = function () {
978 983 refreshMergeChecks();
979 984 };
980 985
981 986 ReviewerAutoComplete('#user', reviewersController);
982 987 ObserverAutoComplete('#observer', reviewersController);
983 988
984 989 })();
985 990
986 991 $(document).ready(function () {
987 992
988 993 var channel = '${c.pr_broadcast_channel}';
989 994 new ReviewerPresenceController(channel)
990 995
991 996 })
992 997 </script>
993 998
994 999 </%def>
General Comments 0
You need to be logged in to leave comments. Login now