* Code for task #45756.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
|
||||
@@ -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 = '<tr><th>' + branchLang.name + "</th><td><input type='text' name='name' id='name' class='form-control' /></td></tr>";
|
||||
var newBranchDesc = '<tr><th>' + branchLang.desc + "</th><td><input type='text' name='desc' id='desc' class='form-control' /></td></tr>";
|
||||
$(this).closest('tr').after(newBranchName + newBranchDesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#targetBranches').attr('disabled', false).trigger('chosen:updated');
|
||||
|
||||
$('#name').closest('tr').remove();
|
||||
$('#desc').closest('tr').remove();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -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.';
|
||||
|
||||
@@ -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。';
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php js::set('orderBy', $orderBy)?>
|
||||
<?php js::set('branchLang', $lang->branch);?>
|
||||
<?php $canCreate = common::hasPriv('branch', 'create');?>
|
||||
<?php $canOrder = common::hasPriv('branch', 'sort');?>
|
||||
<?php $canBatchEdit = common::hasPriv('branch', 'batchEdit');?>
|
||||
@@ -124,6 +125,7 @@
|
||||
<?php
|
||||
$batchEditLink = $this->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'");
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
@@ -133,4 +135,46 @@
|
||||
</form>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="mergeBranch">
|
||||
<div class="modal-dialog mw-700px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
|
||||
<span class="modal-title"><?php echo $lang->branch->mergeBranch;?></span>
|
||||
<small> <?php echo $lang->branch->mergeTips;?></small>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->branch->mergeTo;?></th>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('targetBranches', $branchPairs, '', "class='form-control chosen'");?>
|
||||
<span class='input-group-addon'>
|
||||
<div class="checkbox-primary">
|
||||
<input type="checkbox" name="newBranch" value="" id="newBranch"/>
|
||||
<label for="newBranch"><?php echo $lang->branch->createAction;?></label>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><span><?php echo $lang->branch->targetBranchTips;?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::linkButton($lang->goback, $this->createLink('branch', 'manage', "productID=$productID"), 'self', '', 'btn btn-wide');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user