##// END OF EJS Templates
comments: link to resolved comment in FIX comment type.
marcink -
r1360:e9811c69 default
parent child Browse files
Show More
@@ -1,558 +1,571 b''
1 1 // comments.less
2 2 // For use in RhodeCode applications;
3 3 // see style guide documentation for guidelines.
4 4
5 5
6 6 // Comments
7 7 @comment-outdated-opacity: 0.6;
8 8
9 9 .comments {
10 10 width: 100%;
11 11 }
12 12
13 13 tr.inline-comments div {
14 14 max-width: 100%;
15 15
16 16 p {
17 17 white-space: normal;
18 18 }
19 19
20 20 code, pre, .code, dd {
21 21 overflow-x: auto;
22 22 width: 1062px;
23 23 }
24 24
25 25 dd {
26 26 width: auto;
27 27 }
28 28 }
29 29
30 30 #injected_page_comments {
31 31 .comment-previous-link,
32 32 .comment-next-link,
33 33 .comment-links-divider {
34 34 display: none;
35 35 }
36 36 }
37 37
38 38 .add-comment {
39 39 margin-bottom: 10px;
40 40 }
41 41 .hide-comment-button .add-comment {
42 42 display: none;
43 43 }
44 44
45 45 .comment-bubble {
46 46 color: @grey4;
47 47 margin-top: 4px;
48 48 margin-right: 30px;
49 49 visibility: hidden;
50 50 }
51 51
52 52 .comment-label {
53 53 float: left;
54 54
55 55 padding: 0.4em 0.4em;
56 56 margin: 3px 5px 0px -10px;
57 57 display: inline-block;
58 58 min-height: 0;
59 59
60 60 text-align: center;
61 61 font-size: 10px;
62 62 line-height: .8em;
63 63
64 64 font-family: @text-italic;
65 65 background: #fff none;
66 66 color: @grey4;
67 67 border: 1px solid @grey4;
68 68 white-space: nowrap;
69 69
70 70 text-transform: uppercase;
71 71 min-width: 40px;
72 72
73 73 &.todo {
74 74 color: @color5;
75 75 font-family: @text-bold-italic;
76 76 }
77 77
78 78 .resolve {
79 79 cursor: pointer;
80 80 text-decoration: underline;
81 81 }
82 82
83 83 .resolved {
84 84 text-decoration: line-through;
85 85 color: @color1;
86 86 }
87 87 .resolved a {
88 88 text-decoration: line-through;
89 89 color: @color1;
90 90 }
91 91 .resolve-text {
92 92 color: @color1;
93 93 margin: 2px 8px;
94 94 font-family: @text-italic;
95 95 }
96 96 }
97 97
98 .has-spacer-after {
99 &:after {
100 content: ' | ';
101 color: @grey5;
102 }
103 }
104
105 .has-spacer-before {
106 &:before {
107 content: ' | ';
108 color: @grey5;
109 }
110 }
98 111
99 112 .comment {
100 113
101 114 &.comment-general {
102 115 border: 1px solid @grey5;
103 116 padding: 5px 5px 5px 5px;
104 117 }
105 118
106 119 margin: @padding 0;
107 120 padding: 4px 0 0 0;
108 121 line-height: 1em;
109 122
110 123 .rc-user {
111 124 min-width: 0;
112 125 margin: 0px .5em 0 0;
113 126
114 127 .user {
115 128 display: inline;
116 129 }
117 130 }
118 131
119 132 .meta {
120 133 position: relative;
121 134 width: 100%;
122 135 border-bottom: 1px solid @grey5;
123 136 margin: -5px 0px;
124 137 line-height: 24px;
125 138
126 139 &:hover .permalink {
127 140 visibility: visible;
128 141 color: @rcblue;
129 142 }
130 143 }
131 144
132 145 .author,
133 146 .date {
134 147 display: inline;
135 148
136 149 &:after {
137 150 content: ' | ';
138 151 color: @grey5;
139 152 }
140 153 }
141 154
142 155 .author-general img {
143 156 top: 3px;
144 157 }
145 158 .author-inline img {
146 159 top: 3px;
147 160 }
148 161
149 162 .status-change,
150 163 .permalink,
151 164 .changeset-status-lbl {
152 165 display: inline;
153 166 }
154 167
155 168 .permalink {
156 169 visibility: hidden;
157 170 }
158 171
159 172 .comment-links-divider {
160 173 display: inline;
161 174 }
162 175
163 176 .comment-links-block {
164 177 float:right;
165 178 text-align: right;
166 179 min-width: 85px;
167 180
168 181 [class^="icon-"]:before,
169 182 [class*=" icon-"]:before {
170 183 margin-left: 0;
171 184 margin-right: 0;
172 185 }
173 186 }
174 187
175 188 .comment-previous-link {
176 189 display: inline-block;
177 190
178 191 .arrow_comment_link{
179 192 cursor: pointer;
180 193 i {
181 194 font-size:10px;
182 195 }
183 196 }
184 197 .arrow_comment_link.disabled {
185 198 cursor: default;
186 199 color: @grey5;
187 200 }
188 201 }
189 202
190 203 .comment-next-link {
191 204 display: inline-block;
192 205
193 206 .arrow_comment_link{
194 207 cursor: pointer;
195 208 i {
196 209 font-size:10px;
197 210 }
198 211 }
199 212 .arrow_comment_link.disabled {
200 213 cursor: default;
201 214 color: @grey5;
202 215 }
203 216 }
204 217
205 218 .flag_status {
206 219 display: inline-block;
207 220 margin: -2px .5em 0 .25em
208 221 }
209 222
210 223 .delete-comment {
211 224 display: inline-block;
212 225 color: @rcblue;
213 226
214 227 &:hover {
215 228 cursor: pointer;
216 229 }
217 230 }
218 231
219 232 .text {
220 233 clear: both;
221 234 .border-radius(@border-radius);
222 235 .box-sizing(border-box);
223 236
224 237 .markdown-block p,
225 238 .rst-block p {
226 239 margin: .5em 0 !important;
227 240 // TODO: lisa: This is needed because of other rst !important rules :[
228 241 }
229 242 }
230 243
231 244 .pr-version {
232 245 float: left;
233 246 margin: 0px 4px;
234 247 }
235 248 .pr-version-inline {
236 249 float: left;
237 250 margin: 0px 4px;
238 251 }
239 252 .pr-version-num {
240 253 font-size: 10px;
241 254 }
242 255 }
243 256
244 257 @comment-padding: 5px;
245 258
246 259 .general-comments {
247 260 .comment-outdated {
248 261 opacity: @comment-outdated-opacity;
249 262 }
250 263 }
251 264
252 265 .inline-comments {
253 266 border-radius: @border-radius;
254 267 .comment {
255 268 margin: 0;
256 269 border-radius: @border-radius;
257 270 }
258 271 .comment-outdated {
259 272 opacity: @comment-outdated-opacity;
260 273 }
261 274
262 275 .comment-inline {
263 276 background: white;
264 277 padding: @comment-padding @comment-padding;
265 278 border: @comment-padding solid @grey6;
266 279
267 280 .text {
268 281 border: none;
269 282 }
270 283 .meta {
271 284 border-bottom: 1px solid @grey6;
272 285 margin: -5px 0px;
273 286 line-height: 24px;
274 287 }
275 288 }
276 289 .comment-selected {
277 290 border-left: 6px solid @comment-highlight-color;
278 291 }
279 292 .comment-inline-form {
280 293 padding: @comment-padding;
281 294 display: none;
282 295 }
283 296 .cb-comment-add-button {
284 297 margin: @comment-padding;
285 298 }
286 299 /* hide add comment button when form is open */
287 300 .comment-inline-form-open ~ .cb-comment-add-button {
288 301 display: none;
289 302 }
290 303 .comment-inline-form-open {
291 304 display: block;
292 305 }
293 306 /* hide add comment button when form but no comments */
294 307 .comment-inline-form:first-child + .cb-comment-add-button {
295 308 display: none;
296 309 }
297 310 /* hide add comment button when no comments or form */
298 311 .cb-comment-add-button:first-child {
299 312 display: none;
300 313 }
301 314 /* hide add comment button when only comment is being deleted */
302 315 .comment-deleting:first-child + .cb-comment-add-button {
303 316 display: none;
304 317 }
305 318 }
306 319
307 320
308 321 .show-outdated-comments {
309 322 display: inline;
310 323 color: @rcblue;
311 324 }
312 325
313 326 // Comment Form
314 327 div.comment-form {
315 328 margin-top: 20px;
316 329 }
317 330
318 331 .comment-form strong {
319 332 display: block;
320 333 margin-bottom: 15px;
321 334 }
322 335
323 336 .comment-form textarea {
324 337 width: 100%;
325 338 height: 100px;
326 339 font-family: 'Monaco', 'Courier', 'Courier New', monospace;
327 340 }
328 341
329 342 form.comment-form {
330 343 margin-top: 10px;
331 344 margin-left: 10px;
332 345 }
333 346
334 347 .comment-inline-form .comment-block-ta,
335 348 .comment-form .comment-block-ta,
336 349 .comment-form .preview-box {
337 350 .border-radius(@border-radius);
338 351 .box-sizing(border-box);
339 352 background-color: white;
340 353 }
341 354
342 355 .comment-form-submit {
343 356 margin-top: 5px;
344 357 margin-left: 525px;
345 358 }
346 359
347 360 .file-comments {
348 361 display: none;
349 362 }
350 363
351 364 .comment-form .preview-box.unloaded,
352 365 .comment-inline-form .preview-box.unloaded {
353 366 height: 50px;
354 367 text-align: center;
355 368 padding: 20px;
356 369 background-color: white;
357 370 }
358 371
359 372 .comment-footer {
360 373 position: relative;
361 374 width: 100%;
362 375 min-height: 42px;
363 376
364 377 .status_box,
365 378 .cancel-button {
366 379 float: left;
367 380 display: inline-block;
368 381 }
369 382
370 383 .action-buttons {
371 384 float: right;
372 385 display: inline-block;
373 386 }
374 387 }
375 388
376 389 .comment-form {
377 390
378 391 .comment {
379 392 margin-left: 10px;
380 393 }
381 394
382 395 .comment-help {
383 396 color: @grey4;
384 397 padding: 5px 0 5px 0;
385 398 }
386 399
387 400 .comment-title {
388 401 padding: 5px 0 5px 0;
389 402 }
390 403
391 404 .comment-button {
392 405 display: inline-block;
393 406 }
394 407
395 408 .comment-button-input {
396 409 margin-right: 0;
397 410 }
398 411
399 412 .comment-footer {
400 413 margin-bottom: 110px;
401 414 margin-top: 10px;
402 415 }
403 416 }
404 417
405 418
406 419 .comment-form-login {
407 420 .comment-help {
408 421 padding: 0.9em; //same as the button
409 422 }
410 423
411 424 div.clearfix {
412 425 clear: both;
413 426 width: 100%;
414 427 display: block;
415 428 }
416 429 }
417 430
418 431 .comment-type {
419 432 margin: 0px;
420 433 border-radius: inherit;
421 434 border-color: @grey6;
422 435 }
423 436
424 437 .preview-box {
425 438 min-height: 105px;
426 439 margin-bottom: 15px;
427 440 background-color: white;
428 441 .border-radius(@border-radius);
429 442 .box-sizing(border-box);
430 443 }
431 444
432 445 .add-another-button {
433 446 margin-left: 10px;
434 447 margin-top: 10px;
435 448 margin-bottom: 10px;
436 449 }
437 450
438 451 .comment .buttons {
439 452 float: right;
440 453 margin: -1px 0px 0px 0px;
441 454 }
442 455
443 456 // Inline Comment Form
444 457 .injected_diff .comment-inline-form,
445 458 .comment-inline-form {
446 459 background-color: white;
447 460 margin-top: 10px;
448 461 margin-bottom: 20px;
449 462 }
450 463
451 464 .inline-form {
452 465 padding: 10px 7px;
453 466 }
454 467
455 468 .inline-form div {
456 469 max-width: 100%;
457 470 }
458 471
459 472 .overlay {
460 473 display: none;
461 474 position: absolute;
462 475 width: 100%;
463 476 text-align: center;
464 477 vertical-align: middle;
465 478 font-size: 16px;
466 479 background: none repeat scroll 0 0 white;
467 480
468 481 &.submitting {
469 482 display: block;
470 483 opacity: 0.5;
471 484 z-index: 100;
472 485 }
473 486 }
474 487 .comment-inline-form .overlay.submitting .overlay-text {
475 488 margin-top: 5%;
476 489 }
477 490
478 491 .comment-inline-form .clearfix,
479 492 .comment-form .clearfix {
480 493 .border-radius(@border-radius);
481 494 margin: 0px;
482 495 }
483 496
484 497 .comment-inline-form .comment-footer {
485 498 margin: 10px 0px 0px 0px;
486 499 }
487 500
488 501 .hide-inline-form-button {
489 502 margin-left: 5px;
490 503 }
491 504 .comment-button .hide-inline-form {
492 505 background: white;
493 506 }
494 507
495 508 .comment-area {
496 509 padding: 8px 12px;
497 510 border: 1px solid @grey5;
498 511 .border-radius(@border-radius);
499 512
500 513 .resolve-action {
501 514 padding: 1px 0px 0px 6px;
502 515 }
503 516
504 517 }
505 518
506 519 .comment-area-header .nav-links {
507 520 display: flex;
508 521 flex-flow: row wrap;
509 522 -webkit-flex-flow: row wrap;
510 523 width: 100%;
511 524 }
512 525
513 526 .comment-area-footer {
514 527 display: flex;
515 528 }
516 529
517 530 .comment-footer .toolbar {
518 531
519 532 }
520 533
521 534 .nav-links {
522 535 padding: 0;
523 536 margin: 0;
524 537 list-style: none;
525 538 height: auto;
526 539 border-bottom: 1px solid @grey5;
527 540 }
528 541 .nav-links li {
529 542 display: inline-block;
530 543 }
531 544 .nav-links li:before {
532 545 content: "";
533 546 }
534 547 .nav-links li a.disabled {
535 548 cursor: not-allowed;
536 549 }
537 550
538 551 .nav-links li.active a {
539 552 border-bottom: 2px solid @rcblue;
540 553 color: #000;
541 554 font-weight: 600;
542 555 }
543 556 .nav-links li a {
544 557 display: inline-block;
545 558 padding: 0px 10px 5px 10px;
546 559 margin-bottom: -1px;
547 560 font-size: 14px;
548 561 line-height: 28px;
549 562 color: #8f8f8f;
550 563 border-bottom: 2px solid transparent;
551 564 }
552 565
553 566 .toolbar-text {
554 567 float: left;
555 568 margin: -5px 0px 0px 0px;
556 569 font-size: 12px;
557 570 }
558 571
@@ -1,388 +1,394 b''
1 1 ## -*- coding: utf-8 -*-
2 2 ## usage:
3 3 ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
4 4 ## ${comment.comment_block(comment)}
5 5 ##
6 6 <%namespace name="base" file="/base/base.mako"/>
7 7
8 8 <%def name="comment_block(comment, inline=False)">
9 9 <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %>
10 10 % if inline:
11 11 <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %>
12 12 % else:
13 13 <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %>
14 14 % endif
15 15
16 16
17 17 <div class="comment
18 18 ${'comment-inline' if inline else 'comment-general'}
19 19 ${'comment-outdated' if outdated_at_ver else 'comment-current'}"
20 20 id="comment-${comment.comment_id}"
21 21 line="${comment.line_no}"
22 22 data-comment-id="${comment.comment_id}"
23 23 data-comment-type="${comment.comment_type}"
24 24 data-comment-inline=${h.json.dumps(inline)}
25 25 style="${'display: none;' if outdated_at_ver else ''}">
26 26
27 27 <div class="meta">
28 28 <div class="comment-type-label">
29 29 <div class="comment-label ${comment.comment_type or 'note'}" id="comment-label-${comment.comment_id}">
30 30 % if comment.comment_type == 'todo':
31 31 % if comment.resolved:
32 32 <div class="resolved tooltip" title="${_('Resolved by comment #{}').format(comment.resolved.comment_id)}">
33 33 <a href="#comment-${comment.resolved.comment_id}">${comment.comment_type}</a>
34 34 </div>
35 35 % else:
36 36 <div class="resolved tooltip" style="display: none">
37 37 <span>${comment.comment_type}</span>
38 38 </div>
39 39 <div class="resolve tooltip" onclick="return Rhodecode.comments.createResolutionComment(${comment.comment_id});" title="${_('Click to resolve this comment')}">
40 40 ${comment.comment_type}
41 41 </div>
42 42 % endif
43 43 % else:
44 44 % if comment.resolved_comment:
45 45 fix
46 46 % else:
47 47 ${comment.comment_type or 'note'}
48 48 % endif
49 49 % endif
50 50 </div>
51 51 </div>
52 52
53 53 <div class="author ${'author-inline' if inline else 'author-general'}">
54 54 ${base.gravatar_with_user(comment.author.email, 16)}
55 55 </div>
56 56 <div class="date">
57 57 ${h.age_component(comment.modified_at, time_is_local=True)}
58 58 </div>
59 59 % if inline:
60 60 <span></span>
61 61 % else:
62 62 <div class="status-change">
63 63 % if comment.pull_request:
64 64 <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id)}">
65 65 % if comment.status_change:
66 66 ${_('pull request #%s') % comment.pull_request.pull_request_id}:
67 67 % else:
68 68 ${_('pull request #%s') % comment.pull_request.pull_request_id}
69 69 % endif
70 70 </a>
71 71 % else:
72 72 % if comment.status_change:
73 73 ${_('Status change on commit')}:
74 74 % endif
75 75 % endif
76 76 </div>
77 77 % endif
78 78
79 79 % if comment.status_change:
80 80 <div class="${'flag_status %s' % comment.status_change[0].status}"></div>
81 81 <div title="${_('Commit status')}" class="changeset-status-lbl">
82 82 ${comment.status_change[0].status_lbl}
83 83 </div>
84 84 % endif
85 85
86 % if comment.resolved_comment:
87 <a class="has-spacer-before" href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'))">
88 ${_('resolves comment #{}').format(comment.resolved_comment.comment_id)}
89 </a>
90 % endif
91
86 92 <a class="permalink" href="#comment-${comment.comment_id}"> &para;</a>
87 93
88 94 <div class="comment-links-block">
89 95
90 96 % if inline:
91 97 <div class="pr-version-inline">
92 98 <a href="${h.url.current(version=comment.pull_request_version_id, anchor='comment-{}'.format(comment.comment_id))}">
93 99 % if outdated_at_ver:
94 100 <code class="pr-version-num" title="${_('Outdated comment from pull request version {0}').format(pr_index_ver)}">
95 101 outdated ${'v{}'.format(pr_index_ver)} |
96 102 </code>
97 103 % elif pr_index_ver:
98 104 <code class="pr-version-num" title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
99 105 ${'v{}'.format(pr_index_ver)} |
100 106 </code>
101 107 % endif
102 108 </a>
103 109 </div>
104 110 % else:
105 111 % if comment.pull_request_version_id and pr_index_ver:
106 112 |
107 113 <div class="pr-version">
108 114 % if comment.outdated:
109 115 <a href="?version=${comment.pull_request_version_id}#comment-${comment.comment_id}">
110 116 ${_('Outdated comment from pull request version {}').format(pr_index_ver)}
111 117 </a>
112 118 % else:
113 119 <div title="${_('Comment from pull request version {0}').format(pr_index_ver)}">
114 120 <a href="${h.url('pullrequest_show',repo_name=comment.pull_request.target_repo.repo_name,pull_request_id=comment.pull_request.pull_request_id, version=comment.pull_request_version_id)}">
115 121 <code class="pr-version-num">
116 122 ${'v{}'.format(pr_index_ver)}
117 123 </code>
118 124 </a>
119 125 </div>
120 126 % endif
121 127 </div>
122 128 % endif
123 129 % endif
124 130
125 131 ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed
126 132 ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated
127 133 %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())):
128 134 ## permissions to delete
129 135 %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id:
130 136 ## TODO: dan: add edit comment here
131 137 <a onclick="return Rhodecode.comments.deleteComment(this);" class="delete-comment"> ${_('Delete')}</a>
132 138 %else:
133 139 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
134 140 %endif
135 141 %else:
136 142 <button class="btn-link" disabled="disabled"> ${_('Delete')}</button>
137 143 %endif
138 144
139 145 % if outdated_at_ver:
140 146 | <a onclick="return Rhodecode.comments.prevOutdatedComment(this);" class="prev-comment"> ${_('Prev')}</a>
141 147 | <a onclick="return Rhodecode.comments.nextOutdatedComment(this);" class="next-comment"> ${_('Next')}</a>
142 148 % else:
143 149 | <a onclick="return Rhodecode.comments.prevComment(this);" class="prev-comment"> ${_('Prev')}</a>
144 150 | <a onclick="return Rhodecode.comments.nextComment(this);" class="next-comment"> ${_('Next')}</a>
145 151 % endif
146 152
147 153 </div>
148 154 </div>
149 155 <div class="text">
150 156 ${comment.render(mentions=True)|n}
151 157 </div>
152 158
153 159 </div>
154 160 </%def>
155 161
156 162 ## generate main comments
157 163 <%def name="generate_comments(comments, include_pull_request=False, is_pull_request=False)">
158 164 <div class="general-comments" id="comments">
159 165 %for comment in comments:
160 166 <div id="comment-tr-${comment.comment_id}">
161 167 ## only render comments that are not from pull request, or from
162 168 ## pull request and a status change
163 169 %if not comment.pull_request or (comment.pull_request and comment.status_change) or include_pull_request:
164 170 ${comment_block(comment)}
165 171 %endif
166 172 </div>
167 173 %endfor
168 174 ## to anchor ajax comments
169 175 <div id="injected_page_comments"></div>
170 176 </div>
171 177 </%def>
172 178
173 179
174 180 <%def name="comments(post_url, cur_status, is_pull_request=False, is_compare=False, change_status=True, form_extras=None)">
175 181
176 182 <div class="comments">
177 183 <%
178 184 if is_pull_request:
179 185 placeholder = _('Leave a comment on this Pull Request.')
180 186 elif is_compare:
181 187 placeholder = _('Leave a comment on {} commits in this range.').format(len(form_extras))
182 188 else:
183 189 placeholder = _('Leave a comment on this Commit.')
184 190 %>
185 191
186 192 % if c.rhodecode_user.username != h.DEFAULT_USER:
187 193 <div class="js-template" id="cb-comment-general-form-template">
188 194 ## template generated for injection
189 195 ${comment_form(form_type='general', review_statuses=c.commit_statuses, form_extras=form_extras)}
190 196 </div>
191 197
192 198 <div id="cb-comment-general-form-placeholder" class="comment-form ac">
193 199 ## inject form here
194 200 </div>
195 201 <script type="text/javascript">
196 202 var lineNo = 'general';
197 203 var resolvesCommentId = null;
198 204 var generalCommentForm = Rhodecode.comments.createGeneralComment(
199 205 lineNo, "${placeholder}", resolvesCommentId);
200 206
201 207 // set custom success callback on rangeCommit
202 208 % if is_compare:
203 209 generalCommentForm.setHandleFormSubmit(function(o) {
204 210 var self = generalCommentForm;
205 211
206 212 var text = self.cm.getValue();
207 213 var status = self.getCommentStatus();
208 214 var commentType = self.getCommentType();
209 215
210 216 if (text === "" && !status) {
211 217 return;
212 218 }
213 219
214 220 // we can pick which commits we want to make the comment by
215 221 // selecting them via click on preview pane, this will alter the hidden inputs
216 222 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
217 223
218 224 var commitIds = [];
219 225 $('#changeset_compare_view_content .compare_select').each(function(el) {
220 226 var commitId = this.id.replace('row-', '');
221 227 if ($(this).hasClass('hl') || !cherryPicked) {
222 228 $("input[data-commit-id='{0}']".format(commitId)).val(commitId);
223 229 commitIds.push(commitId);
224 230 } else {
225 231 $("input[data-commit-id='{0}']".format(commitId)).val('')
226 232 }
227 233 });
228 234
229 235 self.setActionButtonsDisabled(true);
230 236 self.cm.setOption("readOnly", true);
231 237 var postData = {
232 238 'text': text,
233 239 'changeset_status': status,
234 240 'comment_type': commentType,
235 241 'commit_ids': commitIds,
236 242 'csrf_token': CSRF_TOKEN
237 243 };
238 244
239 245 var submitSuccessCallback = function(o) {
240 246 location.reload(true);
241 247 };
242 248 var submitFailCallback = function(){
243 249 self.resetCommentFormState(text)
244 250 };
245 251 self.submitAjaxPOST(
246 252 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
247 253 });
248 254 % endif
249 255
250 256
251 257 </script>
252 258 % else:
253 259 ## form state when not logged in
254 260 <div class="comment-form ac">
255 261
256 262 <div class="comment-area">
257 263 <div class="comment-area-header">
258 264 <ul class="nav-links clearfix">
259 265 <li class="active">
260 266 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
261 267 </li>
262 268 <li class="">
263 269 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
264 270 </li>
265 271 </ul>
266 272 </div>
267 273
268 274 <div class="comment-area-write" style="display: block;">
269 275 <div id="edit-container">
270 276 <div style="padding: 40px 0">
271 277 ${_('You need to be logged in to leave comments.')}
272 278 <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
273 279 </div>
274 280 </div>
275 281 <div id="preview-container" class="clearfix" style="display: none;">
276 282 <div id="preview-box" class="preview-box"></div>
277 283 </div>
278 284 </div>
279 285
280 286 <div class="comment-area-footer">
281 287 <div class="toolbar">
282 288 <div class="toolbar-text">
283 289 </div>
284 290 </div>
285 291 </div>
286 292 </div>
287 293
288 294 <div class="comment-footer">
289 295 </div>
290 296
291 297 </div>
292 298 % endif
293 299
294 300 <script type="text/javascript">
295 301 bindToggleButtons();
296 302 </script>
297 303 </div>
298 304 </%def>
299 305
300 306
301 307 <%def name="comment_form(form_type, form_id='', lineno_id='{1}', review_statuses=None, form_extras=None)">
302 308 ## comment injected based on assumption that user is logged in
303 309
304 310 <form ${'id="{}"'.format(form_id) if form_id else '' |n} action="#" method="GET">
305 311
306 312 <div class="comment-area">
307 313 <div class="comment-area-header">
308 314 <ul class="nav-links clearfix">
309 315 <li class="active">
310 316 <a href="#edit-btn" tabindex="-1" id="edit-btn_${lineno_id}">${_('Write')}</a>
311 317 </li>
312 318 <li class="">
313 319 <a href="#preview-btn" tabindex="-1" id="preview-btn_${lineno_id}">${_('Preview')}</a>
314 320 </li>
315 321 <li class="pull-right">
316 322 <select class="comment-type" id="comment_type_${lineno_id}" name="comment_type">
317 323 % for val in c.visual.comment_types:
318 324 <option value="${val}">${val.upper()}</option>
319 325 % endfor
320 326 </select>
321 327 </li>
322 328 </ul>
323 329 </div>
324 330
325 331 <div class="comment-area-write" style="display: block;">
326 332 <div id="edit-container_${lineno_id}">
327 333 <textarea id="text_${lineno_id}" name="text" class="comment-block-ta ac-input"></textarea>
328 334 </div>
329 335 <div id="preview-container_${lineno_id}" class="clearfix" style="display: none;">
330 336 <div id="preview-box_${lineno_id}" class="preview-box"></div>
331 337 </div>
332 338 </div>
333 339
334 340 <div class="comment-area-footer">
335 341 <div class="toolbar">
336 342 <div class="toolbar-text">
337 343 ${(_('Comments parsed using %s syntax with %s support.') % (
338 344 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
339 345 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
340 346 )
341 347 )|n}
342 348 </div>
343 349 </div>
344 350 </div>
345 351 </div>
346 352
347 353 <div class="comment-footer">
348 354
349 355 % if review_statuses:
350 356 <div class="status_box">
351 357 <select id="change_status_${lineno_id}" name="changeset_status">
352 358 <option></option> ## Placeholder
353 359 % for status, lbl in review_statuses:
354 360 <option value="${status}" data-status="${status}">${lbl}</option>
355 361 %if is_pull_request and change_status and status in ('approved', 'rejected'):
356 362 <option value="${status}_closed" data-status="${status}">${lbl} & ${_('Closed')}</option>
357 363 %endif
358 364 % endfor
359 365 </select>
360 366 </div>
361 367 % endif
362 368
363 369 ## inject extra inputs into the form
364 370 % if form_extras and isinstance(form_extras, (list, tuple)):
365 371 <div id="comment_form_extras">
366 372 % for form_ex_el in form_extras:
367 373 ${form_ex_el|n}
368 374 % endfor
369 375 </div>
370 376 % endif
371 377
372 378 <div class="action-buttons">
373 379 ## inline for has a file, and line-number together with cancel hide button.
374 380 % if form_type == 'inline':
375 381 <input type="hidden" name="f_path" value="{0}">
376 382 <input type="hidden" name="line" value="${lineno_id}">
377 383 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
378 384 ${_('Cancel')}
379 385 </button>
380 386 % endif
381 387 ${h.submit('save', _('Comment'), class_='btn btn-success comment-button-input')}
382 388
383 389 </div>
384 390 </div>
385 391
386 392 </form>
387 393
388 394 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now