mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
- fix: alltasks tab was not filled if new list with tasks was created in another session
This commit is contained in:
parent
dd27362e96
commit
b4703b29f8
2 changed files with 17 additions and 6 deletions
|
|
@ -1228,7 +1228,7 @@ function prepareTaskBlocks(item)
|
|||
'<div class="task-through">' +
|
||||
preparePrio(item.prio,id) +
|
||||
'<span class="task-title">' + prepareTaskTitleInlineHtml(item.title) + '</span> ' +
|
||||
(curList.id == -1 ? '<span class="task-listname">'+ tabLists.get(item.listId).name +'</span>' : '') +
|
||||
(curList.id == -1 ? prepareListNameInline(item) : '') +
|
||||
'<span class="task-tags">' + prepareTagsStr(item) + '</span>' +
|
||||
'<div class="task-date">' + prepareInlineDate(item) + '</div>' +
|
||||
'</div>' +
|
||||
|
|
@ -1251,14 +1251,22 @@ _mtt.prepareTaskBlocks = prepareTaskBlocks;
|
|||
|
||||
function prepareTaskTitleInlineHtml(s)
|
||||
{
|
||||
// Task title is already escaped on php back-end
|
||||
// Task title is already escaped on back-end
|
||||
return s;
|
||||
}
|
||||
_mtt.prepareTaskTitleInlineHtml = prepareTaskTitleInlineHtml;
|
||||
|
||||
function prepareListNameInline(item)
|
||||
{
|
||||
// Used in AllTasks list
|
||||
// List name is already escaped on back-end
|
||||
return '<span class="task-listname">'+ item.listName +'</span>';
|
||||
}
|
||||
_mtt.prepareListNameInline = prepareListNameInline;
|
||||
|
||||
function prepareTaskNoteInlineHtml(s, rawText)
|
||||
{
|
||||
// Task note is already escaped on php back-end
|
||||
// Task note is already escaped on back-end
|
||||
return s;
|
||||
};
|
||||
_mtt.prepareTaskNoteInlineHtml = prepareTaskNoteInlineHtml;
|
||||
|
|
|
|||
|
|
@ -24,16 +24,15 @@ class TasksController extends ApiController {
|
|||
$db = DBConnection::instance();
|
||||
$dbcore = DBCore::default();
|
||||
|
||||
$sqlWhere = $sqlWhereListId = $sqlInnerWhereListId = '';
|
||||
$sqlWhere = $sqlWhereListId = '';
|
||||
$userLists = [];
|
||||
if ($listId == -1) {
|
||||
$userLists = $this->getUserListsSimple();
|
||||
$userListsIds = implode(',', array_keys($userLists));
|
||||
$sqlWhereListId = "todo.list_id IN ($userListsIds) ";
|
||||
$sqlInnerWhereListId = "list_id IN ($userListsIds) ";
|
||||
}
|
||||
else {
|
||||
$sqlWhereListId = "todo.list_id=". $listId;
|
||||
$sqlInnerWhereListId = "list_id=$listId ";
|
||||
}
|
||||
if (_get('compl') == 0) {
|
||||
$sqlWhere .= ' AND compl=0';
|
||||
|
|
@ -125,6 +124,9 @@ class TasksController extends ApiController {
|
|||
while ($r = $q->fetchAssoc())
|
||||
{
|
||||
$t['total']++;
|
||||
if ($listId == -1 && $r['list_id']) {
|
||||
$r['list_name'] = $userLists[ (string)$r['list_id'] ] ?? '((undefined))';
|
||||
}
|
||||
$t['list'][] = $this->prepareTaskRow($r);
|
||||
}
|
||||
if (_get('setCompl') && haveWriteAccess($listId)) {
|
||||
|
|
@ -619,6 +621,7 @@ class TasksController extends ApiController {
|
|||
'title' => titleMarkup( $r['title'] ),
|
||||
'titleText' => (string)$r['title'],
|
||||
'listId' => $r['list_id'],
|
||||
'listName' => htmlarray($r['list_name'] ?? ''),
|
||||
'date' => htmlarray($dCreated),
|
||||
'dateInt' => (int)$r['d_created'],
|
||||
'dateFull' => htmlarray($dCreatedFull),
|
||||
|
|
|
|||
Loading…
Reference in a new issue