##// END OF EJS Templates
pr-shadow: Display link to last merge revision in shadow repository if merge was successful. #1055
Martin Bornhold -
r1045:073ad72a default
parent child Browse files
Show More
@@ -1,621 +1,621 b''
1 1 <%inherit file="/base/base.html"/>
2 2
3 3 <%def name="title()">
4 4 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
5 5 %if c.rhodecode_name:
6 6 &middot; ${h.branding(c.rhodecode_name)}
7 7 %endif
8 8 </%def>
9 9
10 10 <%def name="breadcrumbs_links()">
11 11 <span id="pr-title">
12 12 ${c.pull_request.title}
13 13 %if c.pull_request.is_closed():
14 14 (${_('Closed')})
15 15 %endif
16 16 </span>
17 17 <div id="pr-title-edit" class="input" style="display: none;">
18 18 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
19 19 </div>
20 20 </%def>
21 21
22 22 <%def name="menu_bar_nav()">
23 23 ${self.menu_items(active='repositories')}
24 24 </%def>
25 25
26 26 <%def name="menu_bar_subnav()">
27 27 ${self.repo_menu(active='showpullrequest')}
28 28 </%def>
29 29
30 30 <%def name="main()">
31 31 <script type="text/javascript">
32 32 // TODO: marcink switch this to pyroutes
33 33 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
34 34 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
35 35 </script>
36 36 <div class="box">
37 37 <div class="title">
38 38 ${self.repo_page_title(c.rhodecode_db_repo)}
39 39 </div>
40 40
41 41 ${self.breadcrumbs()}
42 42
43 43
44 44 <div class="box pr-summary">
45 45 <div class="summary-details block-left">
46 46 <%summary = lambda n:{False:'summary-short'}.get(n)%>
47 47 <div class="pr-details-title">
48 48 ${_('Pull request #%s') % c.pull_request.pull_request_id} ${_('From')} ${h.format_date(c.pull_request.created_on)}
49 49 %if c.allowed_to_update:
50 50 <span id="open_edit_pullrequest" class="block-right action_button">${_('Edit')}</span>
51 51 <span id="close_edit_pullrequest" class="block-right action_button" style="display: none;">${_('Close')}</span>
52 52 %endif
53 53 </div>
54 54
55 55 <div id="summary" class="fields pr-details-content">
56 56 <div class="field">
57 57 <div class="label-summary">
58 58 <label>${_('Origin')}:</label>
59 59 </div>
60 60 <div class="input">
61 61 <div class="pr-origininfo">
62 62 ## branch link is only valid if it is a branch
63 63 <span class="tag">
64 64 %if c.pull_request.source_ref_parts.type == 'branch':
65 65 <a href="${h.url('changelog_home', repo_name=c.pull_request.source_repo.repo_name, branch=c.pull_request.source_ref_parts.name)}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
66 66 %else:
67 67 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
68 68 %endif
69 69 </span>
70 70 <span class="clone-url">
71 71 <a href="${h.url('summary_home', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
72 72 </span>
73 73 </div>
74 74 <div class="pr-pullinfo">
75 75 %if h.is_hg(c.pull_request.source_repo):
76 76 <input type="text" value="hg pull -r ${h.short_id(c.source_ref)} ${c.pull_request.source_repo.clone_url()}" readonly="readonly">
77 77 %elif h.is_git(c.pull_request.source_repo):
78 78 <input type="text" value="git pull ${c.pull_request.source_repo.clone_url()} ${c.pull_request.source_ref_parts.name}" readonly="readonly">
79 79 %endif
80 80 </div>
81 81 </div>
82 82 </div>
83 83 <div class="field">
84 84 <div class="label-summary">
85 85 <label>${_('Target')}:</label>
86 86 </div>
87 87 <div class="input">
88 88 <div class="pr-targetinfo">
89 89 ## branch link is only valid if it is a branch
90 90 <span class="tag">
91 91 %if c.pull_request.target_ref_parts.type == 'branch':
92 92 <a href="${h.url('changelog_home', repo_name=c.pull_request.target_repo.repo_name, branch=c.pull_request.target_ref_parts.name)}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
93 93 %else:
94 94 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
95 95 %endif
96 96 </span>
97 97 <span class="clone-url">
98 98 <a href="${h.url('summary_home', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
99 99 </span>
100 100 </div>
101 101 </div>
102 102 </div>
103 103
104 ## Clone link of the shadow repository.
105 %if not c.pull_request.is_closed():
106 <div class="field">
107 <div class="label-summary">
108 <label>${_('Shadow')}:</label>
109 </div>
110 <div class="input">
111 <div class="pr-shadowinfo">
112 %if h.is_hg(c.pull_request.target_repo):
113 <input type="text" value="hg clone ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly">
114 %elif h.is_git(c.pull_request.target_repo):
115 <input type="text" value="git clone ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly">
116 %endif
117 </div>
118 </div>
119 </div>
120 %endif
104 ## Link to the shadow repository.
105 %if not c.pull_request.is_closed() and c.pull_request.last_merge_rev:
106 <div class="field">
107 <div class="label-summary">
108 <label>Merge:</label>
109 </div>
110 <div class="input">
111 <div class="pr-mergeinfo">
112 %if h.is_hg(c.pull_request.target_repo):
113 <input type="text" value="hg clone -u pr-merge ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly">
114 %elif h.is_git(c.pull_request.target_repo):
115 <input type="text" value="git clone --branch pr-merge ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly">
116 %endif
117 </div>
118 </div>
119 </div>
120 %endif
121 121
122 122 <div class="field">
123 123 <div class="label-summary">
124 124 <label>${_('Review')}:</label>
125 125 </div>
126 126 <div class="input">
127 127 %if c.pull_request_review_status:
128 128 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
129 129 <span class="changeset-status-lbl tooltip">
130 130 %if c.pull_request.is_closed():
131 131 ${_('Closed')},
132 132 %endif
133 133 ${h.commit_status_lbl(c.pull_request_review_status)}
134 134 </span>
135 135 - ${ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
136 136 %endif
137 137 </div>
138 138 </div>
139 139 <div class="field">
140 140 <div class="pr-description-label label-summary">
141 141 <label>${_('Description')}:</label>
142 142 </div>
143 143 <div id="pr-desc" class="input">
144 144 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
145 145 </div>
146 146 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
147 147 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
148 148 </div>
149 149 </div>
150 150 <div class="field">
151 151 <div class="label-summary">
152 152 <label>${_('Comments')}:</label>
153 153 </div>
154 154 <div class="input">
155 155 <div>
156 156 <div class="comments-number">
157 157 %if c.comments:
158 158 <a href="#comments">${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}</a>,
159 159 %else:
160 160 ${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}
161 161 %endif
162 162 %if c.inline_cnt:
163 163 ## this is replaced with a proper link to first comment via JS linkifyComments() func
164 164 <a href="#inline-comments" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
165 165 %else:
166 166 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
167 167 %endif
168 168
169 169 % if c.outdated_cnt:
170 170 ,${ungettext("%d Outdated Comment", "%d Outdated Comments", c.outdated_cnt) % c.outdated_cnt} <span id="show-outdated-comments" class="btn btn-link">${_('(Show)')}</span>
171 171 % endif
172 172 </div>
173 173 </div>
174 174 </div>
175 175 </div>
176 176 <div id="pr-save" class="field" style="display: none;">
177 177 <div class="label-summary"></div>
178 178 <div class="input">
179 179 <span id="edit_pull_request" class="btn btn-small">${_('Save Changes')}</span>
180 180 </div>
181 181 </div>
182 182 </div>
183 183 </div>
184 184 <div>
185 185 ## AUTHOR
186 186 <div class="reviewers-title block-right">
187 187 <div class="pr-details-title">
188 188 ${_('Author')}
189 189 </div>
190 190 </div>
191 191 <div class="block-right pr-details-content reviewers">
192 192 <ul class="group_members">
193 193 <li>
194 194 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
195 195 </li>
196 196 </ul>
197 197 </div>
198 198 ## REVIEWERS
199 199 <div class="reviewers-title block-right">
200 200 <div class="pr-details-title">
201 201 ${_('Pull request reviewers')}
202 202 %if c.allowed_to_update:
203 203 <span id="open_edit_reviewers" class="block-right action_button">${_('Edit')}</span>
204 204 <span id="close_edit_reviewers" class="block-right action_button" style="display: none;">${_('Close')}</span>
205 205 %endif
206 206 </div>
207 207 </div>
208 208 <div id="reviewers" class="block-right pr-details-content reviewers">
209 209 ## members goes here !
210 210 <input type="hidden" name="__start__" value="review_members:sequence">
211 211 <ul id="review_members" class="group_members">
212 212 %for member,reasons,status in c.pull_request_reviewers:
213 213 <li id="reviewer_${member.user_id}">
214 214 <div class="reviewers_member">
215 215 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
216 216 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
217 217 </div>
218 218 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
219 219 ${self.gravatar_with_user(member.email, 16)}
220 220 </div>
221 221 <input type="hidden" name="__start__" value="reviewer:mapping">
222 222 <input type="hidden" name="__start__" value="reasons:sequence">
223 223 %for reason in reasons:
224 224 <div class="reviewer_reason">- ${reason}</div>
225 225 <input type="hidden" name="reason" value="${reason}">
226 226
227 227 %endfor
228 228 <input type="hidden" name="__end__" value="reasons:sequence">
229 229 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="user_id" />
230 230 <input type="hidden" name="__end__" value="reviewer:mapping">
231 231 %if c.allowed_to_update:
232 232 <div class="reviewer_member_remove action_button" onclick="removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
233 233 <i class="icon-remove-sign" ></i>
234 234 </div>
235 235 %endif
236 236 </div>
237 237 </li>
238 238 %endfor
239 239 </ul>
240 240 <input type="hidden" name="__end__" value="review_members:sequence">
241 241 %if not c.pull_request.is_closed():
242 242 <div id="add_reviewer_input" class='ac' style="display: none;">
243 243 %if c.allowed_to_update:
244 244 <div class="reviewer_ac">
245 245 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))}
246 246 <div id="reviewers_container"></div>
247 247 </div>
248 248 <div>
249 249 <span id="update_pull_request" class="btn btn-small">${_('Save Changes')}</span>
250 250 </div>
251 251 %endif
252 252 </div>
253 253 %endif
254 254 </div>
255 255 </div>
256 256 </div>
257 257 <div class="box">
258 258 ##DIFF
259 259 <div class="table" >
260 260 <div id="changeset_compare_view_content">
261 261 ##CS
262 262 % if c.missing_requirements:
263 263 <div class="box">
264 264 <div class="alert alert-warning">
265 265 <div>
266 266 <strong>${_('Missing requirements:')}</strong>
267 267 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
268 268 </div>
269 269 </div>
270 270 </div>
271 271 % elif c.missing_commits:
272 272 <div class="box">
273 273 <div class="alert alert-warning">
274 274 <div>
275 275 <strong>${_('Missing commits')}:</strong>
276 276 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
277 277 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
278 278 </div>
279 279 </div>
280 280 </div>
281 281 % endif
282 282 <div class="compare_view_commits_title">
283 283 % if c.allowed_to_update and not c.pull_request.is_closed():
284 284 <button id="update_commits" class="btn btn-small">${_('Update commits')}</button>
285 285 % endif
286 286 % if len(c.commit_ranges):
287 287 <h2>${ungettext('Compare View: %s commit','Compare View: %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}</h2>
288 288 % endif
289 289 </div>
290 290 % if not c.missing_commits:
291 291 <%include file="/compare/compare_commits.html" />
292 292 ## FILES
293 293 <div class="cs_files_title">
294 294 <span class="cs_files_expand">
295 295 <span id="expand_all_files">${_('Expand All')}</span> | <span id="collapse_all_files">${_('Collapse All')}</span>
296 296 </span>
297 297 <h2>
298 298 ${diff_block.diff_summary_text(len(c.files), c.lines_added, c.lines_deleted, c.limited_diff)}
299 299 </h2>
300 300 </div>
301 301 % endif
302 302 <div class="cs_files">
303 303 %if not c.files and not c.missing_commits:
304 304 <span class="empty_data">${_('No files')}</span>
305 305 %endif
306 306 <table class="compare_view_files">
307 307 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
308 308 %for FID, change, path, stats in c.files:
309 309 <tr class="cs_${change} collapse_file" fid="${FID}">
310 310 <td class="cs_icon_td">
311 311 <span class="collapse_file_icon" fid="${FID}"></span>
312 312 </td>
313 313 <td class="cs_icon_td">
314 314 <div class="flag_status not_reviewed hidden"></div>
315 315 </td>
316 316 <td class="cs_${change}" id="a_${FID}">
317 317 <div class="node">
318 318 <a href="#a_${FID}">
319 319 <i class="icon-file-${change.lower()}"></i>
320 320 ${h.safe_unicode(path)}
321 321 </a>
322 322 </div>
323 323 </td>
324 324 <td>
325 325 <div class="changes pull-right">${h.fancy_file_stats(stats)}</div>
326 326 <div class="comment-bubble pull-right" data-path="${path}">
327 327 <i class="icon-comment"></i>
328 328 </div>
329 329 </td>
330 330 </tr>
331 331 <tr fid="${FID}" id="diff_${FID}" class="diff_links">
332 332 <td></td>
333 333 <td></td>
334 334 <td class="cs_${change}">
335 335 %if c.target_repo.repo_name == c.repo_name:
336 336 ${diff_block.diff_menu(c.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
337 337 %else:
338 338 ## this is slightly different case later, since the other repo can have this
339 339 ## file in other state than the origin repo
340 340 ${diff_block.diff_menu(c.target_repo.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
341 341 %endif
342 342 </td>
343 343 <td class="td-actions rc-form">
344 344 <div data-comment-id="${FID}" class="btn-link show-inline-comments comments-visible">
345 345 <span class="comments-show">${_('Show comments')}</span>
346 346 <span class="comments-hide">${_('Hide comments')}</span>
347 347 </div>
348 348 </td>
349 349 </tr>
350 350 <tr id="tr_${FID}">
351 351 <td></td>
352 352 <td></td>
353 353 <td class="injected_diff" colspan="2">
354 354 ${diff_block.diff_block_simple([c.changes[FID]])}
355 355 </td>
356 356 </tr>
357 357
358 358 ## Loop through inline comments
359 359 % if c.outdated_comments.get(path,False):
360 360 <tr class="outdated">
361 361 <td></td>
362 362 <td></td>
363 363 <td colspan="2">
364 364 <p>${_('Outdated Inline Comments')}:</p>
365 365 </td>
366 366 </tr>
367 367 <tr class="outdated">
368 368 <td></td>
369 369 <td></td>
370 370 <td colspan="2" class="outdated_comment_block">
371 371 % for line, comments in c.outdated_comments[path].iteritems():
372 372 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
373 373 % for co in comments:
374 374 ${comment.comment_block_outdated(co)}
375 375 % endfor
376 376 </div>
377 377 % endfor
378 378 </td>
379 379 </tr>
380 380 % endif
381 381 %endfor
382 382 ## Loop through inline comments for deleted files
383 383 %for path in c.deleted_files:
384 384 <tr class="outdated deleted">
385 385 <td></td>
386 386 <td></td>
387 387 <td>${path}</td>
388 388 </tr>
389 389 <tr class="outdated deleted">
390 390 <td></td>
391 391 <td></td>
392 392 <td>(${_('Removed')})</td>
393 393 </tr>
394 394 % if path in c.outdated_comments:
395 395 <tr class="outdated deleted">
396 396 <td></td>
397 397 <td></td>
398 398 <td colspan="2">
399 399 <p>${_('Outdated Inline Comments')}:</p>
400 400 </td>
401 401 </tr>
402 402 <tr class="outdated">
403 403 <td></td>
404 404 <td></td>
405 405 <td colspan="2" class="outdated_comment_block">
406 406 % for line, comments in c.outdated_comments[path].iteritems():
407 407 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
408 408 % for co in comments:
409 409 ${comment.comment_block_outdated(co)}
410 410 % endfor
411 411 </div>
412 412 % endfor
413 413 </td>
414 414 </tr>
415 415 % endif
416 416 %endfor
417 417 </table>
418 418 </div>
419 419 % if c.limited_diff:
420 420 <h5>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5>
421 421 % endif
422 422 </div>
423 423 </div>
424 424
425 425 % if c.limited_diff:
426 426 <p>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></p>
427 427 % endif
428 428
429 429 ## template for inline comment form
430 430 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
431 431 ${comment.comment_inline_form()}
432 432
433 433 ## render comments and inlines
434 434 ${comment.generate_comments(include_pull_request=True, is_pull_request=True)}
435 435
436 436 % if not c.pull_request.is_closed():
437 437 ## main comment form and it status
438 438 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
439 439 pull_request_id=c.pull_request.pull_request_id),
440 440 c.pull_request_review_status,
441 441 is_pull_request=True, change_status=c.allowed_to_change_status)}
442 442 %endif
443 443
444 444 <script type="text/javascript">
445 445 if (location.hash) {
446 446 var result = splitDelimitedHash(location.hash);
447 447 var line = $('html').find(result.loc);
448 448 if (line.length > 0){
449 449 offsetScroll(line, 70);
450 450 }
451 451 }
452 452 $(function(){
453 453 ReviewerAutoComplete('user');
454 454 // custom code mirror
455 455 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
456 456
457 457 var PRDetails = {
458 458 editButton: $('#open_edit_pullrequest'),
459 459 closeButton: $('#close_edit_pullrequest'),
460 460 viewFields: $('#pr-desc, #pr-title'),
461 461 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
462 462
463 463 init: function() {
464 464 var that = this;
465 465 this.editButton.on('click', function(e) { that.edit(); });
466 466 this.closeButton.on('click', function(e) { that.view(); });
467 467 },
468 468
469 469 edit: function(event) {
470 470 this.viewFields.hide();
471 471 this.editButton.hide();
472 472 this.editFields.show();
473 473 codeMirrorInstance.refresh();
474 474 },
475 475
476 476 view: function(event) {
477 477 this.editFields.hide();
478 478 this.closeButton.hide();
479 479 this.viewFields.show();
480 480 }
481 481 };
482 482
483 483 var ReviewersPanel = {
484 484 editButton: $('#open_edit_reviewers'),
485 485 closeButton: $('#close_edit_reviewers'),
486 486 addButton: $('#add_reviewer_input'),
487 487 removeButtons: $('.reviewer_member_remove'),
488 488
489 489 init: function() {
490 490 var that = this;
491 491 this.editButton.on('click', function(e) { that.edit(); });
492 492 this.closeButton.on('click', function(e) { that.close(); });
493 493 },
494 494
495 495 edit: function(event) {
496 496 this.editButton.hide();
497 497 this.closeButton.show();
498 498 this.addButton.show();
499 499 this.removeButtons.css('visibility', 'visible');
500 500 },
501 501
502 502 close: function(event) {
503 503 this.editButton.show();
504 504 this.closeButton.hide();
505 505 this.addButton.hide();
506 506 this.removeButtons.css('visibility', 'hidden');
507 507 }
508 508 };
509 509
510 510 PRDetails.init();
511 511 ReviewersPanel.init();
512 512
513 513 $('#show-outdated-comments').on('click', function(e){
514 514 var button = $(this);
515 515 var outdated = $('.outdated');
516 516 if (button.html() === "(Show)") {
517 517 button.html("(Hide)");
518 518 outdated.show();
519 519 } else {
520 520 button.html("(Show)");
521 521 outdated.hide();
522 522 }
523 523 });
524 524
525 525 $('.show-inline-comments').on('change', function(e){
526 526 var show = 'none';
527 527 var target = e.currentTarget;
528 528 if(target.checked){
529 529 show = ''
530 530 }
531 531 var boxid = $(target).attr('id_for');
532 532 var comments = $('#{0} .inline-comments'.format(boxid));
533 533 var fn_display = function(idx){
534 534 $(this).css('display', show);
535 535 };
536 536 $(comments).each(fn_display);
537 537 var btns = $('#{0} .inline-comments-button'.format(boxid));
538 538 $(btns).each(fn_display);
539 539 });
540 540
541 541 // inject comments into their proper positions
542 542 var file_comments = $('.inline-comment-placeholder');
543 543 %if c.pull_request.is_closed():
544 544 renderInlineComments(file_comments, false);
545 545 %else:
546 546 renderInlineComments(file_comments, true);
547 547 %endif
548 548 var commentTotals = {};
549 549 $.each(file_comments, function(i, comment) {
550 550 var path = $(comment).attr('path');
551 551 var comms = $(comment).children().length;
552 552 if (path in commentTotals) {
553 553 commentTotals[path] += comms;
554 554 } else {
555 555 commentTotals[path] = comms;
556 556 }
557 557 });
558 558 $.each(commentTotals, function(path, total) {
559 559 var elem = $('.comment-bubble[data-path="'+ path +'"]');
560 560 elem.css('visibility', 'visible');
561 561 elem.html(elem.html() + ' ' + total );
562 562 });
563 563
564 564 $('#merge_pull_request_form').submit(function() {
565 565 if (!$('#merge_pull_request').attr('disabled')) {
566 566 $('#merge_pull_request').attr('disabled', 'disabled');
567 567 }
568 568 return true;
569 569 });
570 570
571 571 $('#edit_pull_request').on('click', function(e){
572 572 var title = $('#pr-title-input').val();
573 573 var description = codeMirrorInstance.getValue();
574 574 editPullRequest(
575 575 "${c.repo_name}", "${c.pull_request.pull_request_id}",
576 576 title, description);
577 577 });
578 578
579 579 $('#update_pull_request').on('click', function(e){
580 580 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
581 581 });
582 582
583 583 $('#update_commits').on('click', function(e){
584 584 var isDisabled = !$(e.currentTarget).attr('disabled');
585 585 $(e.currentTarget).text(_gettext('Updating...'));
586 586 $(e.currentTarget).attr('disabled', 'disabled');
587 587 if(isDisabled){
588 588 updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}");
589 589 }
590 590
591 591 });
592 592 // fixing issue with caches on firefox
593 593 $('#update_commits').removeAttr("disabled");
594 594
595 595 $('#close_pull_request').on('click', function(e){
596 596 closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}");
597 597 });
598 598
599 599 $('.show-inline-comments').on('click', function(e){
600 600 var boxid = $(this).attr('data-comment-id');
601 601 var button = $(this);
602 602
603 603 if(button.hasClass("comments-visible")) {
604 604 $('#{0} .inline-comments'.format(boxid)).each(function(index){
605 605 $(this).hide();
606 606 })
607 607 button.removeClass("comments-visible");
608 608 } else {
609 609 $('#{0} .inline-comments'.format(boxid)).each(function(index){
610 610 $(this).show();
611 611 })
612 612 button.addClass("comments-visible");
613 613 }
614 614 });
615 615 })
616 616 </script>
617 617
618 618 </div>
619 619 </div>
620 620
621 621 </%def>
General Comments 0
You need to be logged in to leave comments. Login now