* Fix problems in code review.

This commit is contained in:
tianshujie
2022-01-05 11:02:34 +08:00
parent 3125190938
commit ac03f67bdb
5 changed files with 87 additions and 78 deletions
+1 -1
View File
@@ -591,7 +591,7 @@ class kanbanModel extends model
$lane->order = $laneOrder;
$lane->items = $planList;
$lanes[] = $lane;
$lanes[] = $lane;
$laneOrder ++;
$colorIndex ++;
if($colorIndex == count($this->config->productplan->laneColorList)) $colorIndex = 0;
+2 -2
View File
@@ -280,9 +280,9 @@ class productplan extends control
foreach($branches as $id => $name)
{
$plans = isset($planGroup[$product->id][$id]) ? array_filter($planGroup[$product->id][$id]) : array();
$plans = isset($planGroup[$product->id][$id]) ? array_filter($planGroup[$product->id][$id]) : array();
$branchPairs[$id] = $name . ' ' . count($plans);
$planCount += count($plans);
$planCount += count($plans);
}
$this->view->branches = array('all' => $this->lang->productplan->allAB . ' ' . $planCount) + $branchPairs;
+56 -47
View File
@@ -56,18 +56,18 @@ $(function()
$('#branch_chosen .chosen-single span').prepend('<i class="icon-delay"></i>');
$('#kanban').kanban(
{
data: kanbanData,
minColWidth: 290,
maxColWidth: 290,
maxColHeight: 460,
minColHeight: 190,
cardHeight: 80,
itemRender: renderKanbanItem,
virtualize: true,
data: kanbanData,
minColWidth: 290,
maxColWidth: 290,
maxColHeight: 460,
minColHeight: 190,
cardHeight: 80,
itemRender: renderKanbanItem,
virtualize: true,
droppable:
{
target: findDropColumns,
finish: handleFinishDrop,
target: findDropColumns,
finish: handleFinishDrop,
mouseButton: 'left'
}
});
@@ -77,7 +77,7 @@ $(function()
$.zui.ContextMenu.hide();
});
/* Init contextmenu */
/* Init contextmenu. */
$('#kanban').on('click', '[data-contextmenu]', function(event)
{
var $trigger = $(this);
@@ -86,30 +86,27 @@ $(function()
if(!menuCreator) return;
var options = $.extend({event: event, $trigger: $trigger}, $trigger.data());
var items = menuCreator(options);
var items = menuCreator(options);
if(!items || !items.length) return;
$.zui.ContextMenu.show(items, items.$options || {event: event});
});
}
/* Hide contextmenu when page scroll */
/* Hide contextmenu when page scroll. */
$(window).on('scroll', function()
{
$.zui.ContextMenu.hide();
});
});
/* Define menu creators */
window.menuCreators =
{
card: createCardMenu
};
/* Define menu creators. */
window.menuCreators = {card: createCardMenu};
/**
* Create card menu.
*
* @param object $options
* @param object options
* @access public
* @return array
*/
@@ -194,11 +191,14 @@ $(document).on('click', 'td.content .more', function(e)
}
});
/*
* Find drop columns
* @param {JQuery} $element Drag element
* @param {JQuery} $root Dnd root element
*/
/**
* Find drop columns.
*
* @param object $element Drag element
* @param object $root Dnd root element
* @access public
* @return object|bool
*/
function findDropColumns($element, $root)
{
var $col = $element.closest('.kanban-col');
@@ -216,42 +216,46 @@ function findDropColumns($element, $root)
if(colRules === true) return true;
var $newCol = $(this);
var newCol = $newCol.data();
var newCol = $newCol.data();
if(newCol.id === col.id) return false;
var $newLane = $newCol.closest('.kanban-lane');
var newLane = $newLane.data('lane');
var newLane = $newLane.data('lane');
return colRules.indexOf(newCol.type) > -1 && newLane.id === lane.id;
});
}
/**
* Handle finish drop task
* @param {Object} event Event object
* @returns {void}
* Handle finish drop card.
*
* @param object event
* @access public
* @return void
*/
function handleFinishDrop(event)
{
var $card = $(event.element); // The drag card
var $card = $(event.element); // The drag card.
var $dragCol = $card.closest('.kanban-lane-col');
var $dropCol = $(event.target);
/* Get d-n-d(drag and drop) infos 获取拖放操作相关信息 */
var card = $card.data('item');
/* Get d-n-d(drag and drop) info. */
var card = $card.data('item');
var fromColType = $dragCol.data('type');
var toColType = $dropCol.data('type');
var kanbanID = $card.closest('.kanban').data('id');
var toColType = $dropCol.data('type');
var kanbanID = $card.closest('.kanban').data('id');
changeCardColType(card, fromColType, toColType, kanbanID);
}
/**
* Change column type for a card
* @param {Object} card Card object
* @param {String} fromColType The column type before change
* @param {String} toColType The column type after change
* @param {String} kanbanID Kanban ID
* Change column type for a card.
*
* @param object card
* @param string fromColType The column type before change
* @param string toColType The column type after change
* @param int kanbanID
* @access public
* @return void
*/
function changeCardColType(card, fromColType, toColType, kanbanID)
{
@@ -303,7 +307,12 @@ function changeCardColType(card, fromColType, toColType, kanbanID)
}
/**
* The function for rendering kanban item
* The function for rendering kanban item.
*
* @param object item
* @param object $item
* @access public
* @return void
*/
function renderKanbanItem(item, $item)
{
@@ -387,10 +396,10 @@ function renderKanbanItem(item, $item)
}
/**
* Get planID
* Get planID.
*
* @param object $obj
* @param int $branch
* @param object obj
* @param int branch
* @access public
* @return void
*/
@@ -428,9 +437,9 @@ if(!window.kanbanDropRules)
{
window.kanbanDropRules =
{
wait: ['doing'],
doing: ['done'],
done: ['doing', 'closed'],
wait: ['doing'],
doing: ['done'],
done: ['doing', 'closed'],
closed: ['doing']
}
}
+14 -14
View File
@@ -111,20 +111,20 @@ $lang->productplan->endList[93] = '3 Months';
$lang->productplan->endList[186] = '6 Months';
$lang->productplan->endList[365] = '1 Year';
$lang->productplan->errorNoTitle = 'ID %s title should not be empty.';
$lang->productplan->errorNoBegin = 'ID %s begin time should not be empty.';
$lang->productplan->errorNoEnd = 'ID %s end time should not be empty.';
$lang->productplan->beginGeEnd = 'ID %s begin time should not be >= end time.';
$lang->productplan->beginLetterParent = "The start date of the parent plan: %s, the start date cannot be less than the start date of the parent plan.";
$lang->productplan->endGreaterParent = "The completion date of the parent plan: %s, the completion date cannot be greater than the completion date of the parent plan.";
$lang->productplan->beginGreaterChild = "The start date of the child plan: %s, the start date cannot be greater than the start date of the child plan.";
$lang->productplan->endLetterChild = "The completion date of the child plan: %s, the completion date cannot be less than the completion date of the child plan.";
$lang->productplan->noLinkedProject = "The current product has not been linked with a project. Please enter the list of the product to link or create a project.";
$lang->productplan->enterProjectList = "Enter the list of the product";
$lang->productplan->beginGreaterChildTip = "The start date of the parent plan[%s]: %s, cannot be greater than the start date of the child plan: %s.";
$lang->productplan->endLetterChildTip = "The completion date of the parent plan[%s]: %s, cannot be less than the completion date of the child plan: %s.", ;
$lang->productplan->beginLetterParentTip = "The start date of the child plan[%s]: %s, cannot be less than the start date of the parent plan: %s.";
$lang->productplan->endGreaterParentTip = "The completion date of the child plan[%s]: %s, cannot be greater than the completion date of the parent plan: %s.";
$lang->productplan->errorNoTitle = 'ID %s title should not be empty.';
$lang->productplan->errorNoBegin = 'ID %s begin time should not be empty.';
$lang->productplan->errorNoEnd = 'ID %s end time should not be empty.';
$lang->productplan->beginGeEnd = 'ID %s begin time should not be >= end time.';
$lang->productplan->beginLetterParent = "The start date of the parent plan: %s, the start date cannot be less than the start date of the parent plan.";
$lang->productplan->endGreaterParent = "The completion date of the parent plan: %s, the completion date cannot be greater than the completion date of the parent plan.";
$lang->productplan->beginGreaterChild = "The start date of the child plan: %s, the start date cannot be greater than the start date of the child plan.";
$lang->productplan->endLetterChild = "The completion date of the child plan: %s, the completion date cannot be less than the completion date of the child plan.";
$lang->productplan->noLinkedProject = "The current product has not been linked with a project. Please enter the list of the product to link or create a project.";
$lang->productplan->enterProjectList = "Enter the list of the product";
$lang->productplan->beginGreaterChildTip = "The start date of the parent plan[%s]: %s, cannot be greater than the start date of the child plan: %s.";
$lang->productplan->endLetterChildTip = "The completion date of the parent plan[%s]: %s, cannot be less than the completion date of the child plan: %s.", ;
$lang->productplan->beginLetterParentTip = "The start date of the child plan[%s]: %s, cannot be less than the start date of the parent plan: %s.";
$lang->productplan->endGreaterParentTip = "The completion date of the child plan[%s]: %s, cannot be greater than the completion date of the parent plan: %s.";
$lang->productplan->featureBar['browse']['all'] = 'All';
$lang->productplan->featureBar['browse']['wait'] = 'Waiting';
+14 -14
View File
@@ -111,20 +111,20 @@ $lang->productplan->endList[93] = '三个月';
$lang->productplan->endList[186] = '半年';
$lang->productplan->endList[365] = '一年';
$lang->productplan->errorNoTitle = 'ID %s 标题不能为空';
$lang->productplan->errorNoBegin = 'ID %s 开始时间不能为空';
$lang->productplan->errorNoEnd = 'ID %s 结束时间不能为空';
$lang->productplan->beginGeEnd = 'ID %s 开始时间不能大于结束时间';
$lang->productplan->beginLetterParent = "父计划的开始日期:%s,开始日期不能小于父计划的开始日期";
$lang->productplan->endGreaterParent = "父计划的完成日期:%s,完成日期不能大于父计划的完成日期";
$lang->productplan->beginGreaterChild = "子计划的开始日期:%s,开始日期不能大于子计划的开始日期";
$lang->productplan->endLetterChild = "子计划的完成日期:%s,完成日期不能小于子计划的完成日期";
$lang->productplan->noLinkedProject = "当前产品还未关联项目,请进入产品的项目列表关联或创建一个项目";
$lang->productplan->enterProjectList = "进入产品的项目列表";
$lang->productplan->beginGreaterChildTip = "父计划[%s]的开始日期:%s,不能大于子计划的开始日期: %s";
$lang->productplan->endLetterChildTip = "父计划[%s]的完成日期:%s,不能小于子计划的完成日期: %s";
$lang->productplan->beginLetterParentTip = "子计划[%s]的开始日期:%s,不能小于父计划的开始日期: %s";
$lang->productplan->endGreaterParentTip = "子计划[%s]的完成日期:%s,不能大于父计划的完成日期: %s";
$lang->productplan->errorNoTitle = 'ID %s 标题不能为空';
$lang->productplan->errorNoBegin = 'ID %s 开始时间不能为空';
$lang->productplan->errorNoEnd = 'ID %s 结束时间不能为空';
$lang->productplan->beginGeEnd = 'ID %s 开始时间不能大于结束时间';
$lang->productplan->beginLetterParent = "父计划的开始日期:%s,开始日期不能小于父计划的开始日期";
$lang->productplan->endGreaterParent = "父计划的完成日期:%s,完成日期不能大于父计划的完成日期";
$lang->productplan->beginGreaterChild = "子计划的开始日期:%s,开始日期不能大于子计划的开始日期";
$lang->productplan->endLetterChild = "子计划的完成日期:%s,完成日期不能小于子计划的完成日期";
$lang->productplan->noLinkedProject = "当前产品还未关联项目,请进入产品的项目列表关联或创建一个项目";
$lang->productplan->enterProjectList = "进入产品的项目列表";
$lang->productplan->beginGreaterChildTip = "父计划[%s]的开始日期:%s,不能大于子计划的开始日期: %s";
$lang->productplan->endLetterChildTip = "父计划[%s]的完成日期:%s,不能小于子计划的完成日期: %s";
$lang->productplan->beginLetterParentTip = "子计划[%s]的开始日期:%s,不能小于父计划的开始日期: %s";
$lang->productplan->endGreaterParentTip = "子计划[%s]的完成日期:%s,不能大于父计划的完成日期: %s";
$lang->productplan->featureBar['browse']['all'] = '所有';
$lang->productplan->featureBar['browse']['wait'] = '未开始';