* Achieve smooth refresh of completed tasks.
This commit is contained in:
@@ -780,7 +780,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
|
||||
{
|
||||
if((fromColType == 'developing' || fromColType == 'wait') && priv.canFinishTask)
|
||||
{
|
||||
var link = createLink('task', 'finish', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true);
|
||||
var link = createLink('task', 'finish', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true);
|
||||
showIframe = true;
|
||||
}
|
||||
}
|
||||
@@ -903,6 +903,33 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*Close modal and update kanban data.
|
||||
*
|
||||
* @param string kanbanData
|
||||
* @param int regionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function updateKanban(kanbanData, regionID)
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
if(regionID)
|
||||
{
|
||||
updateRegion(regionID, kanbanData[regionID]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#kanban').children('.region').children("div[id^='kanban']").each(function()
|
||||
{
|
||||
var regionID = $(this).attr('data-id');
|
||||
updateRegion(regionID, kanbanData[regionID]);
|
||||
});
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shift card.
|
||||
*
|
||||
|
||||
@@ -649,7 +649,7 @@ class kanbanModel extends model
|
||||
|
||||
$kanbanData = array();
|
||||
$actions = array('sortGroup');
|
||||
$regions = $this->getRegionPairs($executionID);
|
||||
$regions = $this->getRegionPairs($executionID, $regionID);
|
||||
$regionIDList = $regionID == 0 ? array_keys($regions) : array(0 => $regionID);
|
||||
$groupGroup = $this->getGroupGroupByRegions($regionIDList);
|
||||
$laneGroup = $this->getLaneGroupByRegions($regionIDList, $browseType);
|
||||
@@ -711,14 +711,16 @@ class kanbanModel extends model
|
||||
* Get ordered region pairs.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @param int $regionID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRegionPairs($kanbanID)
|
||||
public function getRegionPairs($kanbanID, $regionID = 0 )
|
||||
{
|
||||
return $this->dao->select('id,name')->from(TABLE_KANBANREGION)
|
||||
->where('kanban')->eq($kanbanID)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->beginIF($regionID)->andWhere('id')->eq($regionID)->fi()
|
||||
->orderBy('order_asc')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
+22
-1
@@ -976,6 +976,9 @@ class task extends control
|
||||
{
|
||||
$this->commonAction($taskID);
|
||||
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->loadModel('action');
|
||||
@@ -1010,7 +1013,25 @@ class task extends control
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
|
||||
|
||||
if(isonlybody())
|
||||
{
|
||||
$execution = $this->execution->getByID($task->execution);
|
||||
if($execution->type == 'kanban')
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
$regionID = isset($output['regionID']) ? $output['regionID'] : 0;
|
||||
$kanbanData = $this->kanban->getRDKanban($task->execution, 'all', 'id_desc', $regionID);
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api')
|
||||
{
|
||||
return $this->send(array('result' => 'success', 'data' => $taskID));
|
||||
|
||||
Reference in New Issue
Block a user