diff --git a/module/branch/control.php b/module/branch/control.php
index 6ff155b606..7a34047e69 100644
--- a/module/branch/control.php
+++ b/module/branch/control.php
@@ -37,13 +37,14 @@ class branch extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$branchList = array_chunk($branchList, $pager->recPerPage);
- $this->view->title = $this->lang->branch->manage;
- $this->view->branchList = empty($branchList) ? $branchList : $branchList[$pageID - 1];
- $this->view->productID = $productID;
- $this->view->browseType = $browseType;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->product = $this->product->getById($productID);
+ $this->view->title = $this->lang->branch->manage;
+ $this->view->branchList = empty($branchList) ? $branchList : $branchList[$pageID - 1];
+ $this->view->productID = $productID;
+ $this->view->browseType = $browseType;
+ $this->view->orderBy = $orderBy;
+ $this->view->pager = $pager;
+ $this->view->product = $this->product->getById($productID);
+ $this->view->branchPairs = $this->branch->getPairs($productID);
$this->display();
}
@@ -299,4 +300,18 @@ class branch extends control
die(js::reload('parent'));
}
+
+ /**
+ * Merge multiple branches into one branch.
+ *
+ * @param int $productID
+ * @access public
+ * @return void
+ */
+ public function mergeBranch($productID)
+ {
+ $this->loadModel('product')->setMenu($productID);
+
+ $this->display();
+ }
}
diff --git a/module/branch/css/manage.css b/module/branch/css/manage.css
index 171db9731a..a34994347c 100644
--- a/module/branch/css/manage.css
+++ b/module/branch/css/manage.css
@@ -7,3 +7,5 @@ a.setDefault {padding-left: 8px !important}
td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;}
td.flex .label-primary {min-width: 40px;}
td.flex .setDefault {min-width: 120px;}
+
+#mergeBranch .form-actions {padding-top: 20px;}
diff --git a/module/branch/js/manage.js b/module/branch/js/manage.js
index c71d512c56..ecb028bb6e 100644
--- a/module/branch/js/manage.js
+++ b/module/branch/js/manage.js
@@ -44,4 +44,23 @@ $(function()
{
$(this).find('.setDefault').addClass('hidden');
})
+
+ $('#newBranch').change(function()
+ {
+ if($(this).prop('checked'))
+ {
+ $('#targetBranches').attr('disabled', true).trigger('chosen:updated');
+
+ var newBranchName = '
| ' + branchLang.name + " | |
";
+ var newBranchDesc = '| ' + branchLang.desc + " | |
";
+ $(this).closest('tr').after(newBranchName + newBranchDesc);
+ }
+ else
+ {
+ $('#targetBranches').attr('disabled', false).trigger('chosen:updated');
+
+ $('#name').closest('tr').remove();
+ $('#desc').closest('tr').remove();
+ }
+ })
});
diff --git a/module/branch/lang/en.php b/module/branch/lang/en.php
index 605a120986..f1af01a420 100644
--- a/module/branch/lang/en.php
+++ b/module/branch/lang/en.php
@@ -22,6 +22,8 @@ $lang->branch->batchEdit = 'Batch Edit';
$lang->branch->defaultBranch = 'Default Branch';
$lang->branch->setDefault = 'Set Default';
$lang->branch->setDefaultAction = 'Set Default';
+$lang->branch->mergeTo = 'Merge branch to';
+$lang->branch->mergeBranch = 'Merge branch';
$lang->branch->id = 'ID';
$lang->branch->product = 'Product';
@@ -42,6 +44,8 @@ $lang->branch->nameNotEmpty = 'Name must not be empty!';
$lang->branch->confirmClose = 'Do you want to close this @branch@?';
$lang->branch->confirmActivate = 'Do you want to activate this @branch@?';
$lang->branch->existName = '@branch@ name already exists.';
+$lang->branch->mergeTips = '(Trunk does not support being merged. After the branch is merged, the corresponding releases, plans, modules, requirements, bugs, and cases under the branch will be merged into the new branch)';
+$lang->branch->targetBranchTips = 'Note: You can merge it into an existing branch, merge it into the trunk, or create a new branch.';
$lang->branch->noData = 'No branches.';
$lang->branch->mainBranch = 'The default main %s of the product.';
diff --git a/module/branch/lang/zh-cn.php b/module/branch/lang/zh-cn.php
index 16ac4aa7be..c88e63aa11 100644
--- a/module/branch/lang/zh-cn.php
+++ b/module/branch/lang/zh-cn.php
@@ -15,13 +15,15 @@ $lang->branch->activate = '激活';
$lang->branch->activateAction = '激活分支';
$lang->branch->close = '关闭';
$lang->branch->closeAction = '关闭分支';
-$lang->branch->create = '新增%s';
-$lang->branch->createAction = '新增分支';
+$lang->branch->create = '新建%s';
+$lang->branch->createAction = '新建分支';
$lang->branch->merge = '合并';
$lang->branch->batchEdit = '批量编辑';
$lang->branch->defaultBranch = '默认分支';
$lang->branch->setDefault = '设为默认分支';
$lang->branch->setDefaultAction = '设置默认分支';
+$lang->branch->mergeTo = '合并分支到';
+$lang->branch->mergeBranch = '合并分支';
$lang->branch->id = 'ID';
$lang->branch->product = '所属产品';
@@ -42,6 +44,8 @@ $lang->branch->nameNotEmpty = '名称不能为空!';
$lang->branch->confirmClose = '是否关闭该@branch@?';
$lang->branch->confirmActivate = '是否激活该@branch@?';
$lang->branch->existName = '@branch@名称已存在';
+$lang->branch->mergeTips = '(主干不支持被合并,合并分支后,会将分支下面对应的发布、计划、模块、需求、Bug、用例都合并到新的分支下)';
+$lang->branch->targetBranchTips = '注:您可以将其合并到已有的一个分支,也可以合并到主干,也可以新创建一个分支。';
$lang->branch->noData = '暂时没有分支。';
$lang->branch->mainBranch = '产品默认主干%s。';
diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php
index 886365b2ab..4c2331036d 100644
--- a/module/branch/view/manage.html.php
+++ b/module/branch/view/manage.html.php
@@ -13,6 +13,7 @@
+branch);?>
@@ -124,6 +125,7 @@
createLink('branch', 'batchEdit', "productID=$productID");
echo html::submitButton($lang->edit, "data-form-action='$batchEditLink'", 'btn');
+ echo html::a('#mergeBranch', $lang->branch->merge, '', "data-toggle='modal' class='btn'");
?>
@@ -133,4 +135,46 @@
+
+