* Modify required item judgment method.

This commit is contained in:
liumengyi
2022-01-19 09:01:29 +08:00
parent eb31aac6a1
commit a1c6cfadcc
5 changed files with 3 additions and 24 deletions
+1 -18
View File
@@ -1,19 +1,3 @@
/**
* Add link products required class.
*
* @access public
* @return void
*/
function addProductsRequiredClass()
{
$('#productsBox .input-group').removeClass('required');
$('#productsBox .input-group').each(function()
{
$(this).addClass('required');
return false;
} );
}
function switchStatus(projectID, status)
{
if(status) location.href = createLink('project', 'task', 'project=' + projectID + '&type=' + status);
@@ -155,7 +139,7 @@ function loadBranches(product)
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
@@ -182,7 +166,6 @@ function loadBranches(product)
var branchID = $('#branch' + index).val();
loadPlans(product, branchID);
});
if(projectModel == 'kanban' || projectModel == 'waterfall') addProductsRequiredClass();
}
/**
-2
View File
@@ -17,8 +17,6 @@ $(function()
$("input:radio[name='delta']").attr("checked", false);
})
if(projectModel == 'kanban' || projectModel == 'waterfall') addProductsRequiredClass();
if(typeof(currentPlanID) == 'undefined')
{
$('#productsBox select[id^="products"]').each(function()
-2
View File
@@ -64,8 +64,6 @@ $(function()
}
});
if(projectModel == 'kanban' || projectModel == 'waterfall') addProductsRequiredClass();
oldProject = $("#project").val();
$('#project').change(function()
{
+1 -1
View File
@@ -145,7 +145,7 @@
<?php endforeach;?>
<?php endforeach;?>
<div class='col-sm-4'>
<div class="input-group">
<div class="input-group <?php if(in_array($project->model, array('kanban', 'waterfall'))) echo 'required';?>">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
+1 -1
View File
@@ -142,7 +142,7 @@
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
<div class='col-sm-4'>
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<div class="input-group<?php if(in_array($project->model, array('kanban', 'waterfall')) and $i == 0) echo " required";if($hasBranch) echo ' has-branch';?>">
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $class onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='". $product->type ."'");?>
<span class='input-group-addon fix-border'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $branchID, "class='form-control chosen' $class onchange=\"loadPlans('#products{$i}', this.value)\" data-last='" . $branchID . "'");?>