* Finish the control and view for creating MR.

This commit is contained in:
dingguodong
2021-08-20 12:12:56 +08:00
parent 90e660b388
commit 84b7170f9c
4 changed files with 28 additions and 8 deletions
-1
View File
@@ -42,7 +42,6 @@ class mr extends control
$this->view->title = $this->lang->mr->create;
$this->view->gitlabHosts = $this->loadModel('gitlab')->getPairs();
$this->view->users = $this->gitlab->getUserIdRealnamePairs(14);
$this->display();
}
+17 -5
View File
@@ -2,22 +2,34 @@ $(function()
{
$('#gitlabID').change(function()
{
host = $('#gitlabID').val();
if(host == '') return false;
gitlabID = $('#gitlabID').val();
if(gitlabID == '') return false;
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host);
url = createLink('repo', 'ajaxgetgitlabprojects', "gitlabID=" + gitlabID);
$.get(url, function(response)
{
$('#sourceProject').html('').append(response);
$('#sourceProject').chosen().trigger("chosen:updated");;
});
var assignee = $("#assignee").parents('td').find('select[name*=assignee]');
var reviewer = $("#reviewer").parents('td').find('select[name*=reviewer]');
usersUrl = createLink('gitlab', 'ajaxgetmruserpairs', "gitlabID=" + gitlabID);
$.get(usersUrl, function(response)
{
assignee.html('').append(response);
assignee.chosen().trigger("chosen:updated");;
reviewer.html('').append(response);
reviewer.chosen().trigger("chosen:updated");;
});
});
$('#sourceProject,#targetProject').change(function()
{
sourceProject = $(this).val();
var branchSelect = $(this).parents('td').find('select[name*=Branch]');
branchUrl = createLink('gitlab', 'ajaxgetprojectbranches', "gitlabID=" + host + "&projectID=" + sourceProject);
branchUrl = createLink('gitlab', 'ajaxgetprojectbranches', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
$.get(branchUrl, function(response)
{
branchSelect.html('').append(response);
@@ -29,7 +41,7 @@ $(function()
$('#sourceProject').change(function()
{
sourceProject = $(this).val();
projectUrl = createLink('mr', 'ajaxGetMRTragetProjects', "gitlabID=" + host + "&projectID=" + sourceProject);
projectUrl = createLink('mr', 'ajaxGetMRTragetProjects', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
$.get(projectUrl, function(response)
{
$('#targetProject').html('').append(response);
+2
View File
@@ -23,3 +23,5 @@ $lang->mr->sourceProject = '源项目';
$lang->mr->sourceBranch = '源分支';
$lang->mr->targetProject = '目标项目';
$lang->mr->targetBranch = '目标分支';
$lang->mr->usersTips = '提示:如果无法选择指派人和评审人,请先前往GitLab页面绑定用户。';
+9 -2
View File
@@ -12,6 +12,9 @@
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->mr->create;?></h2>
</div>
<form id='mrForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
@@ -48,11 +51,15 @@
</tr>
<tr>
<th><?php echo $lang->mr->assignee;?></th>
<td><?php echo html::select('assignee', $users, '', "class='form-control chosen'")?></td>
<td><?php echo html::select('assignee', array(''), '', "class='form-control chosen'")?></td>
</tr>
<tr>
<th><?php echo $lang->mr->reviewer;?></th>
<td><?php echo html::select('reviewer', $users, '', "class='form-control chosen'")?></td>
<td><?php echo html::select('reviewer', array(''), '', "class='form-control chosen'")?></td>
</tr>
<tr>
<th></th>
<td><?php echo $lang->mr->usersTips;?></td>
</tr>
<tr>
<th></th>