##// END OF EJS Templates
diffs: update all sticky elements on dom changes to handle cases like:...
dan -
r3129:62991ed2 default
parent child Browse files
Show More
@@ -1,836 +1,836 b''
1 1 // # Copyright (C) 2010-2018 RhodeCode GmbH
2 2 // #
3 3 // # This program is free software: you can redistribute it and/or modify
4 4 // # it under the terms of the GNU Affero General Public License, version 3
5 5 // # (only), as published by the Free Software Foundation.
6 6 // #
7 7 // # This program is distributed in the hope that it will be useful,
8 8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 // # GNU General Public License for more details.
11 11 // #
12 12 // # You should have received a copy of the GNU Affero General Public License
13 13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 14 // #
15 15 // # This program is dual-licensed. If you wish to learn more about the
16 16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18 18
19 19 var firefoxAnchorFix = function() {
20 20 // hack to make anchor links behave properly on firefox, in our inline
21 21 // comments generation when comments are injected firefox is misbehaving
22 22 // when jumping to anchor links
23 23 if (location.href.indexOf('#') > -1) {
24 24 location.href += '';
25 25 }
26 26 };
27 27
28 28 var linkifyComments = function(comments) {
29 29 var firstCommentId = null;
30 30 if (comments) {
31 31 firstCommentId = $(comments[0]).data('comment-id');
32 32 }
33 33
34 34 if (firstCommentId){
35 35 $('#inline-comments-counter').attr('href', '#comment-' + firstCommentId);
36 36 }
37 37 };
38 38
39 39 var bindToggleButtons = function() {
40 40 $('.comment-toggle').on('click', function() {
41 41 $(this).parent().nextUntil('tr.line').toggle('inline-comments');
42 42 });
43 43 };
44 44
45 45
46 46
47 47 var _submitAjaxPOST = function(url, postData, successHandler, failHandler) {
48 48 failHandler = failHandler || function() {};
49 49 postData = toQueryString(postData);
50 50 var request = $.ajax({
51 51 url: url,
52 52 type: 'POST',
53 53 data: postData,
54 54 headers: {'X-PARTIAL-XHR': true}
55 55 })
56 56 .done(function (data) {
57 57 successHandler(data);
58 58 })
59 59 .fail(function (data, textStatus, errorThrown) {
60 60 failHandler(data, textStatus, errorThrown)
61 61 });
62 62 return request;
63 63 };
64 64
65 65
66 66
67 67
68 68 /* Comment form for main and inline comments */
69 69 (function(mod) {
70 70
71 71 if (typeof exports == "object" && typeof module == "object") {
72 72 // CommonJS
73 73 module.exports = mod();
74 74 }
75 75 else {
76 76 // Plain browser env
77 77 (this || window).CommentForm = mod();
78 78 }
79 79
80 80 })(function() {
81 81 "use strict";
82 82
83 83 function CommentForm(formElement, commitId, pullRequestId, lineNo, initAutocompleteActions, resolvesCommentId) {
84 84 if (!(this instanceof CommentForm)) {
85 85 return new CommentForm(formElement, commitId, pullRequestId, lineNo, initAutocompleteActions, resolvesCommentId);
86 86 }
87 87
88 88 // bind the element instance to our Form
89 89 $(formElement).get(0).CommentForm = this;
90 90
91 91 this.withLineNo = function(selector) {
92 92 var lineNo = this.lineNo;
93 93 if (lineNo === undefined) {
94 94 return selector
95 95 } else {
96 96 return selector + '_' + lineNo;
97 97 }
98 98 };
99 99
100 100 this.commitId = commitId;
101 101 this.pullRequestId = pullRequestId;
102 102 this.lineNo = lineNo;
103 103 this.initAutocompleteActions = initAutocompleteActions;
104 104
105 105 this.previewButton = this.withLineNo('#preview-btn');
106 106 this.previewContainer = this.withLineNo('#preview-container');
107 107
108 108 this.previewBoxSelector = this.withLineNo('#preview-box');
109 109
110 110 this.editButton = this.withLineNo('#edit-btn');
111 111 this.editContainer = this.withLineNo('#edit-container');
112 112 this.cancelButton = this.withLineNo('#cancel-btn');
113 113 this.commentType = this.withLineNo('#comment_type');
114 114
115 115 this.resolvesId = null;
116 116 this.resolvesActionId = null;
117 117
118 118 this.closesPr = '#close_pull_request';
119 119
120 120 this.cmBox = this.withLineNo('#text');
121 121 this.cm = initCommentBoxCodeMirror(this, this.cmBox, this.initAutocompleteActions);
122 122
123 123 this.statusChange = this.withLineNo('#change_status');
124 124
125 125 this.submitForm = formElement;
126 126 this.submitButton = $(this.submitForm).find('input[type="submit"]');
127 127 this.submitButtonText = this.submitButton.val();
128 128
129 129 this.previewUrl = pyroutes.url('repo_commit_comment_preview',
130 130 {'repo_name': templateContext.repo_name,
131 131 'commit_id': templateContext.commit_data.commit_id});
132 132
133 133 if (resolvesCommentId){
134 134 this.resolvesId = '#resolve_comment_{0}'.format(resolvesCommentId);
135 135 this.resolvesActionId = '#resolve_comment_action_{0}'.format(resolvesCommentId);
136 136 $(this.commentType).prop('disabled', true);
137 137 $(this.commentType).addClass('disabled');
138 138
139 139 // disable select
140 140 setTimeout(function() {
141 141 $(self.statusChange).select2('readonly', true);
142 142 }, 10);
143 143
144 144 var resolvedInfo = (
145 145 '<li class="resolve-action">' +
146 146 '<input type="hidden" id="resolve_comment_{0}" name="resolve_comment_{0}" value="{0}">' +
147 147 '<button id="resolve_comment_action_{0}" class="resolve-text btn btn-sm" onclick="return Rhodecode.comments.submitResolution({0})">{1} #{0}</button>' +
148 148 '</li>'
149 149 ).format(resolvesCommentId, _gettext('resolve comment'));
150 150 $(resolvedInfo).insertAfter($(this.commentType).parent());
151 151 }
152 152
153 153 // based on commitId, or pullRequestId decide where do we submit
154 154 // out data
155 155 if (this.commitId){
156 156 this.submitUrl = pyroutes.url('repo_commit_comment_create',
157 157 {'repo_name': templateContext.repo_name,
158 158 'commit_id': this.commitId});
159 159 this.selfUrl = pyroutes.url('repo_commit',
160 160 {'repo_name': templateContext.repo_name,
161 161 'commit_id': this.commitId});
162 162
163 163 } else if (this.pullRequestId) {
164 164 this.submitUrl = pyroutes.url('pullrequest_comment_create',
165 165 {'repo_name': templateContext.repo_name,
166 166 'pull_request_id': this.pullRequestId});
167 167 this.selfUrl = pyroutes.url('pullrequest_show',
168 168 {'repo_name': templateContext.repo_name,
169 169 'pull_request_id': this.pullRequestId});
170 170
171 171 } else {
172 172 throw new Error(
173 173 'CommentForm requires pullRequestId, or commitId to be specified.')
174 174 }
175 175
176 176 // FUNCTIONS and helpers
177 177 var self = this;
178 178
179 179 this.isInline = function(){
180 180 return this.lineNo && this.lineNo != 'general';
181 181 };
182 182
183 183 this.getCmInstance = function(){
184 184 return this.cm
185 185 };
186 186
187 187 this.setPlaceholder = function(placeholder) {
188 188 var cm = this.getCmInstance();
189 189 if (cm){
190 190 cm.setOption('placeholder', placeholder);
191 191 }
192 192 };
193 193
194 194 this.getCommentStatus = function() {
195 195 return $(this.submitForm).find(this.statusChange).val();
196 196 };
197 197 this.getCommentType = function() {
198 198 return $(this.submitForm).find(this.commentType).val();
199 199 };
200 200
201 201 this.getResolvesId = function() {
202 202 return $(this.submitForm).find(this.resolvesId).val() || null;
203 203 };
204 204
205 205 this.getClosePr = function() {
206 206 return $(this.submitForm).find(this.closesPr).val() || null;
207 207 };
208 208
209 209 this.markCommentResolved = function(resolvedCommentId){
210 210 $('#comment-label-{0}'.format(resolvedCommentId)).find('.resolved').show();
211 211 $('#comment-label-{0}'.format(resolvedCommentId)).find('.resolve').hide();
212 212 };
213 213
214 214 this.isAllowedToSubmit = function() {
215 215 return !$(this.submitButton).prop('disabled');
216 216 };
217 217
218 218 this.initStatusChangeSelector = function(){
219 219 var formatChangeStatus = function(state, escapeMarkup) {
220 220 var originalOption = state.element;
221 221 return '<div class="flag_status ' + $(originalOption).data('status') + ' pull-left"></div>' +
222 222 '<span>' + escapeMarkup(state.text) + '</span>';
223 223 };
224 224 var formatResult = function(result, container, query, escapeMarkup) {
225 225 return formatChangeStatus(result, escapeMarkup);
226 226 };
227 227
228 228 var formatSelection = function(data, container, escapeMarkup) {
229 229 return formatChangeStatus(data, escapeMarkup);
230 230 };
231 231
232 232 $(this.submitForm).find(this.statusChange).select2({
233 233 placeholder: _gettext('Status Review'),
234 234 formatResult: formatResult,
235 235 formatSelection: formatSelection,
236 236 containerCssClass: "drop-menu status_box_menu",
237 237 dropdownCssClass: "drop-menu-dropdown",
238 238 dropdownAutoWidth: true,
239 239 minimumResultsForSearch: -1
240 240 });
241 241 $(this.submitForm).find(this.statusChange).on('change', function() {
242 242 var status = self.getCommentStatus();
243 243
244 244 if (status && !self.isInline()) {
245 245 $(self.submitButton).prop('disabled', false);
246 246 }
247 247
248 248 var placeholderText = _gettext('Comment text will be set automatically based on currently selected status ({0}) ...').format(status);
249 249 self.setPlaceholder(placeholderText)
250 250 })
251 251 };
252 252
253 253 // reset the comment form into it's original state
254 254 this.resetCommentFormState = function(content) {
255 255 content = content || '';
256 256
257 257 $(this.editContainer).show();
258 258 $(this.editButton).parent().addClass('active');
259 259
260 260 $(this.previewContainer).hide();
261 261 $(this.previewButton).parent().removeClass('active');
262 262
263 263 this.setActionButtonsDisabled(true);
264 264 self.cm.setValue(content);
265 265 self.cm.setOption("readOnly", false);
266 266
267 267 if (this.resolvesId) {
268 268 // destroy the resolve action
269 269 $(this.resolvesId).parent().remove();
270 270 }
271 271 // reset closingPR flag
272 272 $('.close-pr-input').remove();
273 273
274 274 $(this.statusChange).select2('readonly', false);
275 275 };
276 276
277 277 this.globalSubmitSuccessCallback = function(){
278 278 // default behaviour is to call GLOBAL hook, if it's registered.
279 279 if (window.commentFormGlobalSubmitSuccessCallback !== undefined){
280 280 commentFormGlobalSubmitSuccessCallback()
281 281 }
282 282 };
283 283
284 284 this.submitAjaxPOST = function(url, postData, successHandler, failHandler) {
285 285 return _submitAjaxPOST(url, postData, successHandler, failHandler);
286 286 };
287 287
288 288 // overwrite a submitHandler, we need to do it for inline comments
289 289 this.setHandleFormSubmit = function(callback) {
290 290 this.handleFormSubmit = callback;
291 291 };
292 292
293 293 // overwrite a submitSuccessHandler
294 294 this.setGlobalSubmitSuccessCallback = function(callback) {
295 295 this.globalSubmitSuccessCallback = callback;
296 296 };
297 297
298 298 // default handler for for submit for main comments
299 299 this.handleFormSubmit = function() {
300 300 var text = self.cm.getValue();
301 301 var status = self.getCommentStatus();
302 302 var commentType = self.getCommentType();
303 303 var resolvesCommentId = self.getResolvesId();
304 304 var closePullRequest = self.getClosePr();
305 305
306 306 if (text === "" && !status) {
307 307 return;
308 308 }
309 309
310 310 var excludeCancelBtn = false;
311 311 var submitEvent = true;
312 312 self.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
313 313 self.cm.setOption("readOnly", true);
314 314
315 315 var postData = {
316 316 'text': text,
317 317 'changeset_status': status,
318 318 'comment_type': commentType,
319 319 'csrf_token': CSRF_TOKEN
320 320 };
321 321
322 322 if (resolvesCommentId) {
323 323 postData['resolves_comment_id'] = resolvesCommentId;
324 324 }
325 325
326 326 if (closePullRequest) {
327 327 postData['close_pull_request'] = true;
328 328 }
329 329
330 330 var submitSuccessCallback = function(o) {
331 331 // reload page if we change status for single commit.
332 332 if (status && self.commitId) {
333 333 location.reload(true);
334 334 } else {
335 335 $('#injected_page_comments').append(o.rendered_text);
336 336 self.resetCommentFormState();
337 337 timeagoActivate();
338 338
339 339 // mark visually which comment was resolved
340 340 if (resolvesCommentId) {
341 341 self.markCommentResolved(resolvesCommentId);
342 342 }
343 343 }
344 344
345 345 // run global callback on submit
346 346 self.globalSubmitSuccessCallback();
347 347
348 348 };
349 349 var submitFailCallback = function(data) {
350 350 alert(
351 351 "Error while submitting comment.\n" +
352 352 "Error code {0} ({1}).".format(data.status, data.statusText)
353 353 );
354 354 self.resetCommentFormState(text);
355 355 };
356 356 self.submitAjaxPOST(
357 357 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
358 358 };
359 359
360 360 this.previewSuccessCallback = function(o) {
361 361 $(self.previewBoxSelector).html(o);
362 362 $(self.previewBoxSelector).removeClass('unloaded');
363 363
364 364 // swap buttons, making preview active
365 365 $(self.previewButton).parent().addClass('active');
366 366 $(self.editButton).parent().removeClass('active');
367 367
368 368 // unlock buttons
369 369 self.setActionButtonsDisabled(false);
370 370 };
371 371
372 372 this.setActionButtonsDisabled = function(state, excludeCancelBtn, submitEvent) {
373 373 excludeCancelBtn = excludeCancelBtn || false;
374 374 submitEvent = submitEvent || false;
375 375
376 376 $(this.editButton).prop('disabled', state);
377 377 $(this.previewButton).prop('disabled', state);
378 378
379 379 if (!excludeCancelBtn) {
380 380 $(this.cancelButton).prop('disabled', state);
381 381 }
382 382
383 383 var submitState = state;
384 384 if (!submitEvent && this.getCommentStatus() && !self.isInline()) {
385 385 // if the value of commit review status is set, we allow
386 386 // submit button, but only on Main form, isInline means inline
387 387 submitState = false
388 388 }
389 389
390 390 $(this.submitButton).prop('disabled', submitState);
391 391 if (submitEvent) {
392 392 $(this.submitButton).val(_gettext('Submitting...'));
393 393 } else {
394 394 $(this.submitButton).val(this.submitButtonText);
395 395 }
396 396
397 397 };
398 398
399 399 // lock preview/edit/submit buttons on load, but exclude cancel button
400 400 var excludeCancelBtn = true;
401 401 this.setActionButtonsDisabled(true, excludeCancelBtn);
402 402
403 403 // anonymous users don't have access to initialized CM instance
404 404 if (this.cm !== undefined){
405 405 this.cm.on('change', function(cMirror) {
406 406 if (cMirror.getValue() === "") {
407 407 self.setActionButtonsDisabled(true, excludeCancelBtn)
408 408 } else {
409 409 self.setActionButtonsDisabled(false, excludeCancelBtn)
410 410 }
411 411 });
412 412 }
413 413
414 414 $(this.editButton).on('click', function(e) {
415 415 e.preventDefault();
416 416
417 417 $(self.previewButton).parent().removeClass('active');
418 418 $(self.previewContainer).hide();
419 419
420 420 $(self.editButton).parent().addClass('active');
421 421 $(self.editContainer).show();
422 422
423 423 });
424 424
425 425 $(this.previewButton).on('click', function(e) {
426 426 e.preventDefault();
427 427 var text = self.cm.getValue();
428 428
429 429 if (text === "") {
430 430 return;
431 431 }
432 432
433 433 var postData = {
434 434 'text': text,
435 435 'renderer': templateContext.visual.default_renderer,
436 436 'csrf_token': CSRF_TOKEN
437 437 };
438 438
439 439 // lock ALL buttons on preview
440 440 self.setActionButtonsDisabled(true);
441 441
442 442 $(self.previewBoxSelector).addClass('unloaded');
443 443 $(self.previewBoxSelector).html(_gettext('Loading ...'));
444 444
445 445 $(self.editContainer).hide();
446 446 $(self.previewContainer).show();
447 447
448 448 // by default we reset state of comment preserving the text
449 449 var previewFailCallback = function(data){
450 450 alert(
451 451 "Error while preview of comment.\n" +
452 452 "Error code {0} ({1}).".format(data.status, data.statusText)
453 453 );
454 454 self.resetCommentFormState(text)
455 455 };
456 456 self.submitAjaxPOST(
457 457 self.previewUrl, postData, self.previewSuccessCallback,
458 458 previewFailCallback);
459 459
460 460 $(self.previewButton).parent().addClass('active');
461 461 $(self.editButton).parent().removeClass('active');
462 462 });
463 463
464 464 $(this.submitForm).submit(function(e) {
465 465 e.preventDefault();
466 466 var allowedToSubmit = self.isAllowedToSubmit();
467 467 if (!allowedToSubmit){
468 468 return false;
469 469 }
470 470 self.handleFormSubmit();
471 471 });
472 472
473 473 }
474 474
475 475 return CommentForm;
476 476 });
477 477
478 478 /* comments controller */
479 479 var CommentsController = function() {
480 480 var mainComment = '#text';
481 481 var self = this;
482 482
483 483 this.cancelComment = function(node) {
484 484 var $node = $(node);
485 485 var $td = $node.closest('td');
486 486 $node.closest('.comment-inline-form').remove();
487 487 return false;
488 488 };
489 489
490 490 this.getLineNumber = function(node) {
491 491 var $node = $(node);
492 492 var lineNo = $node.closest('td').attr('data-line-no');
493 493 if (lineNo === undefined && $node.data('commentInline')){
494 494 lineNo = $node.data('commentLineNo')
495 495 }
496 496
497 497 return lineNo
498 498 };
499 499
500 500 this.scrollToComment = function(node, offset, outdated) {
501 501 if (offset === undefined) {
502 502 offset = 0;
503 503 }
504 504 var outdated = outdated || false;
505 505 var klass = outdated ? 'div.comment-outdated' : 'div.comment-current';
506 506
507 507 if (!node) {
508 508 node = $('.comment-selected');
509 509 if (!node.length) {
510 510 node = $('comment-current')
511 511 }
512 512 }
513 513 $wrapper = $(node).closest('div.comment');
514 514 $comment = $(node).closest(klass);
515 515 $comments = $(klass);
516 516
517 517 // show hidden comment when referenced.
518 518 if (!$wrapper.is(':visible')){
519 519 $wrapper.show();
520 520 }
521 521
522 522 $('.comment-selected').removeClass('comment-selected');
523 523
524 524 var nextIdx = $(klass).index($comment) + offset;
525 525 if (nextIdx >= $comments.length) {
526 526 nextIdx = 0;
527 527 }
528 528 var $next = $(klass).eq(nextIdx);
529 529
530 530 var $cb = $next.closest('.cb');
531 531 $cb.removeClass('cb-collapsed');
532 532
533 533 var $filediffCollapseState = $cb.closest('.filediff').prev();
534 534 $filediffCollapseState.prop('checked', false);
535 535 $next.addClass('comment-selected');
536 536 scrollToElement($next);
537 537 return false;
538 538 };
539 539
540 540 this.nextComment = function(node) {
541 541 return self.scrollToComment(node, 1);
542 542 };
543 543
544 544 this.prevComment = function(node) {
545 545 return self.scrollToComment(node, -1);
546 546 };
547 547
548 548 this.nextOutdatedComment = function(node) {
549 549 return self.scrollToComment(node, 1, true);
550 550 };
551 551
552 552 this.prevOutdatedComment = function(node) {
553 553 return self.scrollToComment(node, -1, true);
554 554 };
555 555
556 556 this.deleteComment = function(node) {
557 557 if (!confirm(_gettext('Delete this comment?'))) {
558 558 return false;
559 559 }
560 560 var $node = $(node);
561 561 var $td = $node.closest('td');
562 562 var $comment = $node.closest('.comment');
563 563 var comment_id = $comment.attr('data-comment-id');
564 564 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
565 565 var postData = {
566 566 'csrf_token': CSRF_TOKEN
567 567 };
568 568
569 569 $comment.addClass('comment-deleting');
570 570 $comment.hide('fast');
571 571
572 572 var success = function(response) {
573 573 $comment.remove();
574 574 return false;
575 575 };
576 576 var failure = function(data, textStatus, xhr) {
577 577 alert("error processing request: " + textStatus);
578 578 $comment.show('fast');
579 579 $comment.removeClass('comment-deleting');
580 580 return false;
581 581 };
582 582 ajaxPOST(url, postData, success, failure);
583 583 };
584 584
585 585 this.toggleWideMode = function (node) {
586 586 if ($('#content').hasClass('wrapper')) {
587 587 $('#content').removeClass("wrapper");
588 588 $('#content').addClass("wide-mode-wrapper");
589 589 $(node).addClass('btn-success');
590 590 } else {
591 591 $('#content').removeClass("wide-mode-wrapper");
592 592 $('#content').addClass("wrapper");
593 593 $(node).removeClass('btn-success');
594 594 }
595 595 return false;
596 596 };
597 597
598 598 this.toggleComments = function(node, show) {
599 599 var $filediff = $(node).closest('.filediff');
600 600 if (show === true) {
601 601 $filediff.removeClass('hide-comments');
602 602 } else if (show === false) {
603 603 $filediff.find('.hide-line-comments').removeClass('hide-line-comments');
604 604 $filediff.addClass('hide-comments');
605 605 } else {
606 606 $filediff.find('.hide-line-comments').removeClass('hide-line-comments');
607 607 $filediff.toggleClass('hide-comments');
608 608 }
609 609 return false;
610 610 };
611 611
612 612 this.toggleLineComments = function(node) {
613 613 self.toggleComments(node, true);
614 614 var $node = $(node);
615 615 // mark outdated comments as visible before the toggle;
616 616 $(node.closest('tr')).find('.comment-outdated').show();
617 617 $node.closest('tr').toggleClass('hide-line-comments');
618 618 };
619 619
620 620 this.createCommentForm = function(formElement, lineno, placeholderText, initAutocompleteActions, resolvesCommentId){
621 621 var pullRequestId = templateContext.pull_request_data.pull_request_id;
622 622 var commitId = templateContext.commit_data.commit_id;
623 623
624 624 var commentForm = new CommentForm(
625 625 formElement, commitId, pullRequestId, lineno, initAutocompleteActions, resolvesCommentId);
626 626 var cm = commentForm.getCmInstance();
627 627
628 628 if (resolvesCommentId){
629 629 var placeholderText = _gettext('Leave a comment, or click resolve button to resolve TODO comment #{0}').format(resolvesCommentId);
630 630 }
631 631
632 632 setTimeout(function() {
633 633 // callbacks
634 634 if (cm !== undefined) {
635 635 commentForm.setPlaceholder(placeholderText);
636 636 if (commentForm.isInline()) {
637 637 cm.focus();
638 638 cm.refresh();
639 639 }
640 640 }
641 641 }, 10);
642 642
643 643 // trigger scrolldown to the resolve comment, since it might be away
644 644 // from the clicked
645 645 if (resolvesCommentId){
646 646 var actionNode = $(commentForm.resolvesActionId).offset();
647 647
648 648 setTimeout(function() {
649 649 if (actionNode) {
650 650 $('body, html').animate({scrollTop: actionNode.top}, 10);
651 651 }
652 652 }, 100);
653 653 }
654 654
655 655 return commentForm;
656 656 };
657 657
658 658 this.createGeneralComment = function (lineNo, placeholderText, resolvesCommentId) {
659 659
660 660 var tmpl = $('#cb-comment-general-form-template').html();
661 661 tmpl = tmpl.format(null, 'general');
662 662 var $form = $(tmpl);
663 663
664 664 var $formPlaceholder = $('#cb-comment-general-form-placeholder');
665 665 var curForm = $formPlaceholder.find('form');
666 666 if (curForm){
667 667 curForm.remove();
668 668 }
669 669 $formPlaceholder.append($form);
670 670
671 671 var _form = $($form[0]);
672 672 var autocompleteActions = ['approve', 'reject', 'as_note', 'as_todo'];
673 673 var commentForm = this.createCommentForm(
674 674 _form, lineNo, placeholderText, autocompleteActions, resolvesCommentId);
675 675 commentForm.initStatusChangeSelector();
676 676
677 677 return commentForm;
678 678 };
679 679
680 680 this.createComment = function(node, resolutionComment) {
681 681 var resolvesCommentId = resolutionComment || null;
682 682 var $node = $(node);
683 683 var $td = $node.closest('td');
684 684 var $form = $td.find('.comment-inline-form');
685 685
686 686 if (!$form.length) {
687 687
688 688 var $filediff = $node.closest('.filediff');
689 689 $filediff.removeClass('hide-comments');
690 690 var f_path = $filediff.attr('data-f-path');
691 691 var lineno = self.getLineNumber(node);
692 692 // create a new HTML from template
693 693 var tmpl = $('#cb-comment-inline-form-template').html();
694 694 tmpl = tmpl.format(escapeHtml(f_path), lineno);
695 695 $form = $(tmpl);
696 696
697 697 var $comments = $td.find('.inline-comments');
698 698 if (!$comments.length) {
699 699 $comments = $(
700 700 $('#cb-comments-inline-container-template').html());
701 701 $td.append($comments);
702 702 }
703 703
704 704 $td.find('.cb-comment-add-button').before($form);
705 705
706 706 var placeholderText = _gettext('Leave a comment on line {0}.').format(lineno);
707 707 var _form = $($form[0]).find('form');
708 708 var autocompleteActions = ['as_note', 'as_todo'];
709 709 var commentForm = this.createCommentForm(
710 710 _form, lineno, placeholderText, autocompleteActions, resolvesCommentId);
711 711
712 712 $.Topic('/ui/plugins/code/comment_form_built').prepareOrPublish({
713 713 form: _form,
714 714 parent: $td[0],
715 715 lineno: lineno,
716 716 f_path: f_path}
717 717 );
718 718
719 719 // set a CUSTOM submit handler for inline comments.
720 720 commentForm.setHandleFormSubmit(function(o) {
721 721 var text = commentForm.cm.getValue();
722 722 var commentType = commentForm.getCommentType();
723 723 var resolvesCommentId = commentForm.getResolvesId();
724 724
725 725 if (text === "") {
726 726 return;
727 727 }
728 728
729 729 if (lineno === undefined) {
730 730 alert('missing line !');
731 731 return;
732 732 }
733 733 if (f_path === undefined) {
734 734 alert('missing file path !');
735 735 return;
736 736 }
737 737
738 738 var excludeCancelBtn = false;
739 739 var submitEvent = true;
740 740 commentForm.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
741 741 commentForm.cm.setOption("readOnly", true);
742 742 var postData = {
743 743 'text': text,
744 744 'f_path': f_path,
745 745 'line': lineno,
746 746 'comment_type': commentType,
747 747 'csrf_token': CSRF_TOKEN
748 748 };
749 749 if (resolvesCommentId){
750 750 postData['resolves_comment_id'] = resolvesCommentId;
751 751 }
752 752
753 753 var submitSuccessCallback = function(json_data) {
754 754 $form.remove();
755 755 try {
756 756 var html = json_data.rendered_text;
757 757 var lineno = json_data.line_no;
758 758 var target_id = json_data.target_id;
759 759
760 760 $comments.find('.cb-comment-add-button').before(html);
761 761
762 762 //mark visually which comment was resolved
763 763 if (resolvesCommentId) {
764 764 commentForm.markCommentResolved(resolvesCommentId);
765 765 }
766 766
767 767 // run global callback on submit
768 768 commentForm.globalSubmitSuccessCallback();
769 769
770 770 } catch (e) {
771 771 console.error(e);
772 772 }
773 773
774 774 // re trigger the linkification of next/prev navigation
775 775 linkifyComments($('.inline-comment-injected'));
776 776 timeagoActivate();
777 777
778 if (window.Waypoint !== undefined) {
778 if (window.updateSticky !== undefined) {
779 779 // potentially our comments change the active window size, so we
780 // notify waypint to re-paint
781 Waypoint.refreshAll()
780 // notify sticky elements
781 updateSticky()
782 782 }
783 783
784 784 commentForm.setActionButtonsDisabled(false);
785 785
786 786 };
787 787 var submitFailCallback = function(data){
788 788 alert(
789 789 "Error while submitting comment.\n" +
790 790 "Error code {0} ({1}).".format(data.status, data.statusText)
791 791 );
792 792 commentForm.resetCommentFormState(text)
793 793 };
794 794 commentForm.submitAjaxPOST(
795 795 commentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
796 796 });
797 797 }
798 798
799 799 $form.addClass('comment-inline-form-open');
800 800 };
801 801
802 802 this.createResolutionComment = function(commentId){
803 803 // hide the trigger text
804 804 $('#resolve-comment-{0}'.format(commentId)).hide();
805 805
806 806 var comment = $('#comment-'+commentId);
807 807 var commentData = comment.data();
808 808 if (commentData.commentInline) {
809 809 this.createComment(comment, commentId)
810 810 } else {
811 811 Rhodecode.comments.createGeneralComment('general', "$placeholder", commentId)
812 812 }
813 813
814 814 return false;
815 815 };
816 816
817 817 this.submitResolution = function(commentId){
818 818 var form = $('#resolve_comment_{0}'.format(commentId)).closest('form');
819 819 var commentForm = form.get(0).CommentForm;
820 820
821 821 var cm = commentForm.getCmInstance();
822 822 var renderer = templateContext.visual.default_renderer;
823 823 if (renderer == 'rst'){
824 824 var commentUrl = '`#{0} <{1}#comment-{0}>`_'.format(commentId, commentForm.selfUrl);
825 825 } else if (renderer == 'markdown') {
826 826 var commentUrl = '[#{0}]({1}#comment-{0})'.format(commentId, commentForm.selfUrl);
827 827 } else {
828 828 var commentUrl = '{1}#comment-{0}'.format(commentId, commentForm.selfUrl);
829 829 }
830 830
831 831 cm.setValue(_gettext('TODO from comment {0} was fixed.').format(commentUrl));
832 832 form.submit();
833 833 return false;
834 834 };
835 835
836 836 };
@@ -1,969 +1,970 b''
1 1 <%namespace name="commentblock" file="/changeset/changeset_file_comment.mako"/>
2 2
3 3 <%def name="diff_line_anchor(filename, line, type)"><%
4 4 return '%s_%s_%i' % (h.safeid(filename), type, line)
5 5 %></%def>
6 6
7 7 <%def name="action_class(action)">
8 8 <%
9 9 return {
10 10 '-': 'cb-deletion',
11 11 '+': 'cb-addition',
12 12 ' ': 'cb-context',
13 13 }.get(action, 'cb-empty')
14 14 %>
15 15 </%def>
16 16
17 17 <%def name="op_class(op_id)">
18 18 <%
19 19 return {
20 20 DEL_FILENODE: 'deletion', # file deleted
21 21 BIN_FILENODE: 'warning' # binary diff hidden
22 22 }.get(op_id, 'addition')
23 23 %>
24 24 </%def>
25 25
26 26
27 27
28 28 <%def name="render_diffset(diffset, commit=None,
29 29
30 30 # collapse all file diff entries when there are more than this amount of files in the diff
31 31 collapse_when_files_over=20,
32 32
33 33 # collapse lines in the diff when more than this amount of lines changed in the file diff
34 34 lines_changed_limit=500,
35 35
36 36 # add a ruler at to the output
37 37 ruler_at_chars=0,
38 38
39 39 # show inline comments
40 40 use_comments=False,
41 41
42 42 # disable new comments
43 43 disable_new_comments=False,
44 44
45 45 # special file-comments that were deleted in previous versions
46 46 # it's used for showing outdated comments for deleted files in a PR
47 47 deleted_files_comments=None,
48 48
49 49 # for cache purpose
50 50 inline_comments=None,
51 51
52 52 )">
53 53 %if use_comments:
54 54 <div id="cb-comments-inline-container-template" class="js-template">
55 55 ${inline_comments_container([], inline_comments)}
56 56 </div>
57 57 <div class="js-template" id="cb-comment-inline-form-template">
58 58 <div class="comment-inline-form ac">
59 59
60 60 %if c.rhodecode_user.username != h.DEFAULT_USER:
61 61 ## render template for inline comments
62 62 ${commentblock.comment_form(form_type='inline')}
63 63 %else:
64 64 ${h.form('', class_='inline-form comment-form-login', method='get')}
65 65 <div class="pull-left">
66 66 <div class="comment-help pull-right">
67 67 ${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
68 68 </div>
69 69 </div>
70 70 <div class="comment-button pull-right">
71 71 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
72 72 ${_('Cancel')}
73 73 </button>
74 74 </div>
75 75 <div class="clearfix"></div>
76 76 ${h.end_form()}
77 77 %endif
78 78 </div>
79 79 </div>
80 80
81 81 %endif
82 82 <%
83 83 collapse_all = len(diffset.files) > collapse_when_files_over
84 84 %>
85 85
86 86 %if c.user_session_attrs["diffmode"] == 'sideside':
87 87 <style>
88 88 .wrapper {
89 89 max-width: 1600px !important;
90 90 }
91 91 </style>
92 92 %endif
93 93
94 94 %if ruler_at_chars:
95 95 <style>
96 96 .diff table.cb .cb-content:after {
97 97 content: "";
98 98 border-left: 1px solid blue;
99 99 position: absolute;
100 100 top: 0;
101 101 height: 18px;
102 102 opacity: .2;
103 103 z-index: 10;
104 104 //## +5 to account for diff action (+/-)
105 105 left: ${ruler_at_chars + 5}ch;
106 106 </style>
107 107 %endif
108 108
109 109 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
110 110 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
111 111 %if commit:
112 112 <div class="pull-right">
113 113 <a class="btn tooltip" title="${h.tooltip(_('Browse Files at revision {}').format(commit.raw_id))}" href="${h.route_path('repo_files',repo_name=diffset.repo_name, commit_id=commit.raw_id, f_path='')}">
114 114 ${_('Browse Files')}
115 115 </a>
116 116 </div>
117 117 %endif
118 118 <h2 class="clearinner">
119 119 ## invidual commit
120 120 % if commit:
121 121 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=diffset.repo_name,commit_id=commit.raw_id)}">${('r%s:%s' % (commit.idx,h.short_id(commit.raw_id)))}</a> -
122 122 ${h.age_component(commit.date)}
123 123 % if diffset.limited_diff:
124 124 - ${_('The requested commit is too big and content was truncated.')}
125 125 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
126 126 <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
127 127 % elif hasattr(c, 'commit_ranges') and len(c.commit_ranges) > 1:
128 128 ## compare diff, has no file-selector and we want to show stats anyway
129 129 ${_ungettext('{num} file changed: {linesadd} inserted, ''{linesdel} deleted',
130 130 '{num} files changed: {linesadd} inserted, {linesdel} deleted', diffset.changed_files) \
131 131 .format(num=diffset.changed_files, linesadd=diffset.lines_added, linesdel=diffset.lines_deleted)}
132 132 % endif
133 133 % else:
134 134 ## pull requests/compare
135 135 ${_('File Changes')}
136 136 % endif
137 137
138 138 </h2>
139 139 </div>
140 140
141 141 %if diffset.has_hidden_changes:
142 142 <p class="empty_data">${_('Some changes may be hidden')}</p>
143 143 %elif not diffset.files:
144 144 <p class="empty_data">${_('No files')}</p>
145 145 %endif
146 146
147 147 <div class="filediffs">
148 148
149 149 ## initial value could be marked as False later on
150 150 <% over_lines_changed_limit = False %>
151 151 %for i, filediff in enumerate(diffset.files):
152 152
153 153 <%
154 154 lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
155 155 over_lines_changed_limit = lines_changed > lines_changed_limit
156 156 %>
157 157 ## anchor with support of sticky header
158 158 <div class="anchor" id="a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"></div>
159 159
160 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox" onchange="Waypoint.refreshAll();">
160 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox" onchange="updateSticky();">
161 161 <div
162 162 class="filediff"
163 163 data-f-path="${filediff.patch['filename']}"
164 164 data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}"
165 165 >
166 166 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
167 167 <div class="filediff-collapse-indicator"></div>
168 168 ${diff_ops(filediff)}
169 169 </label>
170 170
171 171 ${diff_menu(filediff, use_comments=use_comments)}
172 172 <table data-f-path="${filediff.patch['filename']}" data-anchor-id="${h.FID(filediff.raw_id, filediff.patch['filename'])}" class="code-visible-block cb cb-diff-${c.user_session_attrs["diffmode"]} code-highlight ${(over_lines_changed_limit and 'cb-collapsed' or '')}">
173 173
174 174 ## new/deleted/empty content case
175 175 % if not filediff.hunks:
176 176 ## Comment container, on "fakes" hunk that contains all data to render comments
177 177 ${render_hunk_lines(c.user_session_attrs["diffmode"], filediff.hunk_ops, use_comments=use_comments, inline_comments=inline_comments)}
178 178 % endif
179 179
180 180 %if filediff.limited_diff:
181 181 <tr class="cb-warning cb-collapser">
182 182 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
183 183 ${_('The requested commit is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
184 184 </td>
185 185 </tr>
186 186 %else:
187 187 %if over_lines_changed_limit:
188 188 <tr class="cb-warning cb-collapser">
189 189 <td class="cb-text" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=6')}>
190 190 ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)}
191 191 <a href="#" class="cb-expand"
192 onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')}
192 onclick="$(this).closest('table').removeClass('cb-collapsed'); updateSticky(); return false;">${_('Show them')}
193 193 </a>
194 194 <a href="#" class="cb-collapse"
195 onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')}
195 onclick="$(this).closest('table').addClass('cb-collapsed'); updateSticky(); return false;">${_('Hide them')}
196 196 </a>
197 197 </td>
198 198 </tr>
199 199 %endif
200 200 %endif
201 201
202 202 % for hunk in filediff.hunks:
203 203 <tr class="cb-hunk">
204 204 <td ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=3' or '')}>
205 205 ## TODO: dan: add ajax loading of more context here
206 206 ## <a href="#">
207 207 <i class="icon-more"></i>
208 208 ## </a>
209 209 </td>
210 210 <td ${(c.user_session_attrs["diffmode"] == 'sideside' and 'colspan=5' or '')}>
211 211 @@
212 212 -${hunk.source_start},${hunk.source_length}
213 213 +${hunk.target_start},${hunk.target_length}
214 214 ${hunk.section_header}
215 215 </td>
216 216 </tr>
217 217 ${render_hunk_lines(c.user_session_attrs["diffmode"], hunk, use_comments=use_comments, inline_comments=inline_comments)}
218 218 % endfor
219 219
220 220 <% unmatched_comments = (inline_comments or {}).get(filediff.patch['filename'], {}) %>
221 221
222 222 ## outdated comments that do not fit into currently displayed lines
223 223 % for lineno, comments in unmatched_comments.items():
224 224
225 225 %if c.user_session_attrs["diffmode"] == 'unified':
226 226 % if loop.index == 0:
227 227 <tr class="cb-hunk">
228 228 <td colspan="3"></td>
229 229 <td>
230 230 <div>
231 231 ${_('Unmatched inline comments below')}
232 232 </div>
233 233 </td>
234 234 </tr>
235 235 % endif
236 236 <tr class="cb-line">
237 237 <td class="cb-data cb-context"></td>
238 238 <td class="cb-lineno cb-context"></td>
239 239 <td class="cb-lineno cb-context"></td>
240 240 <td class="cb-content cb-context">
241 241 ${inline_comments_container(comments, inline_comments)}
242 242 </td>
243 243 </tr>
244 244 %elif c.user_session_attrs["diffmode"] == 'sideside':
245 245 % if loop.index == 0:
246 246 <tr class="cb-comment-info">
247 247 <td colspan="2"></td>
248 248 <td class="cb-line">
249 249 <div>
250 250 ${_('Unmatched inline comments below')}
251 251 </div>
252 252 </td>
253 253 <td colspan="2"></td>
254 254 <td class="cb-line">
255 255 <div>
256 256 ${_('Unmatched comments below')}
257 257 </div>
258 258 </td>
259 259 </tr>
260 260 % endif
261 261 <tr class="cb-line">
262 262 <td class="cb-data cb-context"></td>
263 263 <td class="cb-lineno cb-context"></td>
264 264 <td class="cb-content cb-context">
265 265 % if lineno.startswith('o'):
266 266 ${inline_comments_container(comments, inline_comments)}
267 267 % endif
268 268 </td>
269 269
270 270 <td class="cb-data cb-context"></td>
271 271 <td class="cb-lineno cb-context"></td>
272 272 <td class="cb-content cb-context">
273 273 % if lineno.startswith('n'):
274 274 ${inline_comments_container(comments, inline_comments)}
275 275 % endif
276 276 </td>
277 277 </tr>
278 278 %endif
279 279
280 280 % endfor
281 281
282 282 </table>
283 283 </div>
284 284 %endfor
285 285
286 286 ## outdated comments that are made for a file that has been deleted
287 287 % for filename, comments_dict in (deleted_files_comments or {}).items():
288 288 <%
289 289 display_state = 'display: none'
290 290 open_comments_in_file = [x for x in comments_dict['comments'] if x.outdated is False]
291 291 if open_comments_in_file:
292 292 display_state = ''
293 293 %>
294 294 <div class="filediffs filediff-outdated" style="${display_state}">
295 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox" onchange="Waypoint.refreshAll();">
295 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox" onchange="updateSticky();">
296 296 <div class="filediff" data-f-path="${filename}" id="a_${h.FID(filediff.raw_id, filename)}">
297 297 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
298 298 <div class="filediff-collapse-indicator"></div>
299 299 <span class="pill">
300 300 ## file was deleted
301 301 <strong>${filename}</strong>
302 302 </span>
303 303 <span class="pill-group" style="float: left">
304 304 ## file op, doesn't need translation
305 305 <span class="pill" op="removed">removed in this version</span>
306 306 </span>
307 307 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filename)}">ΒΆ</a>
308 308 <span class="pill-group" style="float: right">
309 309 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
310 310 </span>
311 311 </label>
312 312
313 313 <table class="cb cb-diff-${c.user_session_attrs["diffmode"]} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
314 314 <tr>
315 315 % if c.user_session_attrs["diffmode"] == 'unified':
316 316 <td></td>
317 317 %endif
318 318
319 319 <td></td>
320 320 <td class="cb-text cb-${op_class(BIN_FILENODE)}" ${(c.user_session_attrs["diffmode"] == 'unified' and 'colspan=4' or 'colspan=5')}>
321 321 ${_('File was deleted in this version. There are still outdated/unresolved comments attached to it.')}
322 322 </td>
323 323 </tr>
324 324 %if c.user_session_attrs["diffmode"] == 'unified':
325 325 <tr class="cb-line">
326 326 <td class="cb-data cb-context"></td>
327 327 <td class="cb-lineno cb-context"></td>
328 328 <td class="cb-lineno cb-context"></td>
329 329 <td class="cb-content cb-context">
330 330 ${inline_comments_container(comments_dict['comments'], inline_comments)}
331 331 </td>
332 332 </tr>
333 333 %elif c.user_session_attrs["diffmode"] == 'sideside':
334 334 <tr class="cb-line">
335 335 <td class="cb-data cb-context"></td>
336 336 <td class="cb-lineno cb-context"></td>
337 337 <td class="cb-content cb-context"></td>
338 338
339 339 <td class="cb-data cb-context"></td>
340 340 <td class="cb-lineno cb-context"></td>
341 341 <td class="cb-content cb-context">
342 342 ${inline_comments_container(comments_dict['comments'], inline_comments)}
343 343 </td>
344 344 </tr>
345 345 %endif
346 346 </table>
347 347 </div>
348 348 </div>
349 349 % endfor
350 350
351 351 </div>
352 352 </div>
353 353 </%def>
354 354
355 355 <%def name="diff_ops(filediff)">
356 356 <%
357 357 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
358 358 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
359 359 %>
360 360 <span class="pill">
361 361 %if filediff.source_file_path and filediff.target_file_path:
362 362 %if filediff.source_file_path != filediff.target_file_path:
363 363 ## file was renamed, or copied
364 364 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
365 365 <strong>${filediff.target_file_path}</strong> β¬… <del>${filediff.source_file_path}</del>
366 366 <% final_path = filediff.target_file_path %>
367 367 %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
368 368 <strong>${filediff.target_file_path}</strong> β¬… ${filediff.source_file_path}
369 369 <% final_path = filediff.target_file_path %>
370 370 %endif
371 371 %else:
372 372 ## file was modified
373 373 <strong>${filediff.source_file_path}</strong>
374 374 <% final_path = filediff.source_file_path %>
375 375 %endif
376 376 %else:
377 377 %if filediff.source_file_path:
378 378 ## file was deleted
379 379 <strong>${filediff.source_file_path}</strong>
380 380 <% final_path = filediff.source_file_path %>
381 381 %else:
382 382 ## file was added
383 383 <strong>${filediff.target_file_path}</strong>
384 384 <% final_path = filediff.target_file_path %>
385 385 %endif
386 386 %endif
387 387 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
388 388 </span>
389 389 ## anchor link
390 390 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filediff.patch['filename'])}">ΒΆ</a>
391 391
392 392 <span class="pill-group" style="float: right">
393 393
394 394 ## ops pills
395 395 %if filediff.limited_diff:
396 396 <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
397 397 %endif
398 398
399 399 %if NEW_FILENODE in filediff.patch['stats']['ops']:
400 400 <span class="pill" op="created">created</span>
401 401 %if filediff['target_mode'].startswith('120'):
402 402 <span class="pill" op="symlink">symlink</span>
403 403 %else:
404 404 <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span>
405 405 %endif
406 406 %endif
407 407
408 408 %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
409 409 <span class="pill" op="renamed">renamed</span>
410 410 %endif
411 411
412 412 %if COPIED_FILENODE in filediff.patch['stats']['ops']:
413 413 <span class="pill" op="copied">copied</span>
414 414 %endif
415 415
416 416 %if DEL_FILENODE in filediff.patch['stats']['ops']:
417 417 <span class="pill" op="removed">removed</span>
418 418 %endif
419 419
420 420 %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
421 421 <span class="pill" op="mode">
422 422 ${nice_mode(filediff['source_mode'])} ➑ ${nice_mode(filediff['target_mode'])}
423 423 </span>
424 424 %endif
425 425
426 426 %if BIN_FILENODE in filediff.patch['stats']['ops']:
427 427 <span class="pill" op="binary">binary</span>
428 428 %if MOD_FILENODE in filediff.patch['stats']['ops']:
429 429 <span class="pill" op="modified">modified</span>
430 430 %endif
431 431 %endif
432 432
433 433 <span class="pill" op="added">${('+' if filediff.patch['stats']['added'] else '')}${filediff.patch['stats']['added']}</span>
434 434 <span class="pill" op="deleted">${((h.safe_int(filediff.patch['stats']['deleted']) or 0) * -1)}</span>
435 435
436 436 </span>
437 437
438 438 </%def>
439 439
440 440 <%def name="nice_mode(filemode)">
441 441 ${(filemode.startswith('100') and filemode[3:] or filemode)}
442 442 </%def>
443 443
444 444 <%def name="diff_menu(filediff, use_comments=False)">
445 445 <div class="filediff-menu">
446 446 %if filediff.diffset.source_ref:
447 447 %if filediff.operation in ['D', 'M']:
448 448 <a
449 449 class="tooltip"
450 450 href="${h.route_path('repo_files',repo_name=filediff.diffset.repo_name,commit_id=filediff.diffset.source_ref,f_path=filediff.source_file_path)}"
451 451 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
452 452 >
453 453 ${_('Show file before')}
454 454 </a> |
455 455 %else:
456 456 <span
457 457 class="tooltip"
458 458 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}"
459 459 >
460 460 ${_('Show file before')}
461 461 </span> |
462 462 %endif
463 463 %if filediff.operation in ['A', 'M']:
464 464 <a
465 465 class="tooltip"
466 466 href="${h.route_path('repo_files',repo_name=filediff.diffset.source_repo_name,commit_id=filediff.diffset.target_ref,f_path=filediff.target_file_path)}"
467 467 title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
468 468 >
469 469 ${_('Show file after')}
470 470 </a> |
471 471 %else:
472 472 <span
473 473 class="tooltip"
474 474 title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}"
475 475 >
476 476 ${_('Show file after')}
477 477 </span> |
478 478 %endif
479 479 <a
480 480 class="tooltip"
481 481 title="${h.tooltip(_('Raw diff'))}"
482 482 href="${h.route_path('repo_files_diff',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path, _query=dict(diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='raw'))}"
483 483 >
484 484 ${_('Raw diff')}
485 485 </a> |
486 486 <a
487 487 class="tooltip"
488 488 title="${h.tooltip(_('Download diff'))}"
489 489 href="${h.route_path('repo_files_diff',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path, _query=dict(diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='download'))}"
490 490 >
491 491 ${_('Download diff')}
492 492 </a>
493 493 % if use_comments:
494 494 |
495 495 % endif
496 496
497 497 ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks)
498 498 %if hasattr(c, 'ignorews_url'):
499 499 ${c.ignorews_url(request, h.FID(filediff.raw_id, filediff.patch['filename']))}
500 500 %endif
501 501 %if hasattr(c, 'context_url'):
502 502 ${c.context_url(request, h.FID(filediff.raw_id, filediff.patch['filename']))}
503 503 %endif
504 504
505 505 %if use_comments:
506 506 <a href="#" onclick="return Rhodecode.comments.toggleComments(this);">
507 507 <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span>
508 508 </a>
509 509 %endif
510 510 %endif
511 511 </div>
512 512 </%def>
513 513
514 514
515 515 <%def name="inline_comments_container(comments, inline_comments)">
516 516 <div class="inline-comments">
517 517 %for comment in comments:
518 518 ${commentblock.comment_block(comment, inline=True)}
519 519 %endfor
520 520 % if comments and comments[-1].outdated:
521 521 <span class="btn btn-secondary cb-comment-add-button comment-outdated}"
522 522 style="display: none;}">
523 523 ${_('Add another comment')}
524 524 </span>
525 525 % else:
526 526 <span onclick="return Rhodecode.comments.createComment(this)"
527 527 class="btn btn-secondary cb-comment-add-button">
528 528 ${_('Add another comment')}
529 529 </span>
530 530 % endif
531 531
532 532 </div>
533 533 </%def>
534 534
535 535 <%!
536 536 def get_comments_for(diff_type, comments, filename, line_version, line_number):
537 537 if hasattr(filename, 'unicode_path'):
538 538 filename = filename.unicode_path
539 539
540 540 if not isinstance(filename, basestring):
541 541 return None
542 542
543 543 line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12
544 544
545 545 if comments and filename in comments:
546 546 file_comments = comments[filename]
547 547 if line_key in file_comments:
548 548 data = file_comments.pop(line_key)
549 549 return data
550 550 %>
551 551
552 552 <%def name="render_hunk_lines_sideside(hunk, use_comments=False, inline_comments=None)">
553 553
554 554 %for i, line in enumerate(hunk.sideside):
555 555 <%
556 556 old_line_anchor, new_line_anchor = None, None
557 557 if line.original.lineno:
558 558 old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o')
559 559 if line.modified.lineno:
560 560 new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n')
561 561 %>
562 562
563 563 <tr class="cb-line">
564 564 <td class="cb-data ${action_class(line.original.action)}"
565 565 data-line-no="${line.original.lineno}"
566 566 >
567 567 <div>
568 568
569 569 <% line_old_comments = None %>
570 570 %if line.original.get_comment_args:
571 571 <% line_old_comments = get_comments_for('side-by-side', inline_comments, *line.original.get_comment_args) %>
572 572 %endif
573 573 %if line_old_comments:
574 574 <% has_outdated = any([x.outdated for x in line_old_comments]) %>
575 575 % if has_outdated:
576 576 <i title="${_('comments including outdated')}:${len(line_old_comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
577 577 % else:
578 578 <i title="${_('comments')}: ${len(line_old_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
579 579 % endif
580 580 %endif
581 581 </div>
582 582 </td>
583 583 <td class="cb-lineno ${action_class(line.original.action)}"
584 584 data-line-no="${line.original.lineno}"
585 585 %if old_line_anchor:
586 586 id="${old_line_anchor}"
587 587 %endif
588 588 >
589 589 %if line.original.lineno:
590 590 <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a>
591 591 %endif
592 592 </td>
593 593 <td class="cb-content ${action_class(line.original.action)}"
594 594 data-line-no="o${line.original.lineno}"
595 595 >
596 596 %if use_comments and line.original.lineno:
597 597 ${render_add_comment_button()}
598 598 %endif
599 599 <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span>
600 600
601 601 %if use_comments and line.original.lineno and line_old_comments:
602 602 ${inline_comments_container(line_old_comments, inline_comments)}
603 603 %endif
604 604
605 605 </td>
606 606 <td class="cb-data ${action_class(line.modified.action)}"
607 607 data-line-no="${line.modified.lineno}"
608 608 >
609 609 <div>
610 610
611 611 %if line.modified.get_comment_args:
612 612 <% line_new_comments = get_comments_for('side-by-side', inline_comments, *line.modified.get_comment_args) %>
613 613 %else:
614 614 <% line_new_comments = None%>
615 615 %endif
616 616 %if line_new_comments:
617 617 <% has_outdated = any([x.outdated for x in line_new_comments]) %>
618 618 % if has_outdated:
619 619 <i title="${_('comments including outdated')}:${len(line_new_comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
620 620 % else:
621 621 <i title="${_('comments')}: ${len(line_new_comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
622 622 % endif
623 623 %endif
624 624 </div>
625 625 </td>
626 626 <td class="cb-lineno ${action_class(line.modified.action)}"
627 627 data-line-no="${line.modified.lineno}"
628 628 %if new_line_anchor:
629 629 id="${new_line_anchor}"
630 630 %endif
631 631 >
632 632 %if line.modified.lineno:
633 633 <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a>
634 634 %endif
635 635 </td>
636 636 <td class="cb-content ${action_class(line.modified.action)}"
637 637 data-line-no="n${line.modified.lineno}"
638 638 >
639 639 %if use_comments and line.modified.lineno:
640 640 ${render_add_comment_button()}
641 641 %endif
642 642 <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span>
643 643 %if use_comments and line.modified.lineno and line_new_comments:
644 644 ${inline_comments_container(line_new_comments, inline_comments)}
645 645 %endif
646 646 </td>
647 647 </tr>
648 648 %endfor
649 649 </%def>
650 650
651 651
652 652 <%def name="render_hunk_lines_unified(hunk, use_comments=False, inline_comments=None)">
653 653 %for old_line_no, new_line_no, action, content, comments_args in hunk.unified:
654 654 <%
655 655 old_line_anchor, new_line_anchor = None, None
656 656 if old_line_no:
657 657 old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o')
658 658 if new_line_no:
659 659 new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n')
660 660 %>
661 661 <tr class="cb-line">
662 662 <td class="cb-data ${action_class(action)}">
663 663 <div>
664 664
665 665 %if comments_args:
666 666 <% comments = get_comments_for('unified', inline_comments, *comments_args) %>
667 667 %else:
668 668 <% comments = None %>
669 669 %endif
670 670
671 671 % if comments:
672 672 <% has_outdated = any([x.outdated for x in comments]) %>
673 673 % if has_outdated:
674 674 <i title="${_('comments including outdated')}:${len(comments)}" class="icon-comment_toggle" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
675 675 % else:
676 676 <i title="${_('comments')}: ${len(comments)}" class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i>
677 677 % endif
678 678 % endif
679 679 </div>
680 680 </td>
681 681 <td class="cb-lineno ${action_class(action)}"
682 682 data-line-no="${old_line_no}"
683 683 %if old_line_anchor:
684 684 id="${old_line_anchor}"
685 685 %endif
686 686 >
687 687 %if old_line_anchor:
688 688 <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a>
689 689 %endif
690 690 </td>
691 691 <td class="cb-lineno ${action_class(action)}"
692 692 data-line-no="${new_line_no}"
693 693 %if new_line_anchor:
694 694 id="${new_line_anchor}"
695 695 %endif
696 696 >
697 697 %if new_line_anchor:
698 698 <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a>
699 699 %endif
700 700 </td>
701 701 <td class="cb-content ${action_class(action)}"
702 702 data-line-no="${(new_line_no and 'n' or 'o')}${(new_line_no or old_line_no)}"
703 703 >
704 704 %if use_comments:
705 705 ${render_add_comment_button()}
706 706 %endif
707 707 <span class="cb-code">${action} ${content or '' | n}</span>
708 708 %if use_comments and comments:
709 709 ${inline_comments_container(comments, inline_comments)}
710 710 %endif
711 711 </td>
712 712 </tr>
713 713 %endfor
714 714 </%def>
715 715
716 716
717 717 <%def name="render_hunk_lines(diff_mode, hunk, use_comments, inline_comments)">
718 718 % if diff_mode == 'unified':
719 719 ${render_hunk_lines_unified(hunk, use_comments=use_comments, inline_comments=inline_comments)}
720 720 % elif diff_mode == 'sideside':
721 721 ${render_hunk_lines_sideside(hunk, use_comments=use_comments, inline_comments=inline_comments)}
722 722 % else:
723 723 <tr class="cb-line">
724 724 <td>unknown diff mode</td>
725 725 </tr>
726 726 % endif
727 727 </%def>file changes
728 728
729 729
730 730 <%def name="render_add_comment_button()">
731 731 <button class="btn btn-small btn-primary cb-comment-box-opener" onclick="return Rhodecode.comments.createComment(this)">
732 732 <span><i class="icon-comment"></i></span>
733 733 </button>
734 734 </%def>
735 735
736 736 <%def name="render_diffset_menu(diffset=None, range_diff_on=None)">
737 737
738 738 <div id="diff-file-sticky" class="diffset-menu clearinner">
739 739 ## auto adjustable
740 740 <div class="sidebar__inner">
741 741 <div class="sidebar__bar">
742 742 <div class="pull-right">
743 743 <div class="btn-group">
744 744
745 745 <a
746 746 class="btn ${(c.user_session_attrs["diffmode"] == 'sideside' and 'btn-primary')} tooltip"
747 747 title="${h.tooltip(_('View side by side'))}"
748 748 href="${h.current_route_path(request, diffmode='sideside')}">
749 749 <span>${_('Side by Side')}</span>
750 750 </a>
751 751 <a
752 752 class="btn ${(c.user_session_attrs["diffmode"] == 'unified' and 'btn-primary')} tooltip"
753 753 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
754 754 <span>${_('Unified')}</span>
755 755 </a>
756 756 % if range_diff_on is True:
757 757 <a
758 758 title="${_('Turn off: Show the diff as commit range')}"
759 759 class="btn btn-primary"
760 760 href="${h.current_route_path(request, **{"range-diff":"0"})}">
761 761 <span>${_('Range Diff')}</span>
762 762 </a>
763 763 % elif range_diff_on is False:
764 764 <a
765 765 title="${_('Show the diff as commit range')}"
766 766 class="btn"
767 767 href="${h.current_route_path(request, **{"range-diff":"1"})}">
768 768 <span>${_('Range Diff')}</span>
769 769 </a>
770 770 % endif
771 771 </div>
772 772 </div>
773 773 <div class="pull-left">
774 774 <div class="btn-group">
775 775 <div class="pull-left">
776 776 ${h.hidden('file_filter')}
777 777 </div>
778 778 <a
779 779 class="btn"
780 780 href="#"
781 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); Waypoint.refreshAll(); return false">${_('Expand All Files')}</a>
781 onclick="$('input[class=filediff-collapse-state]').prop('checked', false); updateSticky(); return false">${_('Expand All Files')}</a>
782 782 <a
783 783 class="btn"
784 784 href="#"
785 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); Waypoint.refreshAll(); return false">${_('Collapse All Files')}</a>
785 onclick="$('input[class=filediff-collapse-state]').prop('checked', true); updateSticky(); return false">${_('Collapse All Files')}</a>
786 786 <a
787 787 class="btn"
788 788 href="#"
789 789 onclick="updateSticky();return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a>
790 790
791 791 </div>
792 792 </div>
793 793 </div>
794 794 <div class="fpath-placeholder">
795 795 <i class="icon-file-text"></i>
796 796 <strong class="fpath-placeholder-text">
797 797 Context file:
798 798 </strong>
799 799 </div>
800 800 <div class="sidebar_inner_shadow"></div>
801 801 </div>
802 802 </div>
803 803
804 804 % if diffset:
805 805
806 806 %if diffset.limited_diff:
807 807 <% file_placeholder = _ungettext('%(num)s file changed', '%(num)s files changed', diffset.changed_files) % {'num': diffset.changed_files} %>
808 808 %else:
809 809 <% file_placeholder = _ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}%>
810 810 %endif
811 811 ## case on range-diff placeholder needs to be updated
812 812 % if range_diff_on is True:
813 813 <% file_placeholder = _('Disabled on range diff') %>
814 814 % endif
815 815
816 816 <script>
817 817
818 818 var feedFilesOptions = function (query, initialData) {
819 819 var data = {results: []};
820 820 var isQuery = typeof query.term !== 'undefined';
821 821
822 822 var section = _gettext('Changed files');
823 823 var filteredData = [];
824 824
825 825 //filter results
826 826 $.each(initialData.results, function (idx, value) {
827 827
828 828 if (!isQuery || query.term.length === 0 || value.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
829 829 filteredData.push({
830 830 'id': this.id,
831 831 'text': this.text,
832 832 "ops": this.ops,
833 833 })
834 834 }
835 835
836 836 });
837 837
838 838 data.results = filteredData;
839 839
840 840 query.callback(data);
841 841 };
842 842
843 843 var formatFileResult = function(result, container, query, escapeMarkup) {
844 844 return function(data, escapeMarkup) {
845 845 var container = '<div class="filelist" style="padding-right:100px">{0}</div>';
846 846 var tmpl = '<span style="margin-right:-50px"><strong>{0}</strong></span>'.format(escapeMarkup(data['text']));
847 847 var pill = '<span class="pill-group" style="float: right;margin-right: -100px">' +
848 848 '<span class="pill" op="added">{0}</span>' +
849 849 '<span class="pill" op="deleted">{1}</span>' +
850 850 '</span>'
851 851 ;
852 852 var added = data['ops']['added'];
853 853 if (added === 0) {
854 854 // don't show +0
855 855 added = 0;
856 856 } else {
857 857 added = '+' + added;
858 858 }
859 859
860 860 var deleted = -1*data['ops']['deleted'];
861 861
862 862 tmpl += pill.format(added, deleted);
863 863 return container.format(tmpl);
864 864
865 865 }(result, escapeMarkup);
866 866 };
867 867 var preloadData = {
868 868 results: [
869 869 % for filediff in diffset.files:
870 870 {id:"a_${h.FID(filediff.raw_id, filediff.patch['filename'])}",
871 871 text:"${filediff.patch['filename']}",
872 872 ops:${h.json.dumps(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
873 873 % endfor
874 874 ]
875 875 };
876 876
877 877 $(document).ready(function () {
878 878
879 879 var fileFilter = $("#file_filter").select2({
880 880 'dropdownAutoWidth': true,
881 881 'width': 'auto',
882 882 'placeholder': "${file_placeholder}",
883 883 containerCssClass: "drop-menu",
884 884 dropdownCssClass: "drop-menu-dropdown",
885 885 data: preloadData,
886 886 query: function(query) {
887 887 feedFilesOptions(query, preloadData);
888 888 },
889 889 formatResult: formatFileResult
890 890 });
891 891 % if range_diff_on is True:
892 892 fileFilter.select2("enable", false);
893 893
894 894 % endif
895 895
896 896 $("#file_filter").on('click', function (e) {
897 897 e.preventDefault();
898 898 var selected = $('#file_filter').select2('data');
899 899 var idSelector = "#"+selected.id;
900 900 window.location.hash = idSelector;
901 901 // expand the container if we quick-select the field
902 902 $(idSelector).next().prop('checked', false);
903 Waypoint.refreshAll()
903 updateSticky()
904 904 });
905 905
906 906 var contextPrefix = _gettext('Context file: ');
907 907 ## sticky sidebar
908 908 var sidebarElement = document.getElementById('diff-file-sticky');
909 909 sidebar = new StickySidebar(sidebarElement, {
910 910 topSpacing: 0,
911 911 bottomSpacing: 0,
912 912 innerWrapperSelector: '.sidebar__inner'
913 913 });
914 914 sidebarElement.addEventListener('affixed.static.stickySidebar', function () {
915 915 // reset our file so it's not holding new value
916 916 $('.fpath-placeholder-text').html(contextPrefix)
917 917 });
918 918
919 919 updateSticky = function () {
920 sidebar.updateSticky()
920 sidebar.updateSticky();
921 Waypoint.refreshAll();
921 922 };
922 923
923 924 var animateText = $.debounce(100, function(fPath, anchorId) {
924 925 // animate setting the text
925 926 var callback = function () {
926 927 $('.fpath-placeholder-text').animate({'opacity': 1.00}, 200)
927 928 $('.fpath-placeholder-text').html(contextPrefix + '<a href="#a_' + anchorId + '">' + fPath + '</a>')
928 929 };
929 930 $('.fpath-placeholder-text').animate({'opacity': 0.15}, 200, callback);
930 931 });
931 932
932 933 ## dynamic file waypoints
933 934 var setFPathInfo = function(fPath, anchorId){
934 935 animateText(fPath, anchorId)
935 936 };
936 937
937 938 var codeBlock = $('.filediff');
938 939 // forward waypoint
939 940 codeBlock.waypoint(
940 941 function(direction) {
941 942 if (direction === "down"){
942 943 setFPathInfo($(this.element).data('fPath'), $(this.element).data('anchorId'))
943 944 }
944 945 }, {
945 946 offset: 70,
946 947 context: '.fpath-placeholder'
947 948 }
948 949 );
949 950
950 951 // backward waypoint
951 952 codeBlock.waypoint(
952 953 function(direction) {
953 954 if (direction === "up"){
954 955 setFPathInfo($(this.element).data('fPath'), $(this.element).data('anchorId'))
955 956 }
956 957 }, {
957 958 offset: function () {
958 959 return -this.element.clientHeight + 90
959 960 },
960 961 context: '.fpath-placeholder'
961 962 }
962 963 );
963 964
964 965 });
965 966
966 967 </script>
967 968 % endif
968 969
969 970 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now