* Finish task#8156: Optimize the structure of the code.

This commit is contained in:
hufangzhou
2020-10-12 16:35:31 +08:00
parent 1d59f85b0f
commit 8dbf4ff9f5
3 changed files with 7 additions and 23 deletions
-23
View File
@@ -239,29 +239,6 @@ $(function()
e.preventDefault();
});
/* Assign value to the manage products by the different request type.*/
if(window.config.currentMethod === 'create')
{
var url = window.location.href;
if(window.config.requestType === 'GET')
{
var paramStr = url.split('?')[1];
var paramArr = paramStr.split('&');
var productID = paramArr[2] ? paramArr[2].split('=')[1] : 0;
}
else
{
var urlArr = url.split('/');
var paramStr = urlArr[urlArr.length-1];
var paramArr = paramStr.split('-');
var productID = paramArr[2] ? paramArr[2].split('.')[0] : 0;
}
var product = $('#products0');
$(product).val(productID);
$(product).trigger("chosen:updated");
loadBranches($(product));
}
adjustProductBoxMargin();
adjustPlanBoxMargin();
});
+6
View File
@@ -30,6 +30,12 @@ $(function()
});
}
/* Assign value to the manage products by the different request type.*/
var product = $('#products0');
$(product).val(productID);
$(product).trigger("chosen:updated");
loadBranches($(product));
var adjustMainCol = function()
{
$('.main-form .col-main').css('width', Math.max(250, Math.floor(($('#productsBox').outerWidth() - 50)/3) + 10));
+1
View File
@@ -34,6 +34,7 @@
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('holders', $lang->project->placeholder);?>
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
<?php js::set('productID', empty($productID) ? 0 : $productID);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>