mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* fixed moving a task to other list in all tasks tab
This commit is contained in:
parent
a03359a54f
commit
bcdf5e9eab
2 changed files with 27 additions and 8 deletions
10
src/ajax.php
10
src/ajax.php
|
|
@ -458,10 +458,14 @@ elseif(isset($_GET['moveTask']))
|
|||
{
|
||||
check_write_access();
|
||||
$id = (int)_post('id');
|
||||
// $fromId = (int)_post('from');
|
||||
$fromId = (int)_post('from');
|
||||
$toId = (int)_post('to');
|
||||
$r = moveTask($id, $toId);
|
||||
echo json_encode(array('total'=>$r?1:0));
|
||||
$result = moveTask($id, $toId);
|
||||
$t = array('total' => $result ? 1 : 0);
|
||||
if($fromId == -1 && $result && $r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id=$id")) {
|
||||
$t['list'][] = prepareTaskRow($r);
|
||||
}
|
||||
echo json_encode($t);
|
||||
exit;
|
||||
}
|
||||
elseif(isset($_GET['changeListOrder']))
|
||||
|
|
|
|||
|
|
@ -1691,11 +1691,26 @@ function moveTaskToList(taskId, listId)
|
|||
if(curList.id == listId) return;
|
||||
_mtt.db.request('moveTask', {id:taskId, from:curList.id, to:listId}, function(json){
|
||||
if(!parseInt(json.total)) return;
|
||||
changeTaskCnt(taskList[taskId], -1)
|
||||
delete taskList[taskId];
|
||||
taskOrder.splice($.inArray(taskId,taskOrder), 1);
|
||||
$('#taskrow_'+taskId).fadeOut('normal', function(){ $(this).remove() });
|
||||
refreshTaskCnt();
|
||||
if(curList.id == -1)
|
||||
{
|
||||
// leave the task in current tab (all tasks tab)
|
||||
var item = json.list[0];
|
||||
changeTaskCnt(item, 0, taskList[item.id]);
|
||||
taskList[item.id] = item;
|
||||
var noteExpanded = (item.note != '' && $('#taskrow_'+item.id).is('.task-expanded')) ? 1 : 0;
|
||||
$('#taskrow_'+item.id).replaceWith(prepareTaskStr(item, noteExpanded));
|
||||
if(curList.sort != 0) changeTaskOrder(item.id);
|
||||
refreshTaskCnt();
|
||||
$('#taskrow_'+item.id).effect("highlight", {color:_mtt.theme.editTaskFlashColor}, 'normal', function(){$(this).css('display','')});
|
||||
}
|
||||
else {
|
||||
// remove the task from currrent tab
|
||||
changeTaskCnt(taskList[taskId], -1)
|
||||
delete taskList[taskId];
|
||||
taskOrder.splice($.inArray(taskId,taskOrder), 1);
|
||||
$('#taskrow_'+taskId).fadeOut('normal', function(){ $(this).remove() });
|
||||
refreshTaskCnt();
|
||||
}
|
||||
});
|
||||
|
||||
$("#edittags").flushCache();
|
||||
|
|
|
|||
Loading…
Reference in a new issue