From 897f930f481268049f49ef0e7fc896f1fc12e2a2 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 23 Dec 2021 14:01:25 +0800 Subject: [PATCH] * Adjust the merge branch page style. --- module/branch/js/manage.js | 15 ++++++++++++--- module/branch/view/manage.html.php | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/module/branch/js/manage.js b/module/branch/js/manage.js index f52b3a8b75..49f87ac8e8 100644 --- a/module/branch/js/manage.js +++ b/module/branch/js/manage.js @@ -65,8 +65,8 @@ $(function() { $('#targetBranch').attr('disabled', true).trigger('chosen:updated'); - var newBranchName = '' + branchLang.name + ""; - var newBranchDesc = '' + branchLang.desc + ""; + var newBranchName = '' + branchLang.name + ""; + var newBranchDesc = '' + branchLang.desc + ""; $(this).closest('tr').after(newBranchName + newBranchDesc); } else @@ -96,6 +96,8 @@ $(function() $('#targetBranch').replaceWith(data); $('#targetBranch_chosen').remove(); $('#targetBranch').chosen(); + + if($('#createBranch').prop('checked')) $('#targetBranch').attr('disabled', true).trigger('chosen:updated') }) }) @@ -123,6 +125,13 @@ $(function() return false; } + var branchNames = Object.values(branchPairs); + if(isChecked && branchNames.includes($('#name').val()) !== -1) + { + alert(branchLang.existName); + return false; + } + if(confirm(confirmMergeMessage)) { var postData = {'name' : $('#name').val(), 'desc' : $('#desc').val(), 'createBranch' : isChecked, 'mergedBranchIDList' : mergedBranchIDList, 'targetBranch' : $('#targetBranch').val()}; @@ -136,7 +145,7 @@ $(function() { if(data.result == 'fail') { - alert(data.message) + alert(data.message.name) return false; } else diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php index bb39ad9aab..7c7af2328d 100644 --- a/module/branch/view/manage.html.php +++ b/module/branch/view/manage.html.php @@ -15,6 +15,7 @@ branch);?> +