Show More
@@ -101,12 +101,11 b' class TestPullrequestsView(object):' | |||
|
101 | 101 | for commit_id in pull_request.revisions: |
|
102 | 102 | response.mustcontain(commit_id) |
|
103 | 103 | |
|
104 |
|
|
|
105 |
|
|
|
106 | target_clone_url = pull_request.target_repo.clone_url() | |
|
107 | assert target_clone_url in response | |
|
104 | response.mustcontain(pull_request.target_ref_parts.type) | |
|
105 | response.mustcontain(pull_request.target_ref_parts.name) | |
|
108 | 106 | |
|
109 |
|
|
|
107 | response.mustcontain('class="pull-request-merge"') | |
|
108 | ||
|
110 | 109 | if pr_merge_enabled: |
|
111 | 110 | response.mustcontain('Pull request reviewer approval is pending') |
|
112 | 111 | else: |
@@ -536,9 +535,9 b' class TestPullrequestsView(object):' | |||
|
536 | 535 | |
|
537 | 536 | # Check generated diff contents |
|
538 | 537 | response = response.follow() |
|
539 | assert 'content_of_ancestor' not in response.body | |
|
540 |
|
|
|
541 |
|
|
|
538 | response.mustcontain(no=['content_of_ancestor']) | |
|
539 | response.mustcontain(no=['content_of_ancestor-child']) | |
|
540 | response.mustcontain('content_of_change') | |
|
542 | 541 | |
|
543 | 542 | def test_merge_pull_request_enabled(self, pr_util, csrf_token): |
|
544 | 543 | # Clear any previous calls to rcextensions |
@@ -689,8 +688,8 b' class TestPullrequestsView(object):' | |||
|
689 | 688 | pull_request_id=pull_request.pull_request_id)) |
|
690 | 689 | |
|
691 | 690 | assert response.status_int == 200 |
|
692 |
|
|
|
693 |
|
|
|
691 | response.mustcontain('Pull request updated to') | |
|
692 | response.mustcontain('with 1 added, 0 removed commits.') | |
|
694 | 693 | |
|
695 | 694 | # check that we have now both revisions |
|
696 | 695 | pull_request = PullRequest.get(pull_request_id) |
@@ -752,8 +751,8 b' class TestPullrequestsView(object):' | |||
|
752 | 751 | repo_name=target.repo_name, |
|
753 | 752 | pull_request_id=pull_request.pull_request_id)) |
|
754 | 753 | assert response.status_int == 200 |
|
755 |
|
|
|
756 |
|
|
|
754 | response.mustcontain('Pull request updated to') | |
|
755 | response.mustcontain('with 1 added, 1 removed commits.') | |
|
757 | 756 | |
|
758 | 757 | def test_update_target_revision_with_removal_of_1_commit_git(self, backend_git, csrf_token): |
|
759 | 758 | backend = backend_git |
@@ -994,12 +993,13 b' class TestPullrequestsView(object):' | |||
|
994 | 993 | pull_request_id=pull_request.pull_request_id)) |
|
995 | 994 | assert response.status_int == 200 |
|
996 | 995 | |
|
997 |
|
|
|
998 |
|
|
|
999 |
assert len( |
|
|
1000 | target = response.assert_response().get_element('.pr-targetinfo .tag') | |
|
1001 | target_children = target.getchildren() | |
|
1002 | assert len(target_children) == 1 | |
|
996 | source = response.assert_response().get_element('.pr-source-info') | |
|
997 | source_parent = source.getparent() | |
|
998 | assert len(source_parent) == 1 | |
|
999 | ||
|
1000 | target = response.assert_response().get_element('.pr-target-info') | |
|
1001 | target_parent = target.getparent() | |
|
1002 | assert len(target_parent) == 1 | |
|
1003 | 1003 | |
|
1004 | 1004 | expected_origin_link = route_path( |
|
1005 | 1005 | 'repo_commits', |
@@ -1009,10 +1009,8 b' class TestPullrequestsView(object):' | |||
|
1009 | 1009 | 'repo_commits', |
|
1010 | 1010 | repo_name=pull_request.target_repo.scm_instance().name, |
|
1011 | 1011 | params=dict(branch='target')) |
|
1012 |
assert |
|
|
1013 | assert origin_children[0].text == 'branch: origin' | |
|
1014 | assert target_children[0].attrib['href'] == expected_target_link | |
|
1015 | assert target_children[0].text == 'branch: target' | |
|
1012 | assert source_parent.attrib['href'] == expected_origin_link | |
|
1013 | assert target_parent.attrib['href'] == expected_target_link | |
|
1016 | 1014 | |
|
1017 | 1015 | def test_bookmark_is_not_a_link(self, pr_util): |
|
1018 | 1016 | pull_request = pr_util.create_pull_request() |
@@ -1027,13 +1025,13 b' class TestPullrequestsView(object):' | |||
|
1027 | 1025 | pull_request_id=pull_request.pull_request_id)) |
|
1028 | 1026 | assert response.status_int == 200 |
|
1029 | 1027 | |
|
1030 |
|
|
|
1031 |
assert |
|
|
1032 | assert origin.getchildren() == [] | |
|
1028 | source = response.assert_response().get_element('.pr-source-info') | |
|
1029 | assert source.text.strip() == 'bookmark:origin' | |
|
1030 | assert source.getparent().attrib.get('href') is None | |
|
1033 | 1031 | |
|
1034 |
target = response.assert_response().get_element('.pr-targetinfo |
|
|
1035 |
assert target.text.strip() == 'bookmark: |
|
|
1036 |
assert target.get |
|
|
1032 | target = response.assert_response().get_element('.pr-target-info') | |
|
1033 | assert target.text.strip() == 'bookmark:target' | |
|
1034 | assert target.getparent().attrib.get('href') is None | |
|
1037 | 1035 | |
|
1038 | 1036 | def test_tag_is_not_a_link(self, pr_util): |
|
1039 | 1037 | pull_request = pr_util.create_pull_request() |
@@ -1048,13 +1046,13 b' class TestPullrequestsView(object):' | |||
|
1048 | 1046 | pull_request_id=pull_request.pull_request_id)) |
|
1049 | 1047 | assert response.status_int == 200 |
|
1050 | 1048 | |
|
1051 |
|
|
|
1052 |
assert |
|
|
1053 | assert origin.getchildren() == [] | |
|
1049 | source = response.assert_response().get_element('.pr-source-info') | |
|
1050 | assert source.text.strip() == 'tag:origin' | |
|
1051 | assert source.getparent().attrib.get('href') is None | |
|
1054 | 1052 | |
|
1055 |
target = response.assert_response().get_element('.pr-targetinfo |
|
|
1056 |
assert target.text.strip() == 'tag: |
|
|
1057 |
assert target.get |
|
|
1053 | target = response.assert_response().get_element('.pr-target-info') | |
|
1054 | assert target.text.strip() == 'tag:target' | |
|
1055 | assert target.getparent().attrib.get('href') is None | |
|
1058 | 1056 | |
|
1059 | 1057 | @pytest.mark.parametrize('mergeable', [True, False]) |
|
1060 | 1058 | def test_shadow_repository_link( |
@@ -726,7 +726,7 b' import tzlocal' | |||
|
726 | 726 | local_timezone = tzlocal.get_localzone() |
|
727 | 727 | |
|
728 | 728 | |
|
729 | def age_component(datetime_iso, value=None, time_is_local=False): | |
|
729 | def age_component(datetime_iso, value=None, time_is_local=False, tooltip=True): | |
|
730 | 730 | title = value or format_date(datetime_iso) |
|
731 | 731 | tzinfo = '+00:00' |
|
732 | 732 | |
@@ -740,9 +740,11 b' def age_component(datetime_iso, value=No' | |||
|
740 | 740 | tzinfo = '{}:{}'.format(offset[:-2], offset[-2:]) |
|
741 | 741 | |
|
742 | 742 | return literal( |
|
743 | '<time class="timeago tooltip" ' | |
|
744 | 'title="{1}{2}" datetime="{0}{2}">{1}</time>'.format( | |
|
745 | datetime_iso, title, tzinfo)) | |
|
743 | '<time class="timeago {cls}" title="{tt_title}" datetime="{dt}{tzinfo}">{title}</time>'.format( | |
|
744 | cls='tooltip' if tooltip else '', | |
|
745 | tt_title=('{title}{tzinfo}'.format(title=title, tzinfo=tzinfo)) if tooltip else '', | |
|
746 | title=title, dt=datetime_iso, tzinfo=tzinfo | |
|
747 | )) | |
|
746 | 748 | |
|
747 | 749 | |
|
748 | 750 | def _shorten_commit_id(commit_id, commit_len=None): |
@@ -379,8 +379,9 b' ul.auth_plugins {' | |||
|
379 | 379 | font-family: @text-bold; |
|
380 | 380 | } |
|
381 | 381 | |
|
382 | .pr-origininfo, .pr-targetinfo { | |
|
382 | .pr-commit-flow { | |
|
383 | 383 | position: relative; |
|
384 | font-weight: 600; | |
|
384 | 385 | |
|
385 | 386 | .tag { |
|
386 | 387 | display: inline-block; |
@@ -413,7 +414,6 b' ul.auth_plugins {' | |||
|
413 | 414 | padding: 0 0; |
|
414 | 415 | } |
|
415 | 416 | |
|
416 | ||
|
417 | 417 | .pr-title-input { |
|
418 | 418 | width: 80%; |
|
419 | 419 | font-size: 1em; |
@@ -438,6 +438,19 b' ul.auth_plugins {' | |||
|
438 | 438 | } |
|
439 | 439 | } |
|
440 | 440 | |
|
441 | .pr-title-closed-tag { | |
|
442 | font-size: 16px; | |
|
443 | } | |
|
444 | ||
|
445 | #pr-desc { | |
|
446 | padding: 10px 0; | |
|
447 | ||
|
448 | .markdown-block { | |
|
449 | padding: 0; | |
|
450 | margin-bottom: -30px; | |
|
451 | } | |
|
452 | } | |
|
453 | ||
|
441 | 454 | #pullrequest_title { |
|
442 | 455 | width: 100%; |
|
443 | 456 | box-sizing: border-box; |
@@ -451,6 +464,31 b' ul.auth_plugins {' | |||
|
451 | 464 | overflow: hidden; |
|
452 | 465 | } |
|
453 | 466 | |
|
467 | .pr-details-title { | |
|
468 | height: 16px | |
|
469 | } | |
|
470 | ||
|
471 | .pr-details-title-author-pref { | |
|
472 | padding-right: 10px | |
|
473 | } | |
|
474 | ||
|
475 | .label-pr-detail { | |
|
476 | display: table-cell; | |
|
477 | width: 120px; | |
|
478 | padding-top: 7.5px; | |
|
479 | padding-bottom: 7.5px; | |
|
480 | padding-right: 7.5px; | |
|
481 | } | |
|
482 | ||
|
483 | .source-details ul { | |
|
484 | padding: 10px 16px; | |
|
485 | } | |
|
486 | ||
|
487 | .source-details-action { | |
|
488 | color: @grey4; | |
|
489 | font-size: 11px | |
|
490 | } | |
|
491 | ||
|
454 | 492 | .pr-submit-button { |
|
455 | 493 | float: right; |
|
456 | 494 | margin: 0 0 0 5px; |
@@ -469,6 +507,15 b' ul.auth_plugins {' | |||
|
469 | 507 | vertical-align: top; |
|
470 | 508 | } |
|
471 | 509 | |
|
510 | #close_edit_pullrequest { | |
|
511 | padding-left: 1em | |
|
512 | } | |
|
513 | ||
|
514 | #delete_pullrequest { | |
|
515 | clear: inherit; | |
|
516 | padding: 0 | |
|
517 | } | |
|
518 | ||
|
472 | 519 | .perms_section_head { |
|
473 | 520 | min-width: 625px; |
|
474 | 521 | |
@@ -1880,9 +1927,10 b' BIN_FILENODE = 7' | |||
|
1880 | 1927 | |
|
1881 | 1928 | .pr-versions { |
|
1882 | 1929 | font-size: 1.1em; |
|
1930 | padding: 7.5px; | |
|
1883 | 1931 | |
|
1884 | 1932 | table { |
|
1885 | padding: 0px 5px; | |
|
1933 | ||
|
1886 | 1934 | } |
|
1887 | 1935 | |
|
1888 | 1936 | td { |
@@ -558,6 +558,21 b' VersionController = function () {' | |||
|
558 | 558 | } |
|
559 | 559 | |
|
560 | 560 | return false |
|
561 | }; | |
|
562 | ||
|
563 | this.toggleElement = function (elem, target) { | |
|
564 | var $elem = $(elem); | |
|
565 | var $target = $(target); | |
|
566 | ||
|
567 | if ($target.is(':visible')) { | |
|
568 | $target.hide(); | |
|
569 | $elem.html($elem.data('toggleOn')) | |
|
570 | } else { | |
|
571 | $target.show(); | |
|
572 | $elem.html($elem.data('toggleOff')) | |
|
573 | } | |
|
574 | ||
|
575 | return false | |
|
561 | 576 | } |
|
562 | 577 | |
|
563 | 578 | }; |
This diff has been collapsed as it changes many lines, (877 lines changed) Show them Hide them | |||
@@ -10,14 +10,12 b'' | |||
|
10 | 10 | </%def> |
|
11 | 11 | |
|
12 | 12 | <%def name="breadcrumbs_links()"> |
|
13 | <% | |
|
14 | pr_title = c.pull_request.title | |
|
15 | if c.pull_request.is_closed(): | |
|
16 | pr_title = '[{}] {}'.format(_('Closed'), pr_title) | |
|
17 | %> | |
|
18 | 13 | |
|
19 | 14 | <div id="pr-title"> |
|
20 | <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${pr_title}"> | |
|
15 | % if c.pull_request.is_closed(): | |
|
16 | <span class="pr-title-closed-tag tag">${_('Closed')}</span> | |
|
17 | % endif | |
|
18 | <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}"> | |
|
21 | 19 | </div> |
|
22 | 20 | <div id="pr-title-edit" class="input" style="display: none;"> |
|
23 | 21 | <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}"> |
@@ -39,324 +37,340 b'' | |||
|
39 | 37 | AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}"; |
|
40 | 38 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; |
|
41 | 39 | </script> |
|
40 | ||
|
42 | 41 | <div class="box"> |
|
43 | 42 | |
|
44 | 43 | ${self.breadcrumbs()} |
|
45 | 44 | |
|
46 | 45 | <div class="box pr-summary"> |
|
47 | 46 | |
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)} | |
|
52 | %if c.allowed_to_update: | |
|
53 | <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0"> | |
|
54 | % if c.allowed_to_delete: | |
|
55 | ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)} | |
|
56 | ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'), | |
|
57 | class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")} | |
|
58 | ${h.end_form()} | |
|
59 | % else: | |
|
60 | ${_('Delete')} | |
|
61 | % endif | |
|
62 | </div> | |
|
63 | <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div> | |
|
64 | <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div> | |
|
65 | %endif | |
|
47 | <div class="summary-details block-left"> | |
|
48 | <% summary = lambda n:{False:'summary-short'}.get(n) %> | |
|
49 | <div class="pr-details-title"> | |
|
50 | <div class="pull-left"> | |
|
51 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a> | |
|
52 | ${_('Created on')} | |
|
53 | <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span> | |
|
54 | <span class="pr-details-title-author-pref">${_('by')}</span> | |
|
55 | </div> | |
|
56 | ||
|
57 | <div class="pull-left"> | |
|
58 | ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)} | |
|
66 | 59 | </div> |
|
67 | 60 | |
|
68 | <div id="summary" class="fields pr-details-content"> | |
|
69 | <div class="field"> | |
|
70 | <div class="label-summary"> | |
|
71 | <label>${_('Source')}:</label> | |
|
72 | </div> | |
|
73 | <div class="input"> | |
|
74 | <div class="pr-origininfo"> | |
|
75 | ## branch link is only valid if it is a branch | |
|
76 | <span class="tag"> | |
|
77 | %if c.pull_request.source_ref_parts.type == 'branch': | |
|
78 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a> | |
|
79 | %else: | |
|
80 | ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name} | |
|
81 | %endif | |
|
82 | </span> | |
|
83 | <span class="clone-url"> | |
|
84 | <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a> | |
|
85 | </span> | |
|
86 | <br/> | |
|
87 | % if c.ancestor_commit: | |
|
88 | ${_('Common ancestor')}: | |
|
89 | <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code> | |
|
90 | % endif | |
|
91 | </div> | |
|
92 | %if h.is_hg(c.pull_request.source_repo): | |
|
93 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> | |
|
94 | %elif h.is_git(c.pull_request.source_repo): | |
|
95 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> | |
|
61 | %if c.allowed_to_update: | |
|
62 | <div id="delete_pullrequest" class="pull-right action_button ${('' if c.allowed_to_delete else 'disabled' )}" > | |
|
63 | % if c.allowed_to_delete: | |
|
64 | ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)} | |
|
65 | ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'), | |
|
66 | class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")} | |
|
67 | ${h.end_form()} | |
|
68 | % else: | |
|
69 | ${_('Delete')} | |
|
70 | % endif | |
|
71 | </div> | |
|
72 | <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div> | |
|
73 | <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;">${_('Cancel')}</div> | |
|
74 | <div id="edit_pull_request" class="pull-right action_button pr-save" style="display: none;">${_('Save Changes')}</div> | |
|
75 | %endif | |
|
76 | </div> | |
|
77 | ||
|
78 | <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}"> | |
|
79 | ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)} | |
|
80 | </div> | |
|
81 | ||
|
82 | <div id="pr-desc-edit" class="input textarea" style="display: none;"> | |
|
83 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> | |
|
84 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} | |
|
85 | </div> | |
|
86 | ||
|
87 | <div id="summary" class="fields pr-details-content"> | |
|
88 | ||
|
89 | ## review | |
|
90 | <div class="field"> | |
|
91 | <div class="label-pr-detail"> | |
|
92 | <label>${_('Review status')}:</label> | |
|
93 | </div> | |
|
94 | <div class="input"> | |
|
95 | %if c.pull_request_review_status: | |
|
96 | <div class="tag status-tag-${c.pull_request_review_status}"> | |
|
97 | <i class="icon-circle review-status-${c.pull_request_review_status}"></i> | |
|
98 | <span class="changeset-status-lbl"> | |
|
99 | %if c.pull_request.is_closed(): | |
|
100 | ${_('Closed')}, | |
|
101 | %endif | |
|
102 | ||
|
103 | ${h.commit_status_lbl(c.pull_request_review_status)} | |
|
104 | ||
|
105 | </span> | |
|
106 | </div> | |
|
107 | - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))} | |
|
108 | %endif | |
|
109 | </div> | |
|
110 | </div> | |
|
111 | ||
|
112 | ## source | |
|
113 | <div class="field"> | |
|
114 | <div class="label-pr-detail"> | |
|
115 | <label>${_('Commit flow')}:</label> | |
|
116 | </div> | |
|
117 | <div class="input"> | |
|
118 | <div class="pr-commit-flow"> | |
|
119 | ## Source | |
|
120 | %if c.pull_request.source_ref_parts.type == 'branch': | |
|
121 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a> | |
|
122 | %else: | |
|
123 | <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code> | |
|
124 | %endif | |
|
125 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a> | |
|
126 | → | |
|
127 | ## Target | |
|
128 | %if c.pull_request.target_ref_parts.type == 'branch': | |
|
129 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a> | |
|
130 | %else: | |
|
131 | <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code> | |
|
96 | 132 | %endif |
|
97 | 133 | |
|
98 | <div class=""> | |
|
99 | <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> | |
|
100 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> | |
|
101 | </div> | |
|
134 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a> | |
|
135 | ||
|
136 | <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'> | |
|
137 | <i class="icon-angle-down">more details</i> | |
|
138 | </a> | |
|
102 | 139 | |
|
103 | 140 | </div> |
|
104 | </div> | |
|
105 |
<div class=" |
|
|
106 | <div class="label-summary"> | |
|
107 | <label>${_('Target')}:</label> | |
|
108 | </div> | |
|
109 | <div class="input"> | |
|
110 | <div class="pr-targetinfo"> | |
|
111 | ## branch link is only valid if it is a branch | |
|
112 | <span class="tag"> | |
|
113 | %if c.pull_request.target_ref_parts.type == 'branch': | |
|
114 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a> | |
|
115 | %else: | |
|
116 | ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name} | |
|
117 |
|
|
|
118 | </span> | |
|
119 |
|
|
|
120 | <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a> | |
|
121 | </span> | |
|
122 | </div> | |
|
123 | </div> | |
|
124 | </div> | |
|
141 | ||
|
142 | <div class="source-details" style="display: none"> | |
|
143 | ||
|
144 | <ul> | |
|
145 | ||
|
146 | ## common ancestor | |
|
147 | <li> | |
|
148 | ${_('Common ancestor')}: | |
|
149 | % if c.ancestor_commit: | |
|
150 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a> | |
|
151 | % else: | |
|
152 | ${_('not available')} | |
|
153 | % endif | |
|
154 | </li> | |
|
155 | ||
|
156 | ## pull url | |
|
157 | <li> | |
|
158 | %if h.is_hg(c.pull_request.source_repo): | |
|
159 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> | |
|
160 | %elif h.is_git(c.pull_request.source_repo): | |
|
161 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> | |
|
162 | %endif | |
|
125 | 163 | |
|
126 | ## Link to the shadow repository. | |
|
127 | <div class="field"> | |
|
128 | <div class="label-summary"> | |
|
129 | <label>${_('Merge')}:</label> | |
|
130 |
|
|
|
131 |
< |
|
|
132 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: | |
|
133 | %if h.is_hg(c.pull_request.target_repo): | |
|
134 | <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> | |
|
135 | %elif h.is_git(c.pull_request.target_repo): | |
|
136 | <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> | |
|
137 | %endif | |
|
138 | <div class=""> | |
|
139 | <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> | |
|
164 | <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> | |
|
165 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> | |
|
166 | </li> | |
|
167 | ||
|
168 | ## Shadow repo | |
|
169 | <li> | |
|
170 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: | |
|
171 | %if h.is_hg(c.pull_request.target_repo): | |
|
172 | <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> | |
|
173 | %elif h.is_git(c.pull_request.target_repo): | |
|
174 | <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> | |
|
175 | %endif | |
|
176 | ||
|
177 | <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> | |
|
140 | 178 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i> |
|
141 | </div> | |
|
142 | % else: | |
|
143 | <div class=""> | |
|
144 | ${_('Shadow repository data not available')}. | |
|
145 | </div> | |
|
146 | % endif | |
|
147 |
</ |
|
|
179 | ||
|
180 | % else: | |
|
181 | <div class=""> | |
|
182 | ${_('Shadow repository data not available')}. | |
|
183 | </div> | |
|
184 | % endif | |
|
185 | </li> | |
|
186 | ||
|
187 | </ul> | |
|
188 | ||
|
148 | 189 | </div> |
|
149 | 190 | |
|
150 | <div class="field"> | |
|
151 | <div class="label-summary"> | |
|
152 | <label>${_('Review')}:</label> | |
|
153 | </div> | |
|
154 | <div class="input"> | |
|
155 | %if c.pull_request_review_status: | |
|
156 | <i class="icon-circle review-status-${c.pull_request_review_status}"></i> | |
|
157 | <span class="changeset-status-lbl"> | |
|
158 | %if c.pull_request.is_closed(): | |
|
159 | ${_('Closed')}, | |
|
160 | %endif | |
|
161 | ${h.commit_status_lbl(c.pull_request_review_status)} | |
|
162 | </span> | |
|
163 | - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)} | |
|
164 | %endif | |
|
165 | </div> | |
|
166 | </div> | |
|
167 | <div class="field"> | |
|
168 | <div class="pr-description-label label-summary" title="${_('Rendered using {} renderer').format(c.renderer)}"> | |
|
169 | <label>${_('Description')}:</label> | |
|
170 | </div> | |
|
171 | <div id="pr-desc" class="input"> | |
|
172 | <div class="pr-description">${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)}</div> | |
|
173 | </div> | |
|
174 | <div id="pr-desc-edit" class="input textarea editor" style="display: none;"> | |
|
175 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> | |
|
176 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} | |
|
177 | </div> | |
|
191 | </div> | |
|
192 | ||
|
193 | </div> | |
|
194 | ||
|
195 | ## versions | |
|
196 | <div class="field"> | |
|
197 | <div class="label-pr-detail"> | |
|
198 | <label>${_('Versions')}:</label> | |
|
178 | 199 | </div> |
|
179 | 200 | |
|
180 | <div class="field"> | |
|
181 | <div class="label-summary"> | |
|
182 | <label>${_('Versions')}:</label> | |
|
183 | </div> | |
|
184 | ||
|
185 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> | |
|
186 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> | |
|
201 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> | |
|
202 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> | |
|
187 | 203 | |
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 | <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" | |
|
193 | data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}" | |
|
194 |
|
|
|
195 | ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))} | |
|
196 | </a> | |
|
197 |
|
|
|
198 | ## SHOW ALL VERSIONS OF PR | |
|
199 | <% ver_pr = None %> | |
|
204 | <div class="pr-versions"> | |
|
205 | % if c.show_version_changes: | |
|
206 | <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %> | |
|
207 | <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %> | |
|
208 | ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))} | |
|
209 | <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" | |
|
210 | data-toggle-on="${_('show versions')}." | |
|
211 | data-toggle-off="${_('hide versions')}."> | |
|
212 | ${_('show versions')}. | |
|
213 | </a> | |
|
214 | <table> | |
|
215 | ## SHOW ALL VERSIONS OF PR | |
|
216 | <% ver_pr = None %> | |
|
200 | 217 | |
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
|
218 | % for data in reversed(list(enumerate(c.versions, 1))): | |
|
219 | <% ver_pos = data[0] %> | |
|
220 | <% ver = data[1] %> | |
|
221 | <% ver_pr = ver.pull_request_version_id %> | |
|
222 | <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %> | |
|
206 | 223 | |
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
224 | <tr class="version-pr" style="display: ${display_row}"> | |
|
225 | <td> | |
|
226 | <code> | |
|
227 | <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a> | |
|
228 | </code> | |
|
229 | </td> | |
|
230 | <td> | |
|
231 | <input ${('checked="checked"' if c.from_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> | |
|
232 | <input ${('checked="checked"' if c.at_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> | |
|
233 | </td> | |
|
234 | <td> | |
|
235 | <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %> | |
|
236 | <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i> | |
|
220 | 237 | |
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 | <i class="icon-comment"></i> | |
|
225 | <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}"> | |
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 | </td> | |
|
236 | </tr> | |
|
237 | % endfor | |
|
238 | ||
|
239 | <tr> | |
|
240 | <td colspan="6"> | |
|
241 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" | |
|
242 | data-label-text-locked="${_('select versions to show changes')}" | |
|
243 | data-label-text-diff="${_('show changes between versions')}" | |
|
244 | data-label-text-show="${_('show pull request for this version')}" | |
|
245 | > | |
|
246 | ${_('select versions to show changes')} | |
|
247 | </button> | |
|
238 | </td> | |
|
239 | <td> | |
|
240 | % if c.at_version_num != ver_pr: | |
|
241 | <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i> | |
|
242 | <code> | |
|
243 | General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])} | |
|
244 | </code> | |
|
245 | % endif | |
|
246 | </td> | |
|
247 | <td> | |
|
248 | ##<code>${ver.source_ref_parts.commit_id[:6]}</code> | |
|
249 | </td> | |
|
250 | <td> | |
|
251 | <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code> | |
|
248 | 252 | </td> |
|
249 | 253 | </tr> |
|
250 |
|
|
|
251 | % else: | |
|
252 |
< |
|
|
253 | ${_('Pull request versions not available')}. | |
|
254 | </div> | |
|
255 | % endif | |
|
254 | % endfor | |
|
255 | ||
|
256 | <tr> | |
|
257 | <td colspan="6"> | |
|
258 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" | |
|
259 | data-label-text-locked="${_('select versions to show changes')}" | |
|
260 | data-label-text-diff="${_('show changes between versions')}" | |
|
261 | data-label-text-show="${_('show pull request for this version')}" | |
|
262 | > | |
|
263 | ${_('select versions to show changes')} | |
|
264 | </button> | |
|
265 | </td> | |
|
266 | </tr> | |
|
267 | </table> | |
|
268 | % else: | |
|
269 | <div class="input"> | |
|
270 | ${_('Pull request versions not available')}. | |
|
256 | 271 | </div> |
|
272 | % endif | |
|
257 | 273 | </div> |
|
274 | </div> | |
|
258 | 275 | |
|
259 | <div id="pr-save" class="field" style="display: none;"> | |
|
260 | <div class="label-summary"></div> | |
|
261 | <div class="input"> | |
|
262 | <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span> | |
|
263 | </div> | |
|
264 | </div> | |
|
276 | </div> | |
|
277 | ||
|
278 | </div> | |
|
279 | ||
|
280 | ## REVIEW RULES | |
|
281 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> | |
|
282 | <div class="pr-details-title"> | |
|
283 | ${_('Reviewer rules')} | |
|
284 | %if c.allowed_to_update: | |
|
285 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> | |
|
286 | %endif | |
|
265 | 287 | </div> |
|
266 | </div> | |
|
267 | <div> | |
|
268 | ## AUTHOR | |
|
269 | <div class="reviewers-title block-right"> | |
|
270 | <div class="pr-details-title"> | |
|
271 | ${_('Author of this pull request')} | |
|
272 | </div> | |
|
273 | </div> | |
|
274 | <div class="block-right pr-details-content reviewers"> | |
|
275 | <ul class="group_members"> | |
|
276 | <li> | |
|
277 | ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)} | |
|
278 | </li> | |
|
279 | </ul> | |
|
288 | <div class="pr-reviewer-rules"> | |
|
289 | ## review rules will be appended here, by default reviewers logic | |
|
280 | 290 | </div> |
|
281 | ||
|
282 | ## REVIEW RULES | |
|
283 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> | |
|
284 | <div class="pr-details-title"> | |
|
285 | ${_('Reviewer rules')} | |
|
286 | %if c.allowed_to_update: | |
|
287 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> | |
|
288 | %endif | |
|
289 | </div> | |
|
290 | <div class="pr-reviewer-rules"> | |
|
291 | ## review rules will be appended here, by default reviewers logic | |
|
292 | </div> | |
|
293 | <input id="review_data" type="hidden" name="review_data" value=""> | |
|
294 | </div> | |
|
291 | <input id="review_data" type="hidden" name="review_data" value=""> | |
|
292 | </div> | |
|
295 | 293 | |
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
294 | ## REVIEWERS | |
|
295 | <div class="reviewers-title block-right"> | |
|
296 | <div class="pr-details-title"> | |
|
297 | ${_('Pull request reviewers')} | |
|
298 | %if c.allowed_to_update: | |
|
299 | <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span> | |
|
300 | %endif | |
|
301 | </div> | |
|
302 | </div> | |
|
303 | <div id="reviewers" class="block-right pr-details-content reviewers"> | |
|
306 | 304 | |
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
305 | ## members redering block | |
|
306 | <input type="hidden" name="__start__" value="review_members:sequence"> | |
|
307 | <ul id="review_members" class="group_members"> | |
|
310 | 308 | |
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
309 | % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers: | |
|
310 | <script> | |
|
311 | var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n}; | |
|
312 | var status = "${(status[0][1].status if status else 'not_reviewed')}"; | |
|
313 | var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}"; | |
|
314 | var allowed_to_update = ${h.json.dumps(c.allowed_to_update)}; | |
|
317 | 315 | |
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
316 | var entry = renderTemplate('reviewMemberEntry', { | |
|
317 | 'member': member, | |
|
318 | 'mandatory': member.mandatory, | |
|
319 | 'reasons': member.reasons, | |
|
320 | 'allowed_to_update': allowed_to_update, | |
|
321 | 'review_status': status, | |
|
322 | 'review_status_label': status_lbl, | |
|
323 | 'user_group': member.user_group, | |
|
324 | 'create': false | |
|
325 | }); | |
|
326 | $('#review_members').append(entry) | |
|
327 | </script> | |
|
330 | 328 | |
|
331 |
|
|
|
332 | ||
|
333 | </ul> | |
|
329 | % endfor | |
|
334 | 330 | |
|
335 | <input type="hidden" name="__end__" value="review_members:sequence"> | |
|
336 | ## end members redering block | |
|
331 | </ul> | |
|
332 | ||
|
333 | <input type="hidden" name="__end__" value="review_members:sequence"> | |
|
334 | ## end members redering block | |
|
337 | 335 | |
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
|
345 | </div> | |
|
346 | % endif | |
|
347 | <div class="pull-right"> | |
|
348 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> | |
|
336 | %if not c.pull_request.is_closed(): | |
|
337 | <div id="add_reviewer" class="ac" style="display: none;"> | |
|
338 | %if c.allowed_to_update: | |
|
339 | % if not c.forbid_adding_reviewers: | |
|
340 | <div id="add_reviewer_input" class="reviewer_ac"> | |
|
341 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))} | |
|
342 | <div id="reviewers_container"></div> | |
|
349 | 343 | </div> |
|
350 | %endif | |
|
344 | % endif | |
|
345 | <div class="pull-right"> | |
|
346 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> | |
|
351 | 347 | </div> |
|
352 | 348 | %endif |
|
353 | </div> | |
|
354 |
|
|
|
349 | </div> | |
|
350 | %endif | |
|
351 | </div> | |
|
352 | ||
|
353 | ## ## TODOs will be listed here | |
|
354 | ## <div class="reviewers-title block-right"> | |
|
355 | ## <div class="pr-details-title"> | |
|
356 | ## ${_('TODOs')} | |
|
357 | ## </div> | |
|
358 | ## </div> | |
|
359 | ## <div class="block-right pr-details-content reviewers"> | |
|
360 | ## <ul class="group_members"> | |
|
361 | ## <li> | |
|
362 | ## XXXX | |
|
363 | ## </li> | |
|
364 | ## </ul> | |
|
365 | ## </div> | |
|
366 | ## </div> | |
|
367 | ||
|
355 | 368 | </div> |
|
356 | 369 | |
|
357 | 370 | <div class="box"> |
|
358 | 371 | |
|
359 | 372 | % if c.state_progressing: |
|
373 | ||
|
360 | 374 | <h2 style="text-align: center"> |
|
361 | 375 | ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span> |
|
362 | 376 | </h2> |
@@ -420,7 +434,7 b'' | |||
|
420 | 434 | ${_('Update commits')} |
|
421 | 435 | </a> |
|
422 | 436 | |
|
423 | <a id="update_commits_switcher" class="btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button"> | |
|
437 | <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}"> | |
|
424 | 438 | <i class="icon-down"></i> |
|
425 | 439 | </a> |
|
426 | 440 | |
@@ -611,209 +625,218 b'' | |||
|
611 | 625 | % endif |
|
612 | 626 | </div> |
|
613 | 627 | |
|
614 | <script type="text/javascript"> | |
|
628 | <script type="text/javascript"> | |
|
615 | 629 | |
|
616 |
|
|
|
617 |
|
|
|
630 | versionController = new VersionController(); | |
|
631 | versionController.init(); | |
|
618 | 632 | |
|
619 |
|
|
|
620 |
|
|
|
633 | reviewersController = new ReviewersController(); | |
|
634 | commitsController = new CommitsController(); | |
|
621 | 635 | |
|
622 |
|
|
|
636 | updateController = new UpdatePrController(); | |
|
623 | 637 | |
|
624 |
|
|
|
638 | $(function () { | |
|
625 | 639 | |
|
626 |
|
|
|
627 |
|
|
|
640 | // custom code mirror | |
|
641 | var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm; | |
|
628 | 642 | |
|
629 |
|
|
|
643 | var PRDetails = { | |
|
630 | 644 | editButton: $('#open_edit_pullrequest'), |
|
631 | 645 | closeButton: $('#close_edit_pullrequest'), |
|
632 | 646 | deleteButton: $('#delete_pullrequest'), |
|
633 | 647 | viewFields: $('#pr-desc, #pr-title'), |
|
634 |
editFields: $('#pr-desc-edit, #pr-title-edit, |
|
|
648 | editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'), | |
|
635 | 649 | |
|
636 | init: function() { | |
|
637 | var that = this; | |
|
638 |
this.editButton.on('click', function(e) { |
|
|
639 | this.closeButton.on('click', function(e) { that.view(); }); | |
|
650 | init: function () { | |
|
651 | var that = this; | |
|
652 | this.editButton.on('click', function (e) { | |
|
653 | that.edit(); | |
|
654 | }); | |
|
655 | this.closeButton.on('click', function (e) { | |
|
656 | that.view(); | |
|
657 | }); | |
|
640 | 658 | }, |
|
641 | 659 | |
|
642 | edit: function(event) { | |
|
643 | this.viewFields.hide(); | |
|
644 | this.editButton.hide(); | |
|
645 | this.deleteButton.hide(); | |
|
646 | this.closeButton.show(); | |
|
647 | this.editFields.show(); | |
|
648 | codeMirrorInstance.refresh(); | |
|
660 | edit: function (event) { | |
|
661 | this.viewFields.hide(); | |
|
662 | this.editButton.hide(); | |
|
663 | this.deleteButton.hide(); | |
|
664 | this.closeButton.show(); | |
|
665 | this.editFields.show(); | |
|
666 | codeMirrorInstance.refresh(); | |
|
649 | 667 | }, |
|
650 | 668 | |
|
651 | view: function(event) { | |
|
652 | this.editButton.show(); | |
|
653 | this.deleteButton.show(); | |
|
654 | this.editFields.hide(); | |
|
655 | this.closeButton.hide(); | |
|
656 | this.viewFields.show(); | |
|
669 | view: function (event) { | |
|
670 | this.editButton.show(); | |
|
671 | this.deleteButton.show(); | |
|
672 | this.editFields.hide(); | |
|
673 | this.closeButton.hide(); | |
|
674 | this.viewFields.show(); | |
|
657 | 675 | } |
|
658 |
|
|
|
676 | }; | |
|
659 | 677 | |
|
660 |
|
|
|
678 | var ReviewersPanel = { | |
|
661 | 679 | editButton: $('#open_edit_reviewers'), |
|
662 | 680 | closeButton: $('#close_edit_reviewers'), |
|
663 | 681 | addButton: $('#add_reviewer'), |
|
664 | 682 | removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'), |
|
665 | 683 | |
|
666 | init: function() { | |
|
667 | var self = this; | |
|
668 |
this.editButton.on('click', function(e) { |
|
|
669 | this.closeButton.on('click', function(e) { self.close(); }); | |
|
684 | init: function () { | |
|
685 | var self = this; | |
|
686 | this.editButton.on('click', function (e) { | |
|
687 | self.edit(); | |
|
688 | }); | |
|
689 | this.closeButton.on('click', function (e) { | |
|
690 | self.close(); | |
|
691 | }); | |
|
670 | 692 | }, |
|
671 | 693 | |
|
672 | edit: function(event) { | |
|
673 | this.editButton.hide(); | |
|
674 | this.closeButton.show(); | |
|
675 | this.addButton.show(); | |
|
676 | this.removeButtons.css('visibility', 'visible'); | |
|
677 | // review rules | |
|
678 | reviewersController.loadReviewRules( | |
|
679 | ${c.pull_request.reviewer_data_json | n}); | |
|
694 | edit: function (event) { | |
|
695 | this.editButton.hide(); | |
|
696 | this.closeButton.show(); | |
|
697 | this.addButton.show(); | |
|
698 | this.removeButtons.css('visibility', 'visible'); | |
|
699 | // review rules | |
|
700 | reviewersController.loadReviewRules( | |
|
701 | ${c.pull_request.reviewer_data_json | n}); | |
|
680 | 702 | }, |
|
681 | 703 | |
|
682 | close: function(event) { | |
|
683 | this.editButton.show(); | |
|
684 | this.closeButton.hide(); | |
|
685 | this.addButton.hide(); | |
|
686 | this.removeButtons.css('visibility', 'hidden'); | |
|
687 | // hide review rules | |
|
688 | reviewersController.hideReviewRules() | |
|
704 | close: function (event) { | |
|
705 | this.editButton.show(); | |
|
706 | this.closeButton.hide(); | |
|
707 | this.addButton.hide(); | |
|
708 | this.removeButtons.css('visibility', 'hidden'); | |
|
709 | // hide review rules | |
|
710 | reviewersController.hideReviewRules() | |
|
689 | 711 | } |
|
690 |
|
|
|
712 | }; | |
|
691 | 713 | |
|
692 |
|
|
|
693 |
|
|
|
714 | PRDetails.init(); | |
|
715 | ReviewersPanel.init(); | |
|
694 | 716 | |
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
|
698 |
|
|
|
699 |
|
|
|
700 |
|
|
|
717 | showOutdated = function (self) { | |
|
718 | $('.comment-inline.comment-outdated').show(); | |
|
719 | $('.filediff-outdated').show(); | |
|
720 | $('.showOutdatedComments').hide(); | |
|
721 | $('.hideOutdatedComments').show(); | |
|
722 | }; | |
|
701 | 723 | |
|
702 |
|
|
|
703 |
|
|
|
704 |
|
|
|
705 |
|
|
|
706 |
|
|
|
707 |
|
|
|
724 | hideOutdated = function (self) { | |
|
725 | $('.comment-inline.comment-outdated').hide(); | |
|
726 | $('.filediff-outdated').hide(); | |
|
727 | $('.hideOutdatedComments').hide(); | |
|
728 | $('.showOutdatedComments').show(); | |
|
729 | }; | |
|
708 | 730 | |
|
709 |
|
|
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
|
731 | refreshMergeChecks = function () { | |
|
732 | var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}"; | |
|
733 | $('.pull-request-merge').css('opacity', 0.3); | |
|
734 | $('.action-buttons-extra').css('opacity', 0.3); | |
|
713 | 735 | |
|
714 |
|
|
|
715 | loadUrl, function() { | |
|
716 | $('.pull-request-merge').css('opacity', 1); | |
|
736 | $('.pull-request-merge').load( | |
|
737 | loadUrl, function () { | |
|
738 | $('.pull-request-merge').css('opacity', 1); | |
|
717 | 739 | |
|
718 | $('.action-buttons-extra').css('opacity', 1); | |
|
719 | } | |
|
720 |
|
|
|
721 |
|
|
|
740 | $('.action-buttons-extra').css('opacity', 1); | |
|
741 | } | |
|
742 | ); | |
|
743 | }; | |
|
722 | 744 | |
|
723 |
|
|
|
724 |
|
|
|
745 | closePullRequest = function (status) { | |
|
746 | if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) { | |
|
725 | 747 | return false; |
|
726 |
|
|
|
727 |
|
|
|
728 |
|
|
|
729 |
|
|
|
730 |
|
|
|
731 |
|
|
|
748 | } | |
|
749 | // inject closing flag | |
|
750 | $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">'); | |
|
751 | $(generalCommentForm.statusChange).select2("val", status).trigger('change'); | |
|
752 | $(generalCommentForm.submitForm).submit(); | |
|
753 | }; | |
|
732 | 754 | |
|
733 |
|
|
|
734 |
|
|
|
735 |
|
|
|
755 | $('#show-outdated-comments').on('click', function (e) { | |
|
756 | var button = $(this); | |
|
757 | var outdated = $('.comment-outdated'); | |
|
736 | 758 | |
|
737 |
|
|
|
759 | if (button.html() === "(Show)") { | |
|
738 | 760 | button.html("(Hide)"); |
|
739 | 761 | outdated.show(); |
|
740 |
|
|
|
762 | } else { | |
|
741 | 763 | button.html("(Show)"); |
|
742 | 764 | outdated.hide(); |
|
743 |
|
|
|
744 |
|
|
|
765 | } | |
|
766 | }); | |
|
745 | 767 | |
|
746 |
|
|
|
747 |
|
|
|
748 |
|
|
|
749 |
|
|
|
750 |
|
|
|
751 |
|
|
|
752 |
|
|
|
753 |
|
|
|
754 |
|
|
|
755 |
|
|
|
756 |
|
|
|
757 |
|
|
|
758 |
|
|
|
759 |
|
|
|
760 |
|
|
|
768 | $('.show-inline-comments').on('change', function (e) { | |
|
769 | var show = 'none'; | |
|
770 | var target = e.currentTarget; | |
|
771 | if (target.checked) { | |
|
772 | show = '' | |
|
773 | } | |
|
774 | var boxid = $(target).attr('id_for'); | |
|
775 | var comments = $('#{0} .inline-comments'.format(boxid)); | |
|
776 | var fn_display = function (idx) { | |
|
777 | $(this).css('display', show); | |
|
778 | }; | |
|
779 | $(comments).each(fn_display); | |
|
780 | var btns = $('#{0} .inline-comments-button'.format(boxid)); | |
|
781 | $(btns).each(fn_display); | |
|
782 | }); | |
|
761 | 783 | |
|
762 |
|
|
|
763 |
|
|
|
764 |
|
|
|
765 |
|
|
|
766 |
|
|
|
767 |
|
|
|
784 | $('#merge_pull_request_form').submit(function () { | |
|
785 | if (!$('#merge_pull_request').attr('disabled')) { | |
|
786 | $('#merge_pull_request').attr('disabled', 'disabled'); | |
|
787 | } | |
|
788 | return true; | |
|
789 | }); | |
|
768 | 790 | |
|
769 |
|
|
|
770 |
|
|
|
771 |
|
|
|
772 |
|
|
|
773 |
|
|
|
774 | "${c.repo_name}", "${c.pull_request.pull_request_id}", | |
|
775 | title, description, renderer); | |
|
776 |
|
|
|
791 | $('#edit_pull_request').on('click', function (e) { | |
|
792 | var title = $('#pr-title-input').val(); | |
|
793 | var description = codeMirrorInstance.getValue(); | |
|
794 | var renderer = $('#pr-renderer-input').val(); | |
|
795 | editPullRequest( | |
|
796 | "${c.repo_name}", "${c.pull_request.pull_request_id}", | |
|
797 | title, description, renderer); | |
|
798 | }); | |
|
777 | 799 | |
|
778 |
|
|
|
779 |
|
|
|
780 |
|
|
|
781 |
|
|
|
782 |
|
|
|
783 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
|
784 |
|
|
|
800 | $('#update_pull_request').on('click', function (e) { | |
|
801 | $(this).attr('disabled', 'disabled'); | |
|
802 | $(this).addClass('disabled'); | |
|
803 | $(this).html(_gettext('Saving...')); | |
|
804 | reviewersController.updateReviewers( | |
|
805 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
|
806 | }); | |
|
785 | 807 | |
|
786 | 808 | |
|
787 |
|
|
|
788 |
|
|
|
809 | // fixing issue with caches on firefox | |
|
810 | $('#update_commits').removeAttr("disabled"); | |
|
789 | 811 | |
|
790 |
|
|
|
791 |
|
|
|
792 |
|
|
|
812 | $('.show-inline-comments').on('click', function (e) { | |
|
813 | var boxid = $(this).attr('data-comment-id'); | |
|
814 | var button = $(this); | |
|
793 | 815 | |
|
794 |
|
|
|
795 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
|
796 | $(this).hide(); | |
|
816 | if (button.hasClass("comments-visible")) { | |
|
817 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { | |
|
818 | $(this).hide(); | |
|
797 | 819 | }); |
|
798 | 820 | button.removeClass("comments-visible"); |
|
799 |
|
|
|
800 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
|
801 | $(this).show(); | |
|
821 | } else { | |
|
822 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { | |
|
823 | $(this).show(); | |
|
802 | 824 | }); |
|
803 | 825 | button.addClass("comments-visible"); |
|
804 |
|
|
|
805 |
|
|
|
826 | } | |
|
827 | }); | |
|
806 | 828 | |
|
807 |
|
|
|
808 |
|
|
|
809 |
|
|
|
810 |
|
|
|
829 | // register submit callback on commentForm form to track TODOs | |
|
830 | window.commentFormGlobalSubmitSuccessCallback = function () { | |
|
831 | refreshMergeChecks(); | |
|
832 | }; | |
|
811 | 833 | |
|
812 |
|
|
|
834 | ReviewerAutoComplete('#user'); | |
|
813 | 835 | |
|
814 |
|
|
|
836 | }) | |
|
815 | 837 | |
|
816 |
|
|
|
838 | </script> | |
|
839 | ||
|
817 | 840 | </div> |
|
818 | 841 | |
|
819 | 842 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now