diff --git a/rhodecode/templates/pullrequests/pullrequest.html b/rhodecode/templates/pullrequests/pullrequest.html
--- a/rhodecode/templates/pullrequests/pullrequest.html
+++ b/rhodecode/templates/pullrequests/pullrequest.html
@@ -107,6 +107,7 @@
@@ -247,16 +248,33 @@
query.callback({results: data.results});
};
- var prButtonLock = function(lockEnabled, msg) {
+
+ var prButtonLockChecks = {
+ 'compare': false,
+ 'reviewers': false
+ };
+
+ var prButtonLock = function(lockEnabled, msg, scope) {
+ scope = scope || 'all';
+ if (scope == 'all'){
+ prButtonLockChecks['compare'] = !lockEnabled;
+ prButtonLockChecks['reviewers'] = !lockEnabled;
+ } else if (scope == 'compare') {
+ prButtonLockChecks['compare'] = !lockEnabled;
+ } else if (scope == 'reviewers'){
+ prButtonLockChecks['reviewers'] = !lockEnabled;
+ }
+ var checksMeet = prButtonLockChecks.compare && prButtonLockChecks.reviewers;
if (lockEnabled) {
$('#save').attr('disabled', 'disabled');
}
- else {
+ else if (checksMeet) {
$('#save').removeAttr('disabled');
}
- $('#pr_open_message').html(msg);
-
+ if (msg) {
+ $('#pr_open_message').html(msg);
+ }
};
var loadRepoRefDiffPreview = function() {
@@ -284,7 +302,7 @@
var url = pyroutes.url('compare_url', url_data);
// lock PR button, so we cannot send PR before it's calculated
- prButtonLock(true, "${_('Loading compare ...')}");
+ prButtonLock(true, "${_('Loading compare ...')}", 'compare');
if (loadRepoRefDiffPreview._currentRequest) {
loadRepoRefDiffPreview._currentRequest.abort();
@@ -340,10 +358,10 @@
if (commitElements.length) {
var commitsLink = '
{0}'.format(commitElements.length);
- prButtonLock(false, msg.replace('__COMMITS__', commitsLink));
+ prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
}
else {
- prButtonLock(true, "${_('There are no commits to merge.')}");
+ prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
}
@@ -391,7 +409,7 @@
var globalDefaults = {
dropdownAutoWidth: true,
containerCssClass: "drop-menu",
- dropdownCssClass: "drop-menu-dropdown",
+ dropdownCssClass: "drop-menu-dropdown"
};
var initSelect2 = function(defaultOptions) {
@@ -422,7 +440,7 @@
element.select2('val', defaultSourceRepo);
if (readOnly === true) {
element.select2('readonly', true);
- };
+ }
}
};
};
@@ -519,6 +537,9 @@
if (loadDefaultReviewers._currentRequest) {
loadDefaultReviewers._currentRequest.abort();
}
+ $('.calculate-reviewers').show();
+ prButtonLock(true, null, 'reviewers');
+
var url = pyroutes.url('repo_default_reviewers_data', {'repo_name': targetRepoName});
var sourceRepo = $sourceRepo.eq(0).val();
@@ -531,7 +552,7 @@
url += '&target_ref=' + targetRef[2];
loadDefaultReviewers._currentRequest = $.get(url)
- .done(function(data) {
+ .done(function(data) {
loadDefaultReviewers._currentRequest = null;
// reset && add the reviewer based on selected repo
@@ -543,9 +564,12 @@
reviewer.lastname, reviewer.username,
reviewer.gravatar_link, reviewer.reasons);
}
- });
+ $('.calculate-reviewers').hide();
+ prButtonLock(false, null, 'reviewers');
+ });
};
- prButtonLock(true, "${_('Please select origin and destination')}");
+
+ prButtonLock(true, "${_('Please select origin and destination')}", 'all');
// auto-load on init, the target refs select2
calculateContainerWidth();
@@ -555,12 +579,12 @@
$(this).removeClass('autogenerated-title');
});
- %if c.default_source_ref:
+ % if c.default_source_ref:
// in case we have a pre-selected value, use it now
$sourceRef.select2('val', '${c.default_source_ref}');
loadRepoRefDiffPreview();
loadDefaultReviewers();
- %endif
+ % endif
ReviewerAutoComplete('user');
});