* Pass the data of the merged branch.
This commit is contained in:
@@ -305,12 +305,11 @@ class branch extends control
|
||||
/**
|
||||
* Merge multiple branches into one branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function mergeBranch($productID)
|
||||
public function mergeBranch()
|
||||
{
|
||||
$this->display();
|
||||
$this->branch->mergeBranch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ $(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$('#targetBranches').attr('disabled', true).trigger('chosen:updated');
|
||||
$('#targetBranch').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>";
|
||||
@@ -57,10 +57,35 @@ $(function()
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#targetBranches').attr('disabled', false).trigger('chosen:updated');
|
||||
$('#targetBranch').attr('disabled', false).trigger('chosen:updated');
|
||||
|
||||
$('#name').closest('tr').remove();
|
||||
$('#desc').closest('tr').remove();
|
||||
}
|
||||
})
|
||||
|
||||
$('#saveButton').on('click', function()
|
||||
{
|
||||
var mergedBranchIDList = [];
|
||||
$("input:checkbox[name^='branchIDList']:checked").each(function()
|
||||
{
|
||||
mergedBranchIDList.push($(this).val());
|
||||
});
|
||||
|
||||
var isChecked = $('#newBranch').attr('checked') ? true : false;
|
||||
if(isChecked)
|
||||
{
|
||||
var postData = {'newBranchName' : $('#name').val(), 'newBranchDesc' : $('#desc').val(), 'newBranch' : isChecked, 'mergedBranchIDList' : mergedBranchIDList};
|
||||
}
|
||||
else
|
||||
{
|
||||
var postData = {'targetBranch' : $('#targetBranch').val(), 'mergedBranchIDList' : mergedBranchIDList};
|
||||
}
|
||||
|
||||
$.post(createLink('branch', 'mergeBranch'), postData, function()
|
||||
{
|
||||
$('#mergeBranch').modal('hide');
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -574,4 +574,15 @@ class branchModel extends model
|
||||
$this->lang->branch->confirmActivate = str_replace('@branch@', $this->lang->product->branchName[$productType], $this->lang->branch->confirmActivate);
|
||||
$this->lang->branch->existName = str_replace('@branch@', $this->lang->product->branchName[$productType], $this->lang->branch->existName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge branch.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function mergeBranch()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +151,9 @@
|
||||
<th class='thWidth'><?php echo $lang->branch->mergeTo;?></th>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<?php echo html::select('targetBranches', $branchPairs, '', "class='form-control chosen'");?>
|
||||
<?php echo html::select('targetBranch', $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>
|
||||
<?php echo html::checkbox('newBranch', $lang->branch->createAction, '', "id='newBranch'")?>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -167,7 +164,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::commonButton($lang->save, "id='saveButton'", 'btn btn-primary btn-wide');?>
|
||||
<?php echo html::linkButton($lang->goback, $this->createLink('branch', 'manage', "productID=$productID"), 'self', '', 'btn btn-wide');?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user