##// END OF EJS Templates
ui: fixed commit range page
dan -
r3759:d422b6a5 new-ui
parent child Browse files
Show More
@@ -1,481 +1,484 b''
1 1 // summary.less
2 2 // For use in RhodeCode applications;
3 3 // Used for headers and file detail summary screens.
4 4
5 5 .summary {
6 6 clear: both;
7 7 float: none;
8 8 position: relative;
9 9 width: 100%;
10 10 margin: 0;
11 11 padding: 0;
12 12 background: #FCFCFC;
13 13 border: 1px solid #EAEAEA;
14 14 border-radius: @border-radius;
15 15 margin-bottom: 20px;
16 16
17 17 .summary-detail-header {
18 18 display: block;
19 19 width: 100%;
20 20 margin-bottom: 10px;
21 21 padding: 0 0 .5em 0;
22 22 border-bottom: @border-thickness solid @border-default-color;
23 23
24 24 .breadcrumbs {
25 25 display: inline;
26 26 margin: 0;
27 27 padding: 0;
28 28 }
29 29
30 30 h4 {
31 31 margin: 0 1em 0 0;
32 32 padding: 10px 0 5px 20px;
33 33 line-height: 1.2em;
34 34 font-size: @basefontsize;
35 35 }
36 36
37 37 .action_link {
38 38 float: right;
39 39 }
40 40
41 41 .new-file {
42 42 float: right;
43 43 margin-top: -1.5em;
44 44 }
45 45 }
46 46
47 47 .summary-detail {
48 48 float: none;
49 49 position: relative;
50 50 width: 100%;
51 51 margin: 0;
52 52 padding: 0 0 20px 0;
53 53
54 54 .file_diff_buttons {
55 55 margin-top: @space;
56 56 }
57 57
58 58 // commit message
59 59 .commit {
60 60 white-space: pre-wrap;
61 61 }
62 62
63 63 .left-clone {
64 64 float: left;
65 65 height: 30px;
66 66 margin: 0;
67 67 padding: 0;
68 68 width: 130px;
69 69 font-weight: @text-semibold-weight;
70 70 font-family: @text-semibold;
71 71 }
72 72 .left-clone select {
73 73 width: 130px;
74 74 margin-right: 0;
75 75 background-color: @grey7;
76 76 border-color: @grey4;
77 77 color: #5C5C5C;
78 78 border-top-right-radius: 0;
79 79 border-bottom-right-radius: 0;
80 80 }
81 81
82 82 .right-clone {
83 83 float: left;
84 84 width: ~"calc(100% - 170px)";
85 85
86 86 .clipboard-action {
87 87 margin-left: -30px;
88 88 }
89 89 }
90 90
91 91 .clone_url_input {
92 92 width: ~"calc(100% - 90px)";
93 93 padding: 6px 30px 6px 10px;
94 94 height: 14px;
95 95 box-shadow: 0 1px 1px 0 rgba(0,0,0,0.07);
96 96 border-top-left-radius: 0;
97 97 border-bottom-left-radius: 0;
98 98 margin-left: -1px;
99 99 }
100 100
101 101 &.directory {
102 102 margin-bottom: 0;
103 103 }
104 104
105 105 .desc {
106 106 white-space: pre-wrap;
107 107 }
108 108 .disabled {
109 109 opacity: .5;
110 110 cursor: inherit;
111 111 }
112 112 .help-block {
113 113 color: inherit;
114 114 margin: 0;
115 115 }
116 116 }
117 117
118 118 .sidebar-right {
119 119 float: left;
120 120 width: 24%;
121 121 margin: 0;
122 122 padding: 0;
123 123
124 124 ul {
125 125 margin-left: 0;
126 126 padding-left: 0;
127 127
128 128 li {
129 129 list-style-type: none;
130 130 }
131 131 }
132 132 }
133 133
134 134 #clone_by_name, #clone_by_id{
135 135 display: inline-block;
136 136 margin-left: 0px;
137 137 }
138 138
139 139 .codeblock {
140 140 border: none;
141 141 background-color: transparent;
142 142 }
143 143
144 144 .code-body {
145 145 border: @border-thickness solid @border-default-color;
146 146 .border-radius(@border-radius);
147 147 }
148 148
149 149 .btn-collapse {
150 150 clear: both;
151 151 float: none;
152 152 background: #F7F7F7;
153 153 text-align: center;
154 154 color: #949494;
155 155 font-size: 11px;
156 156
157 157 &:hover {
158 158 background: #f1f1f1;
159 159 color: #2B2B2D;
160 160 }
161 161 }
162 162 }
163 163
164 164 // this is used outside of just the summary
165 165 .fieldset, // similar to form fieldset
166 166 .summary .sidebar-right-content { // these have to match
167 167 clear: both;
168 168 float: none;
169 169 position: relative;
170 170 display:block;
171 171 width: 100%;
172 172 min-height: 20px;
173 173 margin-bottom: 10px;
174 174 padding: 0;
175 175 line-height: 1.2em;
176 176
177 177 &:after { // clearfix
178 178 content: "";
179 179 clear: both;
180 180 width: 100%;
181 181 height: 1em;
182 182 }
183 183 }
184 184
185 185 .summary .sidebar-right-content {
186 186 margin-bottom: 0;
187 187
188 188 .rc-user {
189 189 min-width: 0;
190 190 }
191 191
192 192 li {
193 193 list-style: none;
194 194 line-height: normal;
195 195 }
196 196 }
197 197
198 198 .summary {
199 199 .fieldset {
200 200 margin-bottom: 0;
201 201 }
202 202 }
203 203
204 204 .fieldset {
205 205
206 206 .left-label { // similar to form legend
207 207 display: block;
208 208 margin: 0;
209 209 padding: 0;
210 210 font-weight: @text-semibold-weight;
211 211 font-family: @text-semibold;
212 212 }
213 213
214 214 .left-label-summary {
215 215 padding-left: 20px;
216 216 margin-bottom: 5px;
217 217
218 218 p {
219 219 margin-bottom: 5px;
220 220 color: @grey1;
221 221 float: left;
222 222 width: 130px;
223 223
224 224 &.spacing {
225 225 margin-top: 10px;
226 226 }
227 227 }
228 228
229 229 .right-label-summary {
230 230 float: left;
231 231 margin-top: 7px;
232 232 width: ~"calc(100% - 160px)";
233 233 }
234 234 }
235 235
236 236 .left-label-summary-files {
237 237 padding-left: 45px;
238 238 margin-top: 5px;
239 239
240 240 p {
241 241 margin-bottom: 5px;
242 242 color: @grey1;
243 243 float: left;
244 244 width: 130px;
245 245
246 246 &.spacing {
247 247 margin-top: 10px;
248 248 }
249 249 }
250 250
251 251 .right-label-summary {
252 252 float: left;
253 253 margin-top: 7px;
254 254 }
255 255 }
256 256
257 257 .left-content {
258 258 width: ~"calc(60% - 20px)";
259 259 float: left;
260 260 margin: 15px 0 15px 20px;
261 261
262 262 .rc-user {
263 263 min-width: auto;
264 264 max-width: none;
265 265 min-height: auto;
266 266 padding-right: 5px;
267 267 }
268 268
269 269 .left-content-avatar {
270 270 width: 45px;
271 271 float: left;
272 272 margin-top: 8px;
273 273 }
274 274
275 275 .left-content-message {
276 276 float: left;
277 277 width: ~"calc(100% - 45px)";
278 278 }
279 279 }
280 280
281 281 .right-content { // similar to form fields
282 282 float: left;
283 283 display: block;
284 284 width: ~"calc(40% - 20px)";
285 285 text-align: right;
286 286 margin: 15px 20px 15px 0;
287 287
288 288 .truncate-wrap,
289 289 .truncate {
290 290 max-width: 100%;
291 291 width: 100%;
292 292 }
293 293
294 294 .commit-long {
295 295 overflow-x: auto;
296 296 }
297 297
298 298 .commit-info {
299 299 margin-top: 7px;
300 300 }
301 301
302 302 .tag, .tagtag, .branchtag, .booktag, .metatag, .perm_tag {
303 303 background:transparent;
304 304 border: none;
305 305 box-shadow: none;
306 306 margin-left: 10px;
307 307 font-size: 13px;
308 308 }
309 309
310 310 .tag span, .tag i {
311 311 color: @grey1;
312 312 }
313 313 }
314 314 .commit {
315 315 color: @grey1;
316 316 margin-bottom: 5px;
317 317 white-space: pre;
318 318 }
319 319 .commit.truncate-wrap {
320 320 overflow:hidden;
321 321 text-overflow: ellipsis;
322 322 }
323 323 .commit-author {
324 324 color: @grey1;
325 325 }
326 326 .commit-date {
327 327 color: @grey4;
328 328 }
329 .fieldset-text-line {
330 line-height: 36px;
331 }
329 332 }
330 333
331 334 // expand commit message
332 335 #message_expand {
333 336 clear: both;
334 337 display: block;
335 338 color: @rcblue;
336 339 cursor: pointer;
337 340 }
338 341
339 342 #trimmed_message_box {
340 343 max-height: floor(2 * @basefontsize * 1.2); // 2 lines * line-height
341 344 overflow: hidden;
342 345 }
343 346
344 347 // show/hide comments button
345 348 .show-inline-comments {
346 349 display: inline;
347 350 cursor: pointer;
348 351
349 352 .comments-show { display: inline; }
350 353 .comments-hide { display: none; }
351 354
352 355 &.comments-visible {
353 356 .comments-show { display: none; }
354 357 .comments-hide { display: inline; }
355 358 }
356 359 }
357 360
358 361 // Quick Start section
359 362
360 363 .empty-repo {
361 364 border: 1px solid #EAEAEA;
362 365 border-bottom: 0;
363 366 border-radius: @border-radius;
364 367 padding: 0 20px;
365 368 }
366 369
367 370 .empty-repo h3, .quick_start p {
368 371 margin-bottom: 10px;
369 372 }
370 373
371 374 .quick_start pre {
372 375 background: #FCFEFF;
373 376 border: 1px solid #CBDBEB;
374 377 box-shadow: @button-shadow;
375 378 padding: 10px 15px;
376 379 border-radius: 4px;
377 380 color: @grey2;
378 381 }
379 382
380 383 .clear-fix {
381 384 clear: both;
382 385 }
383 386
384 387 .quick_start {
385 388 display: block;
386 389 position: relative;
387 390 border: 1px solid #EAEAEA;
388 391 border-top: 0;
389 392 border-radius: @border-radius;
390 393 padding: 0 20px;
391 394
392 395 // adds some space to make copy and paste easier
393 396 .left-label,
394 397 .right-content {
395 398 line-height: 1.6em;
396 399 }
397 400 }
398 401
399 402
400 403 .submodule {
401 404 .summary-detail {
402 405 width: 100%;
403 406
404 407 .btn-collapse {
405 408 display: none;
406 409 }
407 410 }
408 411 }
409 412
410 413 .codeblock-header {
411 414 float: left;
412 415 display: block;
413 416 width: 100%;
414 417 margin: 0;
415 418
416 419 .file-filename {
417 420 float:left;
418 421 padding: 10px;
419 422 }
420 423
421 424 .file-stats {
422 425 padding: 10px;
423 426 float:right;
424 427 }
425 428
426 429
427 430 .stats-first-item {
428 431 padding: 0px 0px 0px 3px;
429 432 }
430 433
431 434 .stats-info {
432 435 font-size: 11px;
433 436 color: @grey4;
434 437 }
435 438
436 439 .buttons {
437 440 float: right;
438 441 text-align: right;
439 442 color: @grey4;
440 443 padding: 10px;
441 444 }
442 445
443 446 .file-container {
444 447 display: inline-block;
445 448 width: 100%;
446 449 }
447 450
448 451 }
449 452
450 453 #summary-menu-stats {
451 454
452 455 .stats-bullet {
453 456 color: @grey3;
454 457 min-width: 3em;
455 458 }
456 459
457 460 .repo-size {
458 461 margin-bottom: .5em;
459 462 }
460 463
461 464 }
462 465
463 466 .rctable.repo_summary {
464 467 border: 1px solid #eaeaea;
465 468 border-radius: 2px;
466 469 border-collapse: inherit;
467 470 border-bottom: 0;
468 471
469 472 th {
470 473 background: @grey7;
471 474 border-bottom: 0;
472 475 }
473 476
474 477 td {
475 478 border-color: #eaeaea;
476 479 }
477 480
478 481 td.td-status {
479 482 padding: 0 0 0 10px;
480 483 }
481 484 }
@@ -1,102 +1,119 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('%s Commits') % c.repo_name} -
6 6 r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)}
7 7 ...
8 8 r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)}
9 9 ${_ungettext('(%s commit)','(%s commits)', len(c.commit_ranges)) % len(c.commit_ranges)}
10 10 %if c.rhodecode_name:
11 11 &middot; ${h.branding(c.rhodecode_name)}
12 12 %endif
13 13 </%def>
14 14
15 <%def name="breadcrumbs_links()">
16 ${_('Commits')} -
17 r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)}
18 ...
19 r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)}
20 ${_ungettext('(%s commit)','(%s commits)', len(c.commit_ranges)) % len(c.commit_ranges)}
21 </%def>
15 <%def name="breadcrumbs_links()"></%def>
22 16
23 17 <%def name="menu_bar_nav()">
24 18 ${self.menu_items(active='repositories')}
25 19 </%def>
26 20
27 21 <%def name="menu_bar_subnav()">
28 22 ${self.repo_menu(active='commits')}
29 23 </%def>
30 24
31 25 <%def name="main()">
26 <div class="box">
27 <div class="summary changeset">
28 <div class="summary-detail">
29 <div class="summary-detail-header">
30 <span class="breadcrumbs files_location">
31 <h4>
32 ${_('Commit Range')}
33 </h4>
34 </span>
32 35
33 <div class="summary changeset">
34 <div class="summary-detail">
35 <div class="summary-detail-header">
36 <span class="breadcrumbs files_location">
37 <h4>
38 ${_('Commit Range')}
39 <code>
40 r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)}...r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)}
41 </code>
42 </h4>
43 </span>
44 </div>
36 <div class="clear-fix"></div>
37 </div>
45 38
46 <div class="fieldset">
47 <div class="left-label">
48 ${_('Diff option')}:
49 </div>
50 <div class="right-content">
51 <div class="btn btn-primary">
52 <a href="${h.route_path('repo_compare',
53 repo_name=c.repo_name,
54 source_ref_type='rev',
55 source_ref=getattr(c.commit_ranges[0].parents[0] if c.commit_ranges[0].parents else h.EmptyCommit(), 'raw_id'),
56 target_ref_type='rev',
57 target_ref=c.commit_ranges[-1].raw_id)}"
58 >
59 ${_('Show combined compare')}
60 </a>
39 <div class="fieldset">
40 <div class="left-label-summary">
41 <p class="spacing">${_('Range')}:</p>
42 <div class="right-label-summary">
43 <div class="code-header" >
44 <div class="compare_header">
45 <code class="fieldset-text-line">
46 r${c.commit_ranges[0].idx}:${h.short_id(c.commit_ranges[0].raw_id)}
47 ...
48 r${c.commit_ranges[-1].idx}:${h.short_id(c.commit_ranges[-1].raw_id)}
49 ${_ungettext('(%s commit)','(%s commits)', len(c.commit_ranges)) % len(c.commit_ranges)}
50 </code>
51 </div>
52 </div>
53 </div>
54 </div>
61 55 </div>
62 </div>
63 </div>
64 56
65 </div> <!-- end summary-detail -->
57 <div class="fieldset">
58 <div class="left-label-summary">
59 <p class="spacing">${_('Diff Option')}:</p>
60 <div class="right-label-summary">
61 <div class="code-header" >
62 <div class="compare_header">
63 <div class="btn btn-primary">
64 <a href="${h.route_path('repo_compare',
65 repo_name=c.repo_name,
66 source_ref_type='rev',
67 source_ref=getattr(c.commit_ranges[0].parents[0] if c.commit_ranges[0].parents else h.EmptyCommit(), 'raw_id'),
68 target_ref_type='rev',
69 target_ref=c.commit_ranges[-1].raw_id)}"
70 >
71 ${_('Show combined diff')}
72 </a>
73 </div>
74 </div>
75 </div>
76 </div>
77 </div>
78 </div>
66 79
67 </div> <!-- end summary -->
80 <div class="clear-fix"></div>
81 </div> <!-- end summary-detail -->
82 </div> <!-- end summary -->
68 83
69 <div id="changeset_compare_view_content">
84 <div id="changeset_compare_view_content">
70 85 <div class="pull-left">
71 86 <div class="btn-group">
72 87 <a
73 88 class="btn"
74 89 href="#"
75 90 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
76 91 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
77 92 </a>
78 93 <a
79 94 class="btn"
80 95 href="#"
81 96 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
82 97 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
83 98 </a>
84 99 </div>
85 100 </div>
86 101 ## Commit range generated below
87 102 <%include file="../compare/compare_commits.mako"/>
88 103 <div class="cs_files">
89 104 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
90 105 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
91 106 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
92 107 ${cbdiffs.render_diffset_menu()}
93 108 %for commit in c.commit_ranges:
94 109 ${cbdiffs.render_diffset(
95 110 diffset=c.changes[commit.raw_id],
96 111 collapse_when_files_over=5,
97 112 commit=commit,
98 113 )}
99 114 %endfor
100 115 </div>
101 116 </div>
117 </div>
118
102 119 </%def>
@@ -1,313 +1,311 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
4 4
5 5 <%def name="title()">
6 6 %if c.compare_home:
7 7 ${_('%s Compare') % c.repo_name}
8 8 %else:
9 9 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} &gt; ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}
10 10 %endif
11 11 %if c.rhodecode_name:
12 12 &middot; ${h.branding(c.rhodecode_name)}
13 13 %endif
14 14 </%def>
15 15
16 16 <%def name="breadcrumbs_links()"></%def>
17 17
18 18 <%def name="menu_bar_nav()">
19 19 ${self.menu_items(active='repositories')}
20 20 </%def>
21 21
22 22 <%def name="menu_bar_subnav()">
23 23 ${self.repo_menu(active='compare')}
24 24 </%def>
25 25
26 26 <%def name="main()">
27 27 <script type="text/javascript">
28 28 // set fake commitId on this commit-range page
29 29 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
30 30 </script>
31 31
32 32 <div class="box">
33 33 <div class="summary changeset">
34 34 <div class="summary-detail">
35 35 <div class="summary-detail-header">
36 36 <span class="breadcrumbs files_location">
37 37 <h4>
38 38 ${_('Compare Commits')}
39 39 % if c.file_path:
40 40 ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a>
41 41 % endif
42 42
43 43 % if c.commit_ranges:
44 44 <code>
45 45 r${c.source_commit.idx}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.idx}:${h.short_id(c.target_commit.raw_id)}
46 46 </code>
47 47 % endif
48 48 </h4>
49 49 </span>
50 50
51 51 <div class="clear-fix"></div>
52 52 </div>
53 53
54 54 <div class="fieldset">
55 55 <div class="left-label-summary">
56 56 <p class="spacing">${_('Target')}:</p>
57 57 <div class="right-label-summary">
58 58 <div class="code-header" >
59 59 <div class="compare_header">
60 60 ## The hidden elements are replaced with a select2 widget
61 61 ${h.hidden('compare_source')}
62 62 </div>
63 63 </div>
64 64 </div>
65 65 </div>
66 66 </div>
67 67
68 68 <div class="fieldset">
69 69 <div class="left-label-summary">
70 70 <p class="spacing">${_('Source')}:</p>
71 71 <div class="right-label-summary">
72 72 <div class="code-header" >
73 73 <div class="compare_header">
74 74 ## The hidden elements are replaced with a select2 widget
75 75 ${h.hidden('compare_target')}
76 76 </div>
77 77 </div>
78 78 </div>
79 79 </div>
80 80 </div>
81 81
82 82 <div class="fieldset">
83 83 <div class="left-label-summary">
84 84 <p class="spacing">${_('Actions')}:</p>
85 85 <div class="right-label-summary">
86 86 <div class="code-header" >
87 87 <div class="compare_header">
88 88 <div class="compare-buttons">
89 89 % if c.compare_home:
90 90 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
91 91 %if c.rhodecode_db_repo.fork:
92 92
93 93 <a class="btn btn-default" title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
94 94 href="${h.route_path('repo_compare',
95 95 repo_name=c.rhodecode_db_repo.fork.repo_name,
96 96 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
97 97 source_ref=c.rhodecode_db_repo.landing_rev[1],
98 98 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
99 99 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
100 100 _query=dict(merge=1))}"
101 101 >
102 102 ${_('Compare with origin')}
103 103 </a>
104 104
105 105 %endif
106 106
107 107 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
108 108 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
109 109 <div id="changeset_compare_view_content">
110 110 <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div>
111 111 </div>
112 112
113 113 % elif c.preview_mode:
114 114 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a>
115 115 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a>
116 116 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
117 117
118 118 % else:
119 119 <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a>
120 120 <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a>
121 121
122 122 ## allow comment only if there are commits to comment on
123 123 % if c.diffset and c.diffset.files and c.commit_ranges:
124 124 <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a>
125 125 % else:
126 126 <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a>
127 127 % endif
128 128 % endif
129 129 </div>
130 130 </div>
131 131 </div>
132 132 </div>
133 133 </div>
134 134 </div>
135 135
136 136 ## commit status form
137 137 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
138 138 <div class="left-label-summary">
139 139 <p class="spacing">${_('Commit status')}:</p>
140 140 <div class="right-label-summary">
141 141 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
142 142 ## main comment form and it status
143 143 <%
144 144 def revs(_revs):
145 145 form_inputs = []
146 146 for cs in _revs:
147 147 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
148 148 form_inputs.append(tmpl)
149 149 return form_inputs
150 150 %>
151 151 <div>
152 152 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
153 153 </div>
154 154 </div>
155 155 </div>
156 156 </div>
157 157 <div class="clear-fix"></div>
158 158 </div> <!-- end summary-detail -->
159 159 </div> <!-- end summary -->
160 160
161 161 ## use JS script to load it quickly before potentially large diffs render long time
162 162 ## this prevents from situation when large diffs block rendering of select2 fields
163 163 <script type="text/javascript">
164 164
165 165 var cache = {};
166 166
167 167 var formatSelection = function(repoName){
168 168 return function(data, container, escapeMarkup) {
169 169 var selection = data ? this.text(data) : "";
170 170 return escapeMarkup('{0}@{1}'.format(repoName, selection));
171 171 }
172 172 };
173 173
174 174 var feedCompareData = function(query, cachedValue){
175 175 var data = {results: []};
176 176 //filter results
177 177 $.each(cachedValue.results, function() {
178 178 var section = this.text;
179 179 var children = [];
180 180 $.each(this.children, function() {
181 181 if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) {
182 182 children.push({
183 183 'id': this.id,
184 184 'text': this.text,
185 185 'type': this.type
186 186 })
187 187 }
188 188 });
189 189 data.results.push({
190 190 'text': section,
191 191 'children': children
192 192 })
193 193 });
194 194 //push the typed in changeset
195 195 data.results.push({
196 196 'text': _gettext('specify commit'),
197 197 'children': [{
198 198 'id': query.term,
199 199 'text': query.term,
200 200 'type': 'rev'
201 201 }]
202 202 });
203 203 query.callback(data);
204 204 };
205 205
206 206 var loadCompareData = function(repoName, query, cache){
207 207 $.ajax({
208 208 url: pyroutes.url('repo_refs_data', {'repo_name': repoName}),
209 209 data: {},
210 210 dataType: 'json',
211 211 type: 'GET',
212 212 success: function(data) {
213 213 cache[repoName] = data;
214 214 query.callback({results: data.results});
215 215 }
216 216 })
217 217 };
218 218
219 219 var enable_fields = ${"false" if c.preview_mode else "true"};
220 220 $("#compare_source").select2({
221 221 placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}",
222 222 containerCssClass: "drop-menu",
223 223 dropdownCssClass: "drop-menu-dropdown",
224 224 formatSelection: formatSelection("${c.source_repo.repo_name}"),
225 225 dropdownAutoWidth: true,
226 226 query: function(query) {
227 227 var repoName = '${c.source_repo.repo_name}';
228 228 var cachedValue = cache[repoName];
229 229
230 230 if (cachedValue){
231 231 feedCompareData(query, cachedValue);
232 232 }
233 233 else {
234 234 loadCompareData(repoName, query, cache);
235 235 }
236 236 }
237 237 }).select2("enable", enable_fields);
238 238
239 239 $("#compare_target").select2({
240 240 placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}",
241 241 dropdownAutoWidth: true,
242 242 containerCssClass: "drop-menu",
243 243 dropdownCssClass: "drop-menu-dropdown",
244 244 formatSelection: formatSelection("${c.target_repo.repo_name}"),
245 245 query: function(query) {
246 246 var repoName = '${c.target_repo.repo_name}';
247 247 var cachedValue = cache[repoName];
248 248
249 249 if (cachedValue){
250 250 feedCompareData(query, cachedValue);
251 251 }
252 252 else {
253 253 loadCompareData(repoName, query, cache);
254 254 }
255 255 }
256 256 }).select2("enable", enable_fields);
257 257 var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"};
258 258 var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"};
259 259
260 260 $('#compare_revs').on('click', function(e) {
261 261 var source = $('#compare_source').select2('data') || initial_compare_source;
262 262 var target = $('#compare_target').select2('data') || initial_compare_target;
263 263 if (source && target) {
264 264 var url_data = {
265 265 repo_name: "${c.repo_name}",
266 266 source_ref: source.id,
267 267 source_ref_type: source.type,
268 268 target_ref: target.id,
269 269 target_ref_type: target.type
270 270 };
271 271 window.location = pyroutes.url('repo_compare', url_data);
272 272 }
273 273 });
274 274 $('#compare_changeset_status_toggle').on('click', function(e) {
275 275 $('#compare_changeset_status').toggle();
276 276 });
277 277
278 278 </script>
279 279
280 280 ## table diff data
281 281 <div class="table">
282
283
284 282 % if not c.compare_home:
285 283 <div id="changeset_compare_view_content">
286 284 <div class="pull-left">
287 285 <div class="btn-group">
288 286 <a
289 287 class="btn"
290 288 href="#"
291 289 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
292 290 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
293 291 </a>
294 292 <a
295 293 class="btn"
296 294 href="#"
297 295 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
298 296 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
299 297 </a>
300 298 </div>
301 299 </div>
302 300 <div style="padding:0 10px 10px 0px" class="pull-left"></div>
303 301 ## commit compare generated below
304 302 <%include file="compare_commits.mako"/>
305 303 ${cbdiffs.render_diffset_menu(c.diffset)}
306 304 ${cbdiffs.render_diffset(c.diffset)}
307 305 </div>
308 306 % endif
309 307
310 308 </div>
311 309 </div>
312 310
313 311 </%def>
General Comments 0
You need to be logged in to leave comments. Login now