##// END OF EJS Templates
pull-requests: use close logic next to merge....
marcink -
r3977:3977ceb4 default
parent child Browse files
Show More
@@ -1795,6 +1795,10 b' BIN_FILENODE = 7'
1795 margin-bottom: 20px;
1795 margin-bottom: 20px;
1796 }
1796 }
1797
1797
1798 .pull-request-merge-refresh {
1799 margin: 2px 7px;
1800 }
1801
1798 .pull-request-merge ul {
1802 .pull-request-merge ul {
1799 padding: 0px 0px;
1803 padding: 0px 0px;
1800 }
1804 }
@@ -52,30 +52,34 b''
52 <div>
52 <div>
53 ${h.secure_form(h.route_path('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form', request=request)}
53 ${h.secure_form(h.route_path('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form', request=request)}
54 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
54 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
55 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
55
56 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
56 % if c.allowed_to_close:
57 ## close PR action, injected later next to COMMENT button
58 % if c.pull_request_review_status == c.REVIEW_STATUS_APPROVED:
59 <a id="close-pull-request-action" class="btn btn-approved-status" href="#close-as-approved" onclick="closePullRequest('${c.REVIEW_STATUS_APPROVED}'); return false;">
60 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_APPROVED))}
61 </a>
62 % else:
63 <a id="close-pull-request-action" class="btn btn-rejected-status" href="#close-as-rejected" onclick="closePullRequest('${c.REVIEW_STATUS_REJECTED}'); return false;">
64 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_REJECTED))}
65 </a>
66 % endif
67 % endif
68
69 <input type="submit" id="merge_pull_request" value="${_('Merge and close Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
57 ${h.end_form()}
70 ${h.end_form()}
71
72 <div class="pull-request-merge-refresh">
73 <a href="#refreshChecks" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
74 </div>
75
58 </div>
76 </div>
59 % elif c.rhodecode_user.username != h.DEFAULT_USER:
77 % elif c.rhodecode_user.username != h.DEFAULT_USER:
60 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
78 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
61 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
79 <input type="submit" value="${_('Merge and close Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
62 % else:
80 % else:
63 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
81 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
64 % endif
82 % endif
65 </div>
83 </div>
66
84
67 % if c.allowed_to_close:
68 ## close PR action, injected later next to COMMENT button
69 <div id="close-pull-request-action" style="display: none">
70 % if c.pull_request_review_status == c.REVIEW_STATUS_APPROVED:
71 <a class="btn btn-approved-status" href="#close-as-approved" onclick="closePullRequest('${c.REVIEW_STATUS_APPROVED}'); return false;">
72 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_APPROVED))}
73 </a>
74 % else:
75 <a class="btn btn-rejected-status" href="#close-as-rejected" onclick="closePullRequest('${c.REVIEW_STATUS_REJECTED}'); return false;">
76 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_REJECTED))}
77 </a>
78 % endif
79 </div>
80 % endif
81 </div>
85 </div>
@@ -692,19 +692,10 b''
692 $('.pull-request-merge').css('opacity', 1);
692 $('.pull-request-merge').css('opacity', 1);
693
693
694 $('.action-buttons-extra').css('opacity', 1);
694 $('.action-buttons-extra').css('opacity', 1);
695 injectCloseAction();
696 }
695 }
697 );
696 );
698 };
697 };
699
698
700 injectCloseAction = function() {
701 var closeAction = $('#close-pull-request-action').html();
702 var $actionButtons = $('.action-buttons-extra');
703 // clear the action before
704 $actionButtons.html("");
705 $actionButtons.html(closeAction);
706 };
707
708 closePullRequest = function (status) {
699 closePullRequest = function (status) {
709 // inject closing flag
700 // inject closing flag
710 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
701 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
@@ -800,8 +791,6 b''
800 window.commentFormGlobalSubmitSuccessCallback = function(){
791 window.commentFormGlobalSubmitSuccessCallback = function(){
801 refreshMergeChecks();
792 refreshMergeChecks();
802 };
793 };
803 // initial injection
804 injectCloseAction();
805
794
806 ReviewerAutoComplete('#user');
795 ReviewerAutoComplete('#user');
807
796
General Comments 0
You need to be logged in to leave comments. Login now